knownprintDocs

Results

Visitor ids over time

What a visitor id is, how to store and resolve it, how merges, unmerges, splits and suggestions change it, and how visitors are deleted or expire.

Every event names a visitor: one browser on one device, as far as knownprint can tell. The visitor id lets you recognise that browser on its next visit, across signups, logins and checkouts, even when it is not logged in.

What knownprint can tell about a browser grows over time. A browser that lost its stored data and came back may later be found to be a visitor it was already given; two browsers taken for one device may later be found to be two. This page explains what a visitor id promises, how it can change, and how to keep the ids you store correct.

What a visitor id is

A visitor id is v_ followed by 26 characters of a to z and 2 to 7, for example v_7oyg7p53qyj3onrfpnfynw72ud. It belongs to one environment: the same browser gets different ids in your test and live environments, and a secret key of one environment cannot read the visitors of another.

A visitor id is about the browser, not the person:

  • Two browsers on one computer, or a laptop and a phone, are two visitors. To connect them, send your own account id as a linked id.
  • Several people sharing one browser are one visitor.

knownprint keeps two promises about an id it gave you:

  • It never renumbers it. An id you stored keeps answering until its visitor is deleted or expires.
  • It changes which visitor answers for an id only in four announced ways: a merge, an unmerge, a split and a suggestion (which changes nothing but adds a lead). Each comes with a webhook.

Store the id, resolve it when you act

Store the visitor id beside your own records: the account, the order, the payment, the ban. When you act on a stored id later, resolve it first, because a merge may have made it an alias of another visitor since:

Resolve a stored visitor id
curl "$KNOWNPRINT_API/v1/visitors/v_zdio5fo75mfkslrcz2xhl5t6ro" \
  -H "Authorization: Bearer $KNOWNPRINT_SECRET_KEY"

The answer is the visitor that holds the id now. Compare its visitor_id with the id you stored: when they differ, the stored id is an alias, and the answer's visitor_id is the visitor to use.

resolve.mjs
export async function currentVisitorId(storedId) {
  const res = await fetch(`${process.env.KNOWNPRINT_API}/v1/visitors/${storedId}`, {
    headers: { Authorization: `Bearer ${process.env.KNOWNPRINT_SECRET_KEY}` },
  });
  if (res.status === 404) return null; // deleted, expired, or never in this environment
  if (!res.ok) throw new Error(`knownprint answered ${res.status}`);
  const visitor = await res.json();
  return visitor.visitor_id; // differs from storedId when storedId was merged into it
}

Read a visitor

GET /v1/visitors/{visitor_id} needs a secret key with the events:read scope. The full reference is in the Visitors API.

GET /v1/visitors/v_zdio5fo75mfkslrcz2xhl5t6ro
{
  "visitor_id": "v_c6hgpj3u5l4q7txx4plbw6uvgy",
  "canonical_id": "v_c6hgpj3u5l4q7txx4plbw6uvgy",
  "aliases": ["v_zdio5fo75mfkslrcz2xhl5t6ro", "v_pcdhe7l6ccd3zo3xlea735udds"],
  "first_seen_at": "2026-09-14T18:02:47.530Z",
  "last_seen_at": "2026-11-05T09:30:12.204Z",
  "event_count": 31,
  "linked_ids": ["account-1842"],
  "labels": [],
  "device_cluster_id": null,
  "cluster_confidence": null,
  "recent_events": []
}

Here the id asked for, v_zdio5fo75mfkslrcz2xhl5t6ro, was merged into v_c6hgpj3u5l4q7txx4plbw6uvgy, so the answer is that visitor and lists the asked id among its aliases. (recent_events is empty here to keep the example short.)

FieldTypeMeaning
visitor_idstringThe visitor that holds the id you asked for.
canonical_idstringThe same id as visitor_id.
aliasesarray of stringsEvery id merged into this visitor, oldest merge first. Empty when there was no merge.
first_seen_atstringWhen the visitor was first seen, RFC 3339 in UTC.
last_seen_atstringWhen it was last seen.
event_countintegerHow many events the visitor has had.
linked_idsarray of stringsThe distinct linked ids on the visitor's events, in code point order, at most 100. See Accounts and linked ids.
labelsarray of stringsLabels knownprint keeps on the visitor, such as high_activity while it is among the most active of the day.
device_cluster_idstring, nullableThe device cluster of the visitor's newest event. See Device clusters.
cluster_confidencestring, nullablelow or medium beside a cluster, else null.
recent_eventsarrayThe visitor's 20 newest events, newest first, each an event object.

recent_events and linked_ids come from the events answered under the visitor's own id. To read every event of the visitor, including those answered under its aliases before a merge, search by any of its ids: GET /v1/events?visitor_id=v_... covers the visitor and all its aliases. Events are kept for a shorter time than visitors, so a visitor that has not been seen for a while can have an empty recent_events.

StatusWhen
200The visitor.
404 not_foundThe id is malformed, belongs to another environment, was never given, or its visitor was deleted or expired.
409 deletion_pendingA deletion of the visitor is under way.

How a visitor id can change

Each change below is announced by a webhook. Subscribe to the types you need when you register a webhook, and verify each delivery as Verify webhooks shows. The envelope's visitor_id names the visitor the change is about; data carries the details.

ChangeWebhookWhat happens to idsCan it be undone
Mergevisitor.mergedThe older visitor survives; the other id becomes its alias.Usually, at your request; never when reason is two_tokens.
Unmergevisitor.unmergedThe alias becomes its own visitor again.No. The two are kept apart from then on.
Splitvisitor.splitPart of a visitor moves to a new visitor id.No.
Suggestionvisitor.suggestedNothing. A lead is added.Not needed.

Merges

A merge says two visitors are one device. The visitor seen first survives as the canonical visitor; the other id becomes its alias. From then on:

  • every new identification of that browser answers the surviving id;
  • reading the alias with GET /v1/visitors/{visitor_id} answers the surviving visitor;
  • searching events by either id finds the events of both;
  • events recorded before the merge keep the id they were answered with.
visitor.merged
{
  "v": 1,
  "id": "dl_ucgju2mclzqqedwbnh3364i6xe",
  "type": "visitor.merged",
  "created_at": "2026-11-29T10:15:04.512Z",
  "environment_id": "env_6azbyps66dpofnac2te6lrp43o",
  "visitor_id": "v_dtyxejwertdiuspqynad5cuhb6",
  "data": {
    "alias_id": "v_oyoicv7hpdkkanpub4ccn3fkes",
    "canonical_id": "v_dtyxejwertdiuspqynad5cuhb6",
    "reason": "relink",
    "linker_version": "v5.1",
    "posterior": 0.9931,
    "probability": 0.9874
  }
}
Field of dataMeaning
alias_idThe id merged away, an alias of the canonical visitor from now on.
canonical_idThe surviving visitor, the envelope's visitor_id.
reasontwo_tokens, reevaluation, chain or relink. Informational; do not build rules on it. relink comes from a re-review of past visitors.
linker_versionAn opaque version string, for knownprint's own use; do not build rules on it.
probabilityHow likely the two visitors are one device, from 0 to 1; null where none was given.
posteriorFor knownprint's own use; do not build rules on it. Read probability.

A merge with reason two_tokens is final. Any other merge can be undone at your request (ask your knownprint contact), for example when your own records show the two visitors are different people on different devices. An unmerge is refused while a deletion of either visitor is under way, after either was deleted, and while the surviving visitor has itself been merged into a third one since (that later merge is undone first).

Unmerges

An unmerge 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.

Field of dataMeaning
visitor_idThe restored visitor, the former alias. The envelope's visitor_id is the same.
canonical_idThe visitor it had been merged into.
reasonoperator: the merge was undone on request.
linker_versionAn opaque version string, for knownprint's own use.
moved_eventsHow many events moved back to the restored visitor.

Splits

A split moves part of a visitor to a new visitor id, when that part turns out to be another device. The moved part takes its events with it, and the two are kept apart from then on. A split is not undone.

Field of dataMeaning
visitor_idThe new visitor. The envelope's visitor_id is the same.
parent_idThe visitor it was split from.
reasonaudit, fleet or operator; operator means the split was made on request. Informational; do not build rules on it.
linker_versionAn opaque version string, for knownprint's own use.
moved_eventsHow many events now name the new visitor.

Suggestions

A suggestion changes no id. It says that a past visitor may also be another visitor, with how likely that is, and leaves the decision to you.

Field of dataMeaning
visitor_idThe past visitor the suggestion is about. The envelope's visitor_id is the same.
suggested_idThe visitor it may also be.
probabilityHow likely the two are one device, from 0 to 1.
posteriorFor knownprint's own use; do not build rules on it. Read probability.
reasonrelink.
linker_versionAn opaque version string, for knownprint's own use.

Treat a suggestion as a lead, like high_recall_id: worth a look when the suggested visitor is one you banned or flagged, not proof on its own.

Re-reviews of past visitors

knownprint's identification improves over time, and an improvement changes answers from then on. Visitors made by an earlier version stay as that version made them, unless knownprint reviews past visitors with a newer version. Such a review reaches your ids only through the announced changes above, under a policy set for each environment:

PolicyWhat a review may do
suggestSend a suggestion where a past visitor is likely another visitor, and change no id. The default, and the recommended policy where you store visitor ids as evidence, for example with payments.
mergeMerge where a past visitor is likely another visitor.
offNothing.

Only a review that finds two visitors likely to be one device acts, under either policy. To change the policy of an environment, ask your knownprint contact.

Keep your stored ids in step

Subscribe to visitor.merged, visitor.unmerged and visitor.split, and to visitor.suggested if you want the leads. Then:

  • On a merge, the alias's records belong to the surviving visitor. Point them at canonical_id, or keep both ids and resolve on read.
  • On an unmerge or a split, re-read the events of the visitor the envelope names with GET /v1/events?visitor_id=<id> and move your records that follow those events.
  • On a suggestion, queue a review if either visitor matters to you.
webhook-handler.mjs
// `envelope` is the verified webhook body; see /webhooks/verify.
export async function onVisitorChange(envelope, db) {
  const d = envelope.data;
  switch (envelope.type) {
    case 'visitor.merged':
      await db.query('update accounts set visitor_id = $1 where visitor_id = $2', [
        d.canonical_id,
        d.alias_id,
      ]);
      break;
    case 'visitor.unmerged':
    case 'visitor.split':
      await db.query('insert into visitor_review (visitor_id, reason) values ($1, $2)', [
        envelope.visitor_id,
        envelope.type,
      ]);
      break;
    case 'visitor.suggested':
      await db.query(
        'insert into visitor_leads (visitor_id, suggested_id, probability) values ($1, $2, $3)',
        [d.visitor_id, d.suggested_id, d.probability],
      );
      break;
  }
}

A delivery that fails is retried for up to 72 hours after its first attempt, then stops; you can replay it later (see Delivery and retries). The visitor read is the record: when in doubt, resolve the id with GET /v1/visitors/{visitor_id}.

Leads: high recall id

When knownprint does not give a browser an earlier visitor's id, it may still name the earlier visitor the browser most likely is. The event then carries:

  • high_recall_id: that earlier visitor's id;
  • high_recall_probability: how likely it is, from 0 to 1, where a probability was given.

The event's own visitor_id is a new or different visitor; the lead does not change it. Use the lead to widen a check rather than to decide on its own, for example:

ban-check.mjs
const banned = await isBanned(event.visitor_id);
const lead = event.high_recall_id !== null && (await isBanned(event.high_recall_id));
if (banned) return 'block';
if (lead && (event.high_recall_probability ?? 0) >= 0.5) return 'review';
return 'allow';

The threshold is yours to choose: a lower one sends more visitors to review, a higher one fewer. Ban evasion works through a full example.

Device clusters

A device cluster groups visitors that are different browsers on what looks like one physical device. Events and visitors carry device_cluster_id (c_ and 26 characters) and cluster_confidence (low or medium) for it, and GET /v1/events accepts a cluster_id filter.

Delete a visitor

Delete a visitor when a person asks you to erase their data, or when your own retention rules require it. You need a secret key with the visitors:delete scope.

Delete a visitor
curl -X DELETE "$KNOWNPRINT_API/v1/visitors/v_7oyg7p53qyj3onrfpnfynw72ud" \
  -H "Authorization: Bearer $KNOWNPRINT_SECRET_KEY" \
  -H "Idempotency-Key: erase-request-5521"
202 Accepted
{
  "job_id": "del_3k2v6yq7wz4b5n2xq7r5s3t4ua",
  "status": "queued"
}

What to know:

  • The answer is 202 with the deletion job whether or not the visitor exists, so the answer reveals nothing about the id. A malformed id is 422 validation_failed; a key over the deletion rate limit gets 429 rate_limited.
  • Deleting any id of a merged visitor deletes the whole visitor: the surviving visitor and every alias merged into it.
  • The deletion removes the visitor's events, its feedback, its linked id associations, the webhook deliveries that name it and its stored identifiers. A later visit from the same browser is answered as a new visitor.
  • While the job is open, reads of the visitor and its events answer 409 deletion_pending. Afterwards they answer 404.
  • When the job completes, knownprint sends the visitor.deleted webhook with data holding visitor_id (the visitor deleted: the surviving id when you named an alias) and job_id.
  • Asking again while a job is open answers the same job; status is queued or running. With the same Idempotency-Key, a repeat within 24 hours replays the first answer.
  • Deletions are rate limited to 2 a second per key; see Limits.

To erase everything tied to one of your accounts rather than one browser, delete by linked id; see Delete a linked id. Privacy covers deletion requests in full.

Inactivity expiry

A visitor that is not seen for 400 days expires. Each identification of the visitor starts the 400 days again. An expired visitor is removed with its events, and its id then answers 404. No webhook announces an expiry. If you keep visitor ids for longer than 400 days of inactivity, expect them to stop resolving.