Skip to main content

Device fingerprint

Native iOS, Android, React Native and Flutter apps use the mobile SDKs instead of this collector.

The browser collector gathers device components and submits them to POST /v1/fp/collect. The server resolves the device identity and returns fp_id; the client never decides it.

  1. Add the collector bundle to your page (Defraudo provides the versioned URL and its SRI integrity value):

    <script src="<collector-url>/fingerprint.global.js" integrity="sha384-..." crossorigin="anonymous"></script>
  2. Allow your page origin for the project (dashboard, project settings, allowed origins). The publishable key must belong to the same project as the secret key that sends events (a sandbox event needs a sandbox collect key); otherwise the device is not found at scoring.

  3. Call the collector with a publishable key. The bundle exposes a global AntiFrodFP:

    const config = {
    url: 'https://api.defraudo.com/v1/fp/collect',
    apiKey: 'pk_live_xxxxxxxxxxxxxxxxxxxxxx',
    // externalAccountId is ignored with a publishable key; accounts are linked by the event (step 4)
    };

    AntiFrodFP.prewarm(); // on page load: starts the heavy collection early
    const response = await AntiFrodFP.submitFast(config); // at the user's action
    const { data } = await response.json(); // data.fp_id
    AntiFrodFP.submitFull(config); // optional: fire-and-forget full stage
  4. Send fp_id to your backend and put it in the event with external_account_id, using your secret key; this is what links the account to the device:

    { "event_id": "...", "event_type": "login", "external_account_id": "user-123", "context": { "fp_id": "<data.fp_id>", "platform": "web" } }

    Send the event only after submitFast has returned, with that fp_id. In the iGaming presets an action marked "platform": "web" that arrives with no fp_id, or with an id this project never issued (collected under another project's key, or the event sent before collect finished), is blocked by R-HB-WEB-NO-FP. Events from your native app (ios, android) and events without platform are not affected, since the collector does not run in a native app. Users you mark trusted or vip are exempt.

Each collect carries a collect_id. Resend it unchanged when you retry the same collect after a network error and you get the original fp_id back, with no second device or history entry written; without one, the server generates it. If the first attempt was stored without an fp_id, the retry answers 409 COLLECT_ID_UNAVAILABLE: collect again with a new id. From SDK 0.3.0 the collector sends one with every collect and reuses it when it retries the same request.

Staged submissions with the same session_id reuse one fp_id while the session is active (600 s after the last collect). A provisional id created from too little data is replaced by the next stage that has enough; both ids keep working for scoring. The collector can also request browser location on the full stage if you pass a location option; it is off by default. The bundle stays under 30 KB gzip.

The collector is versioned: each deployed version has its own URL, and older versions stay served, so a page pinned to one keeps working. New SDK versions are listed in the changelog.

The collector keeps one random id, dfr_did, in your page's localStorage and in a first-party cookie of the same name (400 days). The server identifies the device by it first, so two devices of the same model and OS (which render identical components) stay separate devices. It holds no personal data and is used only for fraud prevention; list it in your cookie notice. If the browser blocks storage, the id is left out and the device is matched on its components alone.

Called with a secret key, the collect response also returns match_level, match_distance and a device object: is_bot, is_emulator, prototype_tampered (each true or "unknown") and timezone_mismatch (true, false or "unknown"). timezone_mismatch compares the device's IANA time zone with the UTC-offset range of the IP country, allowing one hour of tolerance; it is "unknown" when either side cannot be evaluated. A publishable key never receives these fields, because the page that holds it is readable by every visitor.

Native payload​

The mobile SDKs call the same POST /v1/fp/collect with native_payload instead of fingerprintjs_payload; a request carries exactly one of the two. native_payload holds platform (ios or android), sdk_version, os_version, device_model, device_type (mobile or tablet), an optional device_manufacturer and a components object, and the top-level device_id becomes required. A missing or blank required field, or both payloads at once, is answered with 400 VALIDATION_ERROR naming the field. The browser request is unchanged. Full schema: API reference.