knownprintDocs

Webhooks

Webhooks

Receive signed HTTPS calls from knownprint when a browser is identified, an account shows up on a new browser, or a visitor is merged, split or deleted, with retries, a deliveries log and replay.

A webhook is an HTTPS endpoint on your side that knownprint calls when something happens in your environment: a browser is identified, one of your accounts turns up on another browser, two visitor ids turn out to be one, a visitor is deleted. Instead of polling the API, your backend receives a signed JSON body within seconds and acts on it.

Every delivery is signed, so your endpoint can prove it came from knownprint (Verify a webhook). A delivery that fails is retried, up to eight attempts in all over 72 hours, every attempt is recorded in a deliveries log you can read, and any finished delivery can be sent again on request.

This page explains what you receive and how delivery behaves. The routes that manage webhooks are documented in the Webhooks API reference.

Set up an endpoint

You need a secret key with the webhooks:manage scope (Keys). Webhooks are managed through the API; each one belongs to the environment of the key that created it.

  1. Build the receiver. Add a route to your backend that accepts POST with a JSON body, reads the body as raw bytes, verifies the signature, and answers 2xx quickly. Verify a webhook has complete receivers in Node, Python and Go.

  2. Register it. Create the webhook with the URL and the event types you want:

    Shell
    curl "$KNOWNPRINT_API/v1/webhooks" \
      -H "Authorization: Bearer $KNOWNPRINT_SECRET_KEY" \
      -H "Content-Type: application/json" \
      -H "Idempotency-Key: create-webhook-backend-1" \
      -d '{
        "url": "https://example.com/webhooks/knownprint",
        "event_types": ["event.identified", "account.related_found", "visitor.merged"]
      }'

    The answer is 201 with the webhook and its signing secret:

    JSON
    {
      "id": "wh_amg7qtxufogaunw7qawsqrgoxb",
      "url": "https://example.com/webhooks/knownprint",
      "event_types": ["event.identified", "account.related_found", "visitor.merged"],
      "format": "standard",
      "enabled": true,
      "created_at": "2026-12-02T12:00:00.000Z",
      "secret": "whsec_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
    }
  3. Store the secret. secret is returned once, by this answer, and never again: no route reads it back. Put it in your secrets manager or environment (for example KNOWNPRINT_WEBHOOK_SECRET). If you retry the create with the same Idempotency-Key and the same body within 24 hours, you get the same webhook and the same secret back instead of a second webhook.

  4. Send a test. Ask knownprint to send a webhook.test delivery to the new endpoint, then read the deliveries log to see how it went:

    Shell
    curl -X POST "$KNOWNPRINT_API/v1/webhooks/wh_amg7qtxufogaunw7qawsqrgoxb/test" \
      -H "Authorization: Bearer $KNOWNPRINT_SECRET_KEY"
    
    curl "$KNOWNPRINT_API/v1/webhooks/wh_amg7qtxufogaunw7qawsqrgoxb/deliveries?limit=5" \
      -H "Authorization: Bearer $KNOWNPRINT_SECRET_KEY"

    A delivery with "status": "delivered" means your endpoint answered 2xx. See Test deliveries.

The URL must use https, carry no user name or password, and resolve only to public internet addresses. The URL is checked when you register it: one that points at a private, loopback, link-local or otherwise reserved address, or whose host name does not resolve, is refused with 422 validation_failed and the detail url_rejected. The same check runs again at every delivery attempt, so a host name that later resolves to a reserved address fails the attempt with url_rejected (or dns when it no longer resolves) in the deliveries log. To receive webhooks on a development machine, expose it through a public HTTPS tunnel and register the tunnel's address.

Event types

A webhook subscribes to one to eight of these types (event_types). webhook.test is not subscribable: only a test delivery carries it.

TypeFires whenEnvelope visitor_id
event.identifiedA browser is identified and a new event is recordedThe event's visitor
account.linkedA visitor carries one of your linked ids for the first timeThe visitor
account.related_foundThat new pair means a linked id now has several visitors, or a visitor several linked idsThe visitor
visitor.mergedTwo visitor ids are found to be one browser and are mergedThe surviving visitor
visitor.unmergedA merge is undoneThe restored visitor
visitor.splitPart of a visitor is moved to a new visitor idThe new visitor
visitor.suggestedA past visitor may be another visitor; no id changesThe past visitor
visitor.deletedA visitor's data has been deletedThe deleted visitor
webhook.testYou asked for a test deliverynull

Every delivery has the same outer shape, the envelope. What differs by type is data, described below.

event.identified

Fires once for each new event: each time the agent on your page identifies a browser and knownprint records the result. A replayed request does not produce a second delivery.

data is the complete event, exactly the object GET /v1/events/{request_id} returns for it, as it stood at the moment of identification. Its fields (request_id, visitor_id, confidence, anonymity_set_size, linked_id, tags, the signals and the rest) are documented on Events.

event.identified (data abridged)
{
  "v": 1,
  "id": "dl_oh26kwfbvskdjleostefx3pzkk",
  "type": "event.identified",
  "created_at": "2026-12-02T12:00:00.000Z",
  "environment_id": "env_wczpaxppqdzxap2fhelv6asokc",
  "visitor_id": "v_gx4osuthsfn5i6evdwyvuzxd2z",
  "data": {
    "request_id": "evt_fih672iilexbhuijjplt6yjas5",
    "environment_id": "env_wczpaxppqdzxap2fhelv6asokc",
    "visitor_id": "v_gx4osuthsfn5i6evdwyvuzxd2z",
    "match_type": "token",
    "confidence": 0.99,
    "anonymity_set_size": 1,
    "linked_id": "account-1842",
    "url_path": "/login"
  }
}

The delivery is a copy taken when the event was recorded. Incognito and the suspect score can be refined within about ten seconds of the identification, and the bot verdict can turn bad for up to 30 minutes after it; those updates, and changes you make later (tags or a linked id set with PATCH /v1/events/{request_id}, feedback), are not sent again. When a decision depends on the event's current state, read it with GET /v1/events/{request_id} using data.request_id when the visitor acts.

account.linked

Fires when a visitor is seen with one of your linked ids for the first time: the linked id was attached at identification or later with PATCH /v1/events/{request_id}, and that visitor had never carried it before. A pair already recorded fires nothing, however often it is seen again.

FieldTypeMeaning
visitor_idstringThe visitor, v_...
linked_idstringYour linked id, as you sent it
JSON
{
  "v": 1,
  "id": "dl_v7k75veqcqpzq4kzfy4w6cc7zu",
  "type": "account.linked",
  "created_at": "2026-12-02T12:00:00.000Z",
  "environment_id": "env_wczpaxppqdzxap2fhelv6asokc",
  "visitor_id": "v_gx4osuthsfn5i6evdwyvuzxd2z",
  "data": {
    "visitor_id": "v_gx4osuthsfn5i6evdwyvuzxd2z",
    "linked_id": "account-1842"
  }
}

Fires together with account.linked when the new pair means that the linked id is now carried by more than one visitor, or that the visitor now carries more than one linked id. This is the event to watch for shared, sold or duplicate accounts: one account on several browsers, or several accounts on one browser.

FieldTypeMeaning
visitor_idstringThe visitor of the new pair
linked_idstringThe linked id of the new pair
visitorsintegerHow many visitors now carry linked_id, this one included
linked_idsintegerHow many linked ids this visitor now carries, linked_id included
JSON
{
  "v": 1,
  "id": "dl_v7k75veqcqpzq4kzfy4w6cc7zu",
  "type": "account.related_found",
  "created_at": "2026-12-02T12:00:00.000Z",
  "environment_id": "env_wczpaxppqdzxap2fhelv6asokc",
  "visitor_id": "v_gx4osuthsfn5i6evdwyvuzxd2z",
  "data": {
    "visitor_id": "v_gx4osuthsfn5i6evdwyvuzxd2z",
    "linked_id": "account-1842",
    "visitors": 1,
    "linked_ids": 3
  }
}

To see which visitors and linked ids are involved, call GET /v1/visitors/{visitor_id}/related or GET /v1/linked/{linked_id}/related. Accounts explains how to act on related accounts.

visitor.merged

Fires when knownprint finds that two visitor ids are one browser and merges them. The older id survives; the other becomes its alias. From then on, every new event names the surviving id, and GET /v1/visitors/{visitor_id} answers the surviving visitor for either id. Events recorded before the merge keep the id they were answered with. Visitors explains merges in full.

The envelope's visitor_id is the surviving visitor.

FieldTypeMeaning
alias_idstringThe visitor merged away, from now on an alias of canonical_id
canonical_idstringThe surviving visitor, equal to the envelope's visitor_id
reasonstringtwo_tokens, reevaluation, chain or relink (relink for a merge found when past visitors were looked at again). Informational; do not build rules on it. A merge with two_tokens cannot be undone
linker_versionstringAn opaque version string, for knownprint's own use; do not build rules on it
posteriornumber or nullFor knownprint's own use; do not build rules on it. Read probability
probabilitynumber or nullHow likely the two visitors are one device, from 0 to 1; null when none was given
JSON
{
  "v": 1,
  "id": "dl_v7k75veqcqpzq4kzfy4w6cc7zu",
  "type": "visitor.merged",
  "created_at": "2026-12-02T12:00:00.000Z",
  "environment_id": "env_wczpaxppqdzxap2fhelv6asokc",
  "visitor_id": "v_gx4osuthsfn5i6evdwyvuzxd2z",
  "data": {
    "alias_id": "v_nnfdmplf52gttvrmtt5o36qneh",
    "canonical_id": "v_gx4osuthsfn5i6evdwyvuzxd2z",
    "reason": "relink",
    "linker_version": "v5.1",
    "posterior": 0.991,
    "probability": 0.984
  }
}

What to do: wherever you stored alias_id beside your own records (bans, claims, reviews), treat those records as belonging to canonical_id too. Keep the alias: it still resolves.

visitor.unmerged

Fires when knownprint undoes a merge by hand, for example after you tell your knownprint contact that a merge was wrong. No API route undoes a merge. The former alias is its own visitor again, under its own id, and the events its browser made while the two were merged name it again. The two visitors are kept apart from then on.

The envelope's visitor_id is the restored visitor.

FieldTypeMeaning
visitor_idstringThe restored visitor, the alias of the undone merge
canonical_idstringThe visitor it had been merged into
reasonstringAlways operator: the merge was undone by hand
linker_versionstringAn opaque version string, for knownprint's own use
moved_eventsintegerHow many events now name visitor_id again

What to do: move back any records you had attributed to canonical_id because of the merge, and re-read the restored visitor's events with GET /v1/events and its visitor_id filter.

visitor.split

Fires when part of a visitor turns out to be a different device and is moved to a new visitor id, together with its events. The two are kept apart from then on; a split is not undone.

The envelope's visitor_id is the new visitor.

FieldTypeMeaning
visitor_idstringThe new visitor
parent_idstringThe visitor it was split from
reasonstringoperator for a split knownprint made by hand, for example after you disputed a link; audit or fleet for a split knownprint made on its own. Informational; do not build rules on it
linker_versionstringAn opaque version string, for knownprint's own use
moved_eventsintegerHow many events moved to visitor_id and name it from now on

What to do: re-read the new visitor's events with GET /v1/events?visitor_id=... and review any decision you took against parent_id that rested on those events.

visitor.suggested

Fires when knownprint, looking at past visitors again, finds that one may be the same device as another, but does not merge them. No id changes. Treat it as a lead for review, not as a merge.

The envelope's visitor_id is the past visitor the suggestion is about.

FieldTypeMeaning
visitor_idstringThe past visitor
suggested_idstringThe visitor it may also be
posteriornumberFor knownprint's own use; do not build rules on it. Read probability
probabilitynumberHow likely the two are the same device, from 0 to 1
reasonstringAlways relink
linker_versionstringAn opaque version string, for knownprint's own use

visitor.deleted

Fires when a deletion of a visitor has run: after DELETE /v1/visitors/{visitor_id}, or when deleting a linked id with DELETE /v1/linked/{linked_id} leaves a visitor with no linked id and that visitor is deleted too. The delivery is queued in the same transaction as the deletion, so it is sent only once the data is gone. A visitor that expires through inactivity does not fire it.

FieldTypeMeaning
visitor_idstringThe deleted visitor. When you asked to delete an alias, this is the surviving visitor the alias resolved to
job_idstringThe visitor's deletion job, del_.... For DELETE /v1/visitors/{visitor_id} it is the job_id that request answered. For a visitor deleted because of DELETE /v1/linked/{linked_id}, it is a job of its own, not the linked id's job

Use it to confirm a deletion you requested, or to delete what your own systems hold about that visitor id.

webhook.test

Sent only by POST /v1/webhooks/{id}/test. visitor_id is null and data holds one field:

FieldTypeMeaning
webhook_idstringThe webhook the test was sent to, wh_...

The envelope

Every delivery in the standard format is one JSON object with exactly these members:

FieldTypeMeaning
vintegerThe envelope version, always 1
idstringThe delivery id, dl_ and 26 characters. The same value is sent as the webhook-id header
typestringOne of the event types
created_atstringWhen the delivery was queued: the time of the change it reports, RFC 3339 in UTC with milliseconds
environment_idstringThe environment, env_...
visitor_idstring or nullThe visitor the change concerns (see the table of event types); null for webhook.test
dataobjectThe type's fields

created_at is the time of the change, not of the attempt. A delivery that is retried keeps its body: every attempt carries the same id, created_at and data.

Write your parser to ignore fields it does not know inside data, and to accept values it does not know in fields such as reason, so that a new value never breaks your endpoint.

Request headers

Each attempt is an HTTP POST with these headers:

HeaderValue
content-typeapplication/json
user-agentknownprint-webhooks/ followed by the API version (the version that GET /health reports)
webhook-idThe delivery id, equal to the envelope's id
webhook-timestampThe attempt's time in Unix seconds
webhook-signaturev1, and the base64 HMAC-SHA256 signature of the attempt

The signature follows the Standard Webhooks scheme. Each attempt is signed afresh with its own timestamp, so a retry carries a new webhook-timestamp and webhook-signature but the same webhook-id. Verify a webhook gives the algorithm and the code.

Delivery and retries

knownprint queues a delivery as soon as the change is recorded, and makes the first attempt within seconds.

What counts as success. An attempt succeeds when your endpoint answers with any 2xx status within 10 seconds. The 10 seconds cover the whole attempt: resolving your host name, connecting, sending the body and receiving your answer. Anything else is a failure:

  • a 3xx answer (redirects are never followed, so register the final URL),
  • a 4xx or 5xx answer,
  • no complete answer within 10 seconds,
  • a DNS, connection or TLS failure,
  • a URL that no longer passes the address check (for example, your host name now resolves to a private address).

knownprint reads at most 64 KB of your answer's body and discards it. Answer with an empty body and 200 or 204.

The schedule. A delivery gets eight attempts. Each retry is timed from the first attempt, not from the one before:

AttemptEarliest time after the first attempt
1Immediately
21 minute
35 minutes
430 minutes
52 hours
612 hours
724 hours
872 hours

After the eighth failure the delivery is failed with dead set to true, and knownprint stops trying. You can still send it again with a replay.

A failed attempt is recorded with the HTTP status (last_response_code, 0 when there was no answer) and a class of failure (last_error):

last_errorMeaning
http_statusYour endpoint answered with a status other than 2xx, a redirect included
timeoutThe attempt did not finish within 10 seconds
connectThe connection failed or was dropped
tlsThe TLS handshake or the certificate check failed
dnsYour host name did not resolve
url_rejectedThe URL failed the address check at the attempt

last_error is null after a successful attempt.

The deliveries log

Every delivery to a webhook is listed, newest first, by GET /v1/webhooks/{id}/deliveries. Each entry shows the delivery's state, not its body:

JSON
{
  "data": [
    {
      "id": "dl_v7k75veqcqpzq4kzfy4w6cc7zu",
      "webhook_id": "wh_amg7qtxufogaunw7qawsqrgoxb",
      "event_type": "event.identified",
      "status": "pending",
      "attempts": 3,
      "created_at": "2026-12-02T12:00:00.000Z",
      "first_attempt_at": "2026-12-02T12:00:00.412Z",
      "last_attempt_at": "2026-12-02T12:05:00.902Z",
      "next_attempt_at": "2026-12-02T12:30:00.412Z",
      "last_response_code": 503,
      "last_error": "http_status",
      "dead": false
    }
  ],
  "next_cursor": null
}

status is pending while attempts remain, delivered after a 2xx, and failed once the last attempt has failed. The Webhooks API describes every field.

Finished deliveries (delivered or failed) stay in the log for 30 days after their last attempt. A delivery that is still waiting, for example for a disabled webhook, is removed 30 days after it was last attempted or last due, whichever is later. After that, it can no longer be listed or replayed.

Replay a delivery

POST /v1/deliveries/{id}/replay sends a finished delivery again: one that was delivered or failed. The delivery returns to pending with its attempt count at zero and a fresh schedule of eight attempts (one for a test delivery), starting at once.

A replay sends the stored body unchanged, with the same delivery id and therefore the same webhook-id. It goes to the webhook's current URL in its current format, signed with its secret. A delivery that is still pending cannot be replayed (422 validation_failed, detail delivery_pending): it is already being tried.

Use replay after an outage on your side: list the webhook's deliveries, pick those with status failed, and replay them once your endpoint is healthy again.

Shell
curl "$KNOWNPRINT_API/v1/webhooks/$WEBHOOK_ID/deliveries?limit=500" \
  -H "Authorization: Bearer $KNOWNPRINT_SECRET_KEY" \
| jq -r '.data[] | select(.status == "failed") | .id' \
| while read -r id; do
    curl -s -X POST "$KNOWNPRINT_API/v1/deliveries/$id/replay" \
      -H "Authorization: Bearer $KNOWNPRINT_SECRET_KEY" \
      -H "Idempotency-Key: replay-$id-$(date +%Y%m%d)" > /dev/null
  done

For more than 500 deliveries, follow next_cursor as described in Pagination.

Test deliveries

POST /v1/webhooks/{id}/test queues a webhook.test delivery to that webhook, whatever event types it subscribes to. The answer is the new delivery, pending, and the attempt follows within seconds.

A test delivery gets one attempt and no retries: if it fails, it is failed and dead at once, so you see the result straight away in the deliveries log, with the status your endpoint answered and the class of failure. It is signed like any other delivery, so it is the right way to check your signature verification end to end. You can replay it like any other finished delivery.

A test sent to a disabled webhook waits, pending, until the webhook is enabled again.

Change, pause or delete a webhook

With PATCH /v1/webhooks/{id} you can change the URL, the event types, the format, or switch the webhook off and on:

  • Event types. The new list replaces the old one. It applies to changes recorded after the update, everywhere within a few seconds.
  • URL and format. They apply to every attempt from then on, including the retries of deliveries already queued. A new URL is checked like a new webhook's.
  • enabled: false. Pauses the webhook. No new deliveries are queued for it while it is disabled: changes that happen in that time are not delivered later. Deliveries already queued wait and resume when you enable it again, as long as they are still within the log's 30 days.

DELETE /v1/webhooks/{id} removes the webhook together with all of its deliveries, queued and logged. It cannot be undone.

The signing secret never changes. To replace it, see Rotate the secret.

Discord format

A webhook created with "format": "discord" sends a Discord message instead of the envelope, so you can point it at a Discord channel's webhook URL and watch activity in a channel:

Shell
curl "$KNOWNPRINT_API/v1/webhooks" \
  -H "Authorization: Bearer $KNOWNPRINT_SECRET_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "url": "https://discord.com/api/webhooks/000000000000000000/xxxxxxxxxxxxxxxx",
    "event_types": ["visitor.merged", "account.related_found"],
    "format": "discord"
  }'

Each delivery is one embed titled knownprint: and the event type. It holds the visitor id; for event.identified, the match type, confidence and lookalike count; for visitor.merged, visitor.unmerged, visitor.split and visitor.suggested, the other visitor id, and the reason for all but visitor.suggested. It never carries a linked id, your tags, an IP address or any other value from the event, so it is safe for a shared channel. Retries, the deliveries log, replay and test deliveries work the same way, and the signature headers are still sent.

A Discord-format webhook is for people to read. For code that acts on events, use the standard format.

Ordering and duplicates

Delivery is at least once and in no guaranteed order. Design your endpoint for both:

  • Duplicates. If your endpoint does the work but its answer is lost or late, the attempt counts as failed and is retried. A replay also sends a delivery again. Every copy carries the same webhook-id. Record each webhook-id you have processed and skip one you have seen; record it only after the work succeeded, so a failed attempt is processed again. Keep the ids for at least the 72 hours of the retry schedule, and for 30 days if you replay deliveries.
  • One event, several webhooks. Each webhook gets its own delivery with its own id. If two of your webhooks lead to the same handler, deduplicate on the content instead, such as data.request_id for event.identified.
  • Order. Retries, and attempts made in parallel, mean a later change can arrive before an earlier one: a visitor.merged before the event.identified that preceded it, for example. Use the envelope's created_at to order changes, and make each handler correct on its own: write upserts keyed on the ids in data, not increments.
  • Current state. A delivery describes one change at one moment. When you act on a visitor, resolve it with GET /v1/visitors/{visitor_id}, which always answers the visitor that holds the id now, merges included.
handler.js
// After verifying the signature (see /webhooks/verify):
export async function handleDelivery(envelope, db) {
  if (await db.processedWebhookIds.has(envelope.id)) return; // a duplicate: already done

  switch (envelope.type) {
    case 'event.identified':
      await db.events.upsert(envelope.data.request_id, envelope.data);
      break;
    case 'account.related_found':
      await db.reviews.open({
        linkedId: envelope.data.linked_id,
        visitorId: envelope.data.visitor_id,
        visitors: envelope.data.visitors,
        linkedIds: envelope.data.linked_ids,
      });
      break;
    case 'visitor.merged':
      await db.visitorAliases.upsert(envelope.data.alias_id, envelope.data.canonical_id);
      break;
    case 'visitor.deleted':
      await db.visitorData.deleteFor(envelope.data.visitor_id);
      break;
    default:
      break; // a type this handler does not use
  }

  await db.processedWebhookIds.add(envelope.id, { ttlDays: 30 });
}

Privacy and retention

A standard delivery carries personal data: an event.identified delivery is the whole event, including the visitor's IP address, your linked id and your tags. Serve your endpoint over HTTPS only (knownprint will not deliver to anything else), keep what you store from deliveries under the same rules as your other personal data, and delete it when you delete the visitor.

knownprint keeps a delivery, body included, for 30 days after its last attempt (see The deliveries log). When a visitor is deleted, every delivery that names it, as the envelope's visitor or as the other visitor of a merge, unmerge, split or suggestion, is deleted in the same step, queued ones included, so it is never sent afterwards. The only delivery that names it from then on is the visitor.deleted delivery itself. When you delete a linked id, every delivery whose data names that linked id is deleted too. Privacy covers deletion and retention across knownprint.

  • Verify a webhook: the signature algorithm and receivers in Node, Python and Go.
  • Webhooks API: every route, parameter, answer and error.
  • Visitors: visitor ids, aliases and merges.
  • Accounts: linked ids and related accounts.
  • Limits: rate limits for the API routes that manage webhooks.