Identify quickstart

Create a site with your API key, paste one script tag, load a page and read its session's verdict. Then try the agent lookup with the built-in test agent.

After these steps your server can read, for any visitor's browser session, whether it's a person, an AI agent or other automation. You need an API key in FINIC_API_KEY (get one).

Create a site

A site is a public key for the snippet. origins lists the pages that may report under it.

You can do this step in the Finic app instead: Sites, then Add site. Sessions show up under Sessions as pages are visited.

curl https://api.finic.ai/v1/identify/sites \
  -H "Authorization: Bearer $FINIC_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"name": "Storefront", "origins": ["https://www.example.com"]}'
{
  "id": "kst_01M4Z1X3G5P8D2F6J0YA4SMQNC",
  "name": "Storefront",
  "key": "gpk_Zk3vQ8mT1xR7bN2cYw5LpA9d",
  "origins": ["https://www.example.com"],
  "snippet": "<script async src=\"https://api.finic.ai/identify/agent.js\" data-site=\"gpk_Zk3vQ8mT1xR7bN2cYw5LpA9d\"></script>",
  "created_at": "2026-12-01T17:01:52.310447Z",
  "request_id": "req_01M4Z1X3H2N7Q4B8D6KC9TWEFA"
}

The gpk_… key is not a secret: it goes in your pages. To try it on localhost, leave origins out, or add http://localhost:3000.

Paste the tag

Put snippet in the <head> of every page:

<script async src="https://api.finic.ai/identify/agent.js" data-site="gpk_Zk3vQ8mT1xR7bN2cYw5LpA9d"></script>

It loads without blocking the page and never throws into it. Data & privacy lists what it collects, and the Content-Security-Policy it needs if your site has one.

Load a page

Open a page with the tag in a browser. The snippet reports to POST /identify/s and gets back a session id, which it keeps in the finic_session cookie. In the browser console:

window.finic.session // "ksn_01M4Z2K8Q0V7C3N5T9XB6RHDWE"

If it stays null, look at the POST /identify/s request in the network tab. A 204 answer means the report wasn't taken, and its X-Finic-Refused header says why, such as origin (the page isn't one of the site's origins), site (unknown key) or rate.

Read the verdict

curl https://api.finic.ai/v1/identify/sessions/ksn_01M4Z2K8Q0V7C3N5T9XB6RHDWE \
  -H "Authorization: Bearer $FINIC_API_KEY"
{
  "id": "ksn_01M4Z2K8Q0V7C3N5T9XB6RHDWE",
  "site_id": "kst_01M4Z1X3G5P8D2F6J0YA4SMQNC",
  "entity_id": null,
  "status": "complete",
  "actor": "unknown",
  "operator": null,
  "product": null,
  "category": null,
  "verification": "none",
  "confidence": "low",
  "reasons": [],
  "network": { "type": "unknown", "provider": null, "range": null },
  "ip": "198.51.100.24",
  "user_agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/131.0.0.0 Safari/537.36",
  "page": "https://www.example.com/checkout",
  "reports": 2,
  "created_at": "2026-12-01T17:04:11.482913Z",
  "updated_at": "2026-12-01T17:04:12.127540Z",
  "request_id": "req_01M4Z2M1T6W9E3R7Y5VA8PKGHB"
}

A page that has only just loaded is unknown with low confidence: nothing seen either way. Move the mouse or type and read it again: it becomes human with human_like_input. While DevTools is open, reasons also lists devtools_protocol, and human is medium, not high. Load the same page with Playwright, Puppeteer or Selenium to see automation. Verdicts explains every field.

GET /v1/identify/sessions lists the latest sessions, without an id.

Read it on your server

The finic_session cookie is set on your own domain, so your server receives it with each request. Read the session when it matters (a sign-in, a checkout), since a verdict changes as the page is used.

Anyone can send a cookie. Before you rely on a session, check that its ip and user_agent match the request in front of you. The edge package does this for you and hands your server the verdict as request headers.

A session is one browser tab's visit: it doesn't know who signed in. When your server does, such as after sign-in, give the session your own id for that customer or account as its entity_id:

curl -X PATCH https://api.finic.ai/v1/identify/sessions/ksn_01M4Z2K8Q0V7C3N5T9XB6RHDWE \
  -H "Authorization: Bearer $FINIC_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"entity_id": "user_123"}'

The answer is the session, with "entity_id": "user_123". Its verdict doesn't change. Only your API key sets an entity id: the snippet can't.

To list that customer's sessions, newest first:

curl "https://api.finic.ai/v1/identify/sessions?entity_id=user_123" \
  -H "Authorization: Bearer $FINIC_API_KEY"

An entity id is any string of yours, up to 128 characters. Send {"entity_id": null} to clear it. See update_session.

Try the agent lookup

The lookup needs no site or snippet: send what you saw of one request. The built-in test agent, Finic-Test-Agent, is verified from 192.0.2.0/24:

curl https://api.finic.ai/v1/identify/lookup \
  -H "Authorization: Bearer $FINIC_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"ip": "192.0.2.10", "user_agent": "Finic-Test-Agent"}'
{ "actor": "ai_agent", "operator": "Finic (test)", "product": "Finic-Test-Agent", "verification": "network_verified", "impersonated": false, "flags": ["test"], "test": true }

Send it from 203.0.113.9 instead and it comes back impersonated.

On this page