Edge package

@finic/identify for Cloudflare Workers, Next.js and Node: it serves the snippet from your own domain and hands your origin each request's verdict as finic-* headers.

Not on npm yet

@finic/identify is being published and can't be installed from npm yet. Email support@finic.ai for early access.

After this page your application receives a verdict on every request as finic-* request headers, with no API call from your code. The package runs in front of your site and:

  • serves the snippet and relays its reports from your own domain (/_identify/agent.js, /_identify/s);
  • sets the visitor token as a cookie from your own domain, which Safari keeps for 400 days; one the snippet sets itself lasts 7;
  • removes any finic-* header the client sent, then sets its own;
  • never blocks a request. If Finic is slow or down, the request goes on without a verdict.

It needs two keys: FINIC_API_KEY, your secret gsk_… API key, and IDENTIFY_SITE_KEY, a site's public gpk_… key (create a site).

Set it up

For a site already proxied through Cloudflare. The Worker adds the script tag to your HTML pages itself, so your application doesn't change. In a new directory:

export { default } from "@finic/identify/cloudflare";
name = "identify"
main = "worker.js"
compatibility_date = "2025-01-01"
routes = [{ pattern = "{your_domain}/*", zone_name = "{your_domain}" }]

[vars]
IDENTIFY_SITE_KEY = "gpk_…"
npm init -y
npm install @finic/identify
npm install -D wrangler
npx wrangler secret put FINIC_API_KEY   # paste your gsk_… key
npx wrangler deploy

Optional: IDENTIFY_ORIGIN_SECRET (a secret, see Trust the headers) and IDENTIFY_SITE_ORIGIN (your site's public origin, such as https://www.example.com).

Request headers

Your application receives these on each request. A header is left out when its value is unknown.

HeaderValues
finic-actorhuman, ai_agent, automation, unknown
finic-verificationsigned, network_verified, claimed, impersonated, none
finic-operatorSuch as OpenAI
finic-productSuch as ChatGPT-User
finic-categorySuch as user_triggered_agent
finic-confidencehigh, medium, low. Only from a session
finic-sessionThe session's id, ksn_…. Only from a session
finic-visitorThe visitor's id, kvi_…. Only from a session whose browser has been identified
finic-sourceWhere the verdict came from, below
finic-edgeYour originSecret, when you set one
finic-sourceMeaning
sessionThe visitor's browser ran the snippet, and this request comes from that browser
lookupJudged from this request's IP address, user agent and signature alone. Never human
skippedNot looked at: a static asset, or a path you excluded
unavailableFinic didn't answer in time

skipped, unavailable and a missing finic-source mean no information. Never treat them as human. A visitor's first request has no session yet, so it's a lookup.

A session's verdict is used only when the request has the same user agent as the browser that reported, an address in the same network, and a report in the last 12 hours. A copied finic_session cookie doesn't make another client human.

Trust the headers

A request that reaches your application without passing the package carries whatever finic-* headers its sender chose: one sent straight to your origin, or one that bypassed a failing Worker. Set originSecret to a long random value. It's sent as finic-edge; ignore every finic-* header unless it matches.

const trusted = req.headers["finic-edge"] === process.env.IDENTIFY_ORIGIN_SECRET;
const actor = trusted ? req.headers["finic-actor"] : undefined;

When Finic is slow or down

Your site keeps working. Nothing throws, and a request waits at most timeoutMs for its verdict.

What happensWhat the package does
A verdict takes longer than timeoutMs (150 ms), or the API returns an errorThe request goes on with finic-source: unavailable and no other verdict header
5 verdict calls in a row failThe API isn't called for 10 seconds; requests go on at once as unavailable
/_identify/agent.js can't be fetchedThe last good copy is served, else an empty script
/_identify/s can't be relayed within 2 secondsThe report is dropped with a 204
A key is missing, or the two are swappedThe API isn't called: every request goes on as unavailable, with one console warning

Options

OptionDefault
apiKey, siteKeyRequiredThe gsk_… and gpk_… keys
apiUrlhttps://api.finic.ai
path/_identifyWhere the snippet and its reports are served on your domain. Change it in the script tag too
timeoutMs150The longest a request waits for its verdict
originSecretNoneSent to your application as finic-edge
siteOriginNoneYour site's public origin. Request signatures are checked against it instead of the Host the client sent. Set it on Node and self-hosted Next.js
injecttrueCloudflare only: add the script tag to HTML pages
excludeNonePath prefixes that never get a verdict
includeNonePath prefixes that get a verdict. When set, nothing else does

Without include, every request gets a verdict except a GET or HEAD of a static asset, such as .js, .css or an image. On Cloudflare, pass options with createWorker((env) => ({ apiKey: env.FINIC_API_KEY, siteKey: env.IDENTIFY_SITE_KEY, exclude: ["/health"] })) as the Worker's default export.

On this page