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 deployOptional: 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.
| Header | Values |
|---|---|
finic-actor | human, ai_agent, automation, unknown |
finic-verification | signed, network_verified, claimed, impersonated, none |
finic-operator | Such as OpenAI |
finic-product | Such as ChatGPT-User |
finic-category | Such as user_triggered_agent |
finic-confidence | high, medium, low. Only from a session |
finic-session | The session's id, ksn_…. Only from a session |
finic-visitor | The visitor's id, kvi_…. Only from a session whose browser has been identified |
finic-source | Where the verdict came from, below |
finic-edge | Your originSecret, when you set one |
finic-source | Meaning |
|---|---|
session | The visitor's browser ran the snippet, and this request comes from that browser |
lookup | Judged from this request's IP address, user agent and signature alone. Never human |
skipped | Not looked at: a static asset, or a path you excluded |
unavailable | Finic 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 happens | What the package does |
|---|---|
A verdict takes longer than timeoutMs (150 ms), or the API returns an error | The request goes on with finic-source: unavailable and no other verdict header |
| 5 verdict calls in a row fail | The API isn't called for 10 seconds; requests go on at once as unavailable |
/_identify/agent.js can't be fetched | The last good copy is served, else an empty script |
/_identify/s can't be relayed within 2 seconds | The report is dropped with a 204 |
| A key is missing, or the two are swapped | The API isn't called: every request goes on as unavailable, with one console warning |
Options
| Option | Default | |
|---|---|---|
apiKey, siteKey | Required | The gsk_… and gpk_… keys |
apiUrl | https://api.finic.ai | |
path | /_identify | Where the snippet and its reports are served on your domain. Change it in the script tag too |
timeoutMs | 150 | The longest a request waits for its verdict |
originSecret | None | Sent to your application as finic-edge |
siteOrigin | None | Your 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 |
inject | true | Cloudflare only: add the script tag to HTML pages |
exclude | None | Path prefixes that never get a verdict |
include | None | Path 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.
Visitors
How Identify gives each session a visitor id that stays the same when the browser comes back, with its cookies cleared or in a private window, how a visitor is matched, how sure a match is and what it can't tell apart.
Agent lookup
POST /v1/identify/lookup says, from one request's IP address, user agent and signature headers, whether it comes from a declared AI agent or crawler, and whether that claim is verified, claimed or impersonated.