Siftil Documentation PT Sign in Create free account

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):

html
<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).

text
script-src 'self' https://siftil.com; connect-src 'self' https://siftil.com

Siftil.identify(options)

Collects, solves the challenge, measures latency and sends everything to the edge. Returns Promise<{ result, server }>.

js
const { result, server } = await Siftil.identify({
  endpoint: 'https://siftil.com/v1', // or '/_r' with the proxy
  apiKey: 'pk_…',
  linkedId: 'user-42',          // optional, after login
})
OptionTypeDefaultWhat it does
endpointstringrequiredBase of the routes. https://siftil.com/v1 directly, or your proxy path.
apiKeystring—Public key pk_…. With it the agent uses text/plain and avoids a CORS preflight.
linkedIdstring—The user's ID in your system (up to 128 characters). Do not send e-mails or national IDs: use an internal ID.
measureRttbooleantrueMeasures latency to the edge (3 samples) to catch residential proxies and VPNs.
timeoutnumber1000Maximum time for each async source, in ms.
excludestring[][]Sources that should not run, for example ['audio', 'webgpu'].
persistboolean or stringfalseStores 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.
rawbooleanfalseSends raw attributes too; they come back in the event (raw). Makes the payload bigger.
credentialsstring'omit'fetch cookie policy. With the proxy on the same domain, 'same-origin' works.

What comes back in server

json
{
  "requestId": "fd15e76e8581d83a012b14fa",
  "visitorId": "rv_2fa950ff96f748c8b9fd038988705c6c",
  "isNew": false,
  "confidence": 0.967,
  "token": "rst1.eyJyaWQiOi….Q2x0…",
  "sealed": "rss1.k3Jx…",
  "suspect": { "score": 3, "risk": "low" }
}

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:

FieldMeaning
visitorId128-bit hash of deterministic components only (the "clientId"). It is local; the ID that counts is server.visitorId.
confidence, bitsUniqueness and entropy estimate of the local hash.
componentsEvery 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 }.
behaviorBiometrics since observe(), or null.
msTotal 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

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