KYA 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.
curl https://api.finic.ai/v1/kya/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/kya/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/kya/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 /kya/s and gets back a session id, which it keeps in the kya_session cookie. In the browser console:
window.kya.session // "ksn_01M4Z2K8Q0V7C3N5T9XB6RHDWE"If it stays null, look at the POST /kya/s request in the network tab. A 204 answer means the report wasn't taken, and its X-KYA-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/kya/sessions/ksn_01M4Z2K8Q0V7C3N5T9XB6RHDWE \
-H "Authorization: Bearer $FINIC_API_KEY"{
"id": "ksn_01M4Z2K8Q0V7C3N5T9XB6RHDWE",
"site_id": "kst_01M4Z1X3G5P8D2F6J0YA4SMQNC",
"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/kya/sessions lists the latest sessions, without an id.
Read it on your server
The kya_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.
Try the agent lookup
The lookup needs no site or snippet: send what you saw of one request. The built-in test agent, KYA-Test-Agent, is verified from 192.0.2.0/24:
curl https://api.finic.ai/v1/kya/lookup \
-H "Authorization: Bearer $FINIC_API_KEY" \
-H "Content-Type: application/json" \
-d '{"ip": "192.0.2.10", "user_agent": "KYA-Test-Agent"}'{ "actor": "ai_agent", "operator": "Finic (test)", "product": "KYA-Test-Agent", "verification": "network_verified", "impersonated": false, "flags": ["test"], "test": true }Send it from 203.0.113.9 instead and it comes back impersonated.