JavaScript agent
The agent runs in the browser, has no dependencies and weighs 19 KB gzipped. It exposes the global Siftil object (<script> tag) or the same names as an ES module.
Installation
Tag (simplest, cached for 1 hour):
<script src="https://siftil.com/v1/agent.js"></script>From your own domain, which gets past ad blockers: see First-party proxy. The tag becomes <script src="/_r/agent.js"></script> and the endpoint becomes /_r.
Content Security Policy: allow the Siftil origin in script-src and connect-src (or only your own domain, if you use the proxy).
script-src 'self' https://siftil.com; connect-src 'self' https://siftil.comSiftil.identify(options)
Collects, solves the challenge, measures latency and sends everything to the edge. Returns Promise<{ result, server }>.
const { result, server } = await Siftil.identify({
endpoint: 'https://siftil.com/v1', // or '/_r' with the proxy
apiKey: 'pk_…',
linkedId: 'user-42', // optional, after login
})| Option | Type | Default | What it does |
|---|---|---|---|
endpoint | string | required | Base of the routes. https://siftil.com/v1 directly, or your proxy path. |
apiKey | string | — | Public key pk_…. With it the agent uses text/plain and avoids a CORS preflight. |
linkedId | string | — | The user's ID in your system (up to 128 characters). Do not send e-mails or national IDs: use an internal ID. |
measureRtt | boolean | true | Measures latency to the edge (3 samples) to catch residential proxies and VPNs. |
timeout | number | 1000 | Maximum time for each async source, in ms. |
exclude | string[] | [] | Sources that should not run, for example ['audio', 'webgpu']. |
persist | boolean or string | false | Stores a random ID in localStorage and a first-party cookie (siftil_sid by default). Helps when the browser randomizes everything (Brave). Ask for consent if your policy requires it. |
raw | boolean | false | Sends raw attributes too; they come back in the event (raw). Makes the payload bigger. |
credentials | string | 'omit' | fetch cookie policy. With the proxy on the same domain, 'same-origin' works. |
What comes back in server
{
"requestId": "fd15e76e8581d83a012b14fa",
"visitorId": "rv_2fa950ff96f748c8b9fd038988705c6c",
"isNew": false,
"confidence": 0.967,
"token": "rst1.eyJyaWQiOi….Q2x0…",
"sealed": "rss1.k3Jx…",
"suspect": { "score": 3, "risk": "low" }
}confidence: similarity with the visitor that was found (1 = identical signature; 0 = new visitor).token: a signed summary of the decision, for your backend to check. See Server-side verification.sealed: the whole event encrypted with your seal key. The browser carries it; only your backend can open it.
The full score and the signals never go back to the browser: whoever reads the response learns nothing about how to get around it.
What comes back in result
What the agent saw locally, without a server:
| Field | Meaning |
|---|---|
visitorId | 128-bit hash of deterministic components only (the "clientId"). It is local; the ID that counts is server.visitorId. |
confidence, bits | Uniqueness and entropy estimate of the local hash. |
components | Every collected component, with value and timing. |
bot | { detected, kind, signals }: automation seen in the browser (webdriver, headless, stealth, CDP). |
tampering | { detected, signals }: native APIs replaced by JavaScript, forged properties. |
privacy | { incognito, antiFingerprinting, noisy }: incognito and anti-fingerprinting protection (Brave, Safari, Firefox, extensions). |
env | { vm, devtools, emulator, inApp, webview }. |
behavior | Biometrics since observe(), or null. |
ms | Total collection time. |
Siftil.observe() and Siftil.stopObserving()
Starts recording mouse movement, touch, scrolling and typing rhythm (timings only, never the keys). The summary goes with the next identify and reveals synthetic events, perfectly straight lines and machine rhythm. Call it when the form page loads. stopObserving() turns it off.
Siftil.get(options)
Local collection only, no network. Useful for debugging or for the self-hosted version. Accepts timeout, exclude, persist.
Good practice
- Start early, wait late: call
identifywhen the form loads and use the promise on submit. - One identification per action: signup, login, checkout. Do not call on every click; each call counts against your quota.
- SPAs: call again when the user reaches a sensitive flow; the
visitorIdstays the same. - Network failure: if
identifyrejects (blocker, bad network), let the flow continue and treat it as "no signal" in the backend. Do not block legitimate customers for a missing token; add friction instead (e-mail or SMS verification). - Privacy: the agent does not read third-party cookies, page content, form fields or typed keys.
Browsers
Chrome, Edge, Opera, Brave, Samsung Internet, Firefox and Safari, last two major versions, on desktop, Android and iOS, plus Android WebView and in-app browsers (Instagram, Facebook, TikTok, LinkedIn). On very old browsers the agent collects what it can; the server compares only what arrived.
Siftil · API v1 documentation