knownprintDocs

Results

Accounts and linked ids

Attach your own account ids to events, then ask which accounts a browser used and which browsers an account used.

A visitor id names a browser. Your business runs on accounts. A linked id connects the two: it is your own id for the account, the customer or the session, attached to an event. Once events carry linked ids, knownprint can answer two questions that matter for fraud:

  • Which accounts did this browser use? Many accounts on one browser points to multi-accounting, fake signups, promotion abuse or ban evasion.
  • Which browsers used this account? Many browsers on one account points to account sharing or account takeover.

What to send as a linked id

A linked id is any string of 1 to 128 characters without the U+0000 character. Send the same value every time for the same account, and send the id your own systems use to look the account up, for example your user id or customer number.

Do not send personal data such as an email address, a phone number or a name. A linked id is stored with the event and appears in webhooks and in related account answers; an opaque internal id gives you the same results without spreading personal data. If you must derive it from an email address, send a keyed hash of it that only your systems can recompute.

Send it at identification

When the page already knows the account, pass linkedId to the browser agent. Set it once when loading, or per identification:

checkout.js
// The agent, or null when the script is blocked or fails to load.
const agentReady = window.knownprint
  ? window.knownprint
      .load({ pk: 'pk_live_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx', linkedId: String(currentUser.id) })
      .catch(() => null)
  : Promise.resolve(null);

// Later, for one identification; this value wins over the one given to load().
async function checkoutRequestId() {
  const agent = await agentReady;
  if (agent === null) return null; // no request id: your backend treats the action as unknown
  try {
    const { requestId } = await agent.identify({
      linkedId: String(currentUser.id), // a string of 1 to 128 characters
      tags: { flow: 'checkout' },
    });
    return requestId;
  } catch {
    return null;
  }
}

Add the browser agent covers loading and the other options. linkedId must be a string, so convert a numeric id with String(). An empty string is treated as no linked id.

Set it later from your backend

Often the account id is known only on the server, for example right after signup or login. Set it on the event with PATCH /v1/events/{request_id} and a secret key that holds events:write:

curl
curl -X PATCH "$KNOWNPRINT_API/v1/events/$REQUEST_ID" \
  -H "Authorization: Bearer $KNOWNPRINT_SECRET_KEY" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: signup-$REQUEST_ID" \
  -d '{"linked_id": "account-1842"}'
Node
const res = await fetch(`${process.env.KNOWNPRINT_API}/v1/events/${requestId}`, {
  method: 'PATCH',
  headers: {
    Authorization: `Bearer ${process.env.KNOWNPRINT_SECRET_KEY}`,
    'Content-Type': 'application/json',
    'Idempotency-Key': `signup-${requestId}`,
  },
  body: JSON.stringify({ linked_id: String(account.id) }), // a string of 1 to 128 characters
});
if (!res.ok) throw new Error(`knownprint answered ${res.status}`);

The answer is the updated event. The rules:

  • A string sets the linked id, null clears it, and leaving linked_id out of the body keeps it.
  • Replacing or clearing a linked id also removes the old account from this visitor's related accounts, even if other events of the visitor still carry it, so a mistake you correct stops relating accounts. Setting the same value again on any event relates them again.
  • A malformed linked id is 422 validation_failed. An event of a visitor being deleted is 409 deletion_pending.

Use the server route for anything you would not trust the browser to say: a value set in the page can be changed by whoever controls the page.

knownprint records that a visitor carries a linked id the first time an event of that visitor arrives with it, from the browser or through PATCH. From then on the visitor and the account are related:

  • The relation lasts as long as the visitor. It outlives the event that created it, so it still counts after that event has passed its retention period.
  • When two visitors merge, the alias's accounts move to the surviving visitor (see Visitor ids over time).
  • It ends when you clear or replace that linked id on an event of the visitor with PATCH, when you delete the linked id or the visitor, or when the visitor expires.

Two webhooks announce new relations:

WebhookWhendata
account.linkedA visitor carries a linked id for the first time.visitor_id, linked_id
account.related_foundThat new relation gives the linked id more than one visitor, or the visitor more than one linked id.visitor_id, linked_id, visitors (how many visitors carry the linked id), linked_ids (how many linked ids the visitor carries)

account.related_found is the one to act on in real time: it fires whenever a new relation leaves an account with more than one browser, or a browser with more than one account. Webhooks explains how to subscribe.

Which accounts a browser used

Ask for the visitor's related accounts with GET /v1/visitors/{visitor_id}/related and the events:read scope:

Related accounts of a visitor
curl "$KNOWNPRINT_API/v1/visitors/v_vtxgbn7e5tysdblodbsldwnua3/related" \
  -H "Authorization: Bearer $KNOWNPRINT_SECRET_KEY"
200 OK
{
  "visitors": [
    {
      "visitor_id": "v_frg25tolohaauude7tlfu6pgfr",
      "evidence": [{ "kind": "linked_id", "detail": "account-1842", "weight": 1 }]
    }
  ],
  "linked_ids": [
    {
      "linked_id": "account-1842",
      "evidence": [{ "kind": "linked_id", "detail": "v_vtxgbn7e5tysdblodbsldwnua3", "weight": 1 }]
    },
    {
      "linked_id": "account-2077",
      "evidence": [{ "kind": "linked_id", "detail": "v_vtxgbn7e5tysdblodbsldwnua3", "weight": 1 }]
    }
  ]
}
  • linked_ids lists the accounts this visitor carries. Each has one linked_id evidence item whose detail is the visitor itself.
  • visitors lists other visitors related to this one, with the evidence that relates them.

A merge alias answers for the visitor it was merged into. The read answers 404 not_found for a malformed id or one that no visitor of your environment holds, and 409 deletion_pending while the visitor is being deleted.

Visitor ids over time shows another view: the visitor read lists the linked_ids found on its own events, which follow event retention.

Which browsers used an account

Ask for the account's related visitors with GET /v1/linked/{linked_id}/related. URL-encode the linked id in the path:

curl
curl "$KNOWNPRINT_API/v1/linked/account-1842/related" \
  -H "Authorization: Bearer $KNOWNPRINT_SECRET_KEY"
Node
const res = await fetch(
  `${process.env.KNOWNPRINT_API}/v1/linked/${encodeURIComponent(accountId)}/related`,
  { headers: { Authorization: `Bearer ${process.env.KNOWNPRINT_SECRET_KEY}` } },
);
let related;
if (res.status === 404)
  related = { visitors: [], linked_ids: [] }; // no visitor carries it
else if (!res.ok) throw new Error(`knownprint answered ${res.status}`);
else related = await res.json();
200 OK
{
  "visitors": [
    {
      "visitor_id": "v_frg25tolohaauude7tlfu6pgfr",
      "evidence": [{ "kind": "linked_id", "detail": "account-1842", "weight": 1 }]
    },
    {
      "visitor_id": "v_vtxgbn7e5tysdblodbsldwnua3",
      "evidence": [{ "kind": "linked_id", "detail": "account-1842", "weight": 1 }]
    }
  ],
  "linked_ids": [
    {
      "linked_id": "account-2077",
      "evidence": [{ "kind": "linked_id", "detail": "v_vtxgbn7e5tysdblodbsldwnua3", "weight": 1 }]
    }
  ]
}
  • visitors lists the browsers that carried the account, up to 50.
  • linked_ids lists the other accounts those browsers carried. Each evidence item's detail names a visitor that carries both accounts, the bridge between them.

The read answers 404 not_found when no visitor carries the linked id, and 422 validation_failed when the linked id is empty, longer than 128 characters or holds U+0000.

To see the events themselves rather than the visitors, search them: GET /v1/events?linked_id=account-1842 (Events API).

Both related reads answer the same shape. Each list holds at most 50 entries, strongest first, then by id. Each entry carries at most 50 evidence items. Each item's weight orders the list; it is for knownprint's own use, so do not build rules on it.

Evidence kindMeaningdetail
linked_idA shared account of yours: the two share an account you sent.The shared linked id, or the visitor that bridges two accounts.
shared_networkNetwork evidence for a reviewer.Descriptive text for a reviewer.
ip_dayNetwork evidence for a reviewer.Descriptive text for a reviewer.
exactSimilarity evidence for a reviewer.Descriptive text for a reviewer.
clusterThe two are in the same device cluster. Not assigned today; see Device clusters.The cluster and its confidence.

Show detail to a reviewer as it is and do not parse it: its wording may change.

The related reads are an aid for your analysts and your rules, not an identification: two related visitors are two browsers, and a shared network can be a household. Combine them with your own records before you act.

Patterns

Multi-accounting

One person opens many accounts to collect signup bonuses, evade limits or vote many times. Check at signup, after you have set the new account's linked id:

signup-check.mjs
async function relatedAccounts(visitorId) {
  const res = await fetch(`${process.env.KNOWNPRINT_API}/v1/visitors/${visitorId}/related`, {
    headers: { Authorization: `Bearer ${process.env.KNOWNPRINT_SECRET_KEY}` },
  });
  if (res.status === 404) return []; // no visitor of this environment holds the id
  if (!res.ok) throw new Error(`knownprint answered ${res.status}`);
  const body = await res.json();
  return body.linked_ids.map((entry) => entry.linked_id);
}

const accounts = await relatedAccounts(event.visitor_id);
const others = accounts.filter((id) => id !== String(newAccount.id));
if (others.length >= 3) await holdForReview(newAccount, { others });

Pick the threshold from your own traffic: a family computer may hold two or three real accounts. Add high_recall_id from the event to catch a browser that cleared its data before signing up again. Fake signups and Promo abuse work through complete flows.

Shared accounts

One subscription used by many people shows up as one linked id on many visitors. Count the browsers of an account:

sharing-check.mjs
const res = await fetch(
  `${process.env.KNOWNPRINT_API}/v1/linked/${encodeURIComponent(accountId)}/related`,
  { headers: { Authorization: `Bearer ${process.env.KNOWNPRINT_SECRET_KEY}` } },
);
if (res.status !== 404 && !res.ok) throw new Error(`knownprint answered ${res.status}`);
const { visitors } = res.status === 404 ? { visitors: [] } : await res.json();
if (visitors.length > 5) await flagForSharing(accountId, visitors.length);

People own several devices and browsers, so set the limit above what one household uses. To look at recent activity only, search the account's events with GET /v1/events?linked_id=...&start=... and count the distinct visitor_id values. Account sharing covers the whole flow.

Ban evasion and takeover

When you ban an account, store the visitor ids of its events. When a new account appears, check its visitor, the visitor's related accounts and the event's high_recall_id against your ban list. When a known account logs in from a browser it never used, account.related_found tells you at once; Account takeover and Ban evasion show how to combine it with the signals.

Delete a linked id

DELETE /v1/linked/{linked_id} erases an account from knownprint, for example when its owner asks you to delete their data. It needs a secret key with the visitors:delete scope:

Delete a linked id
curl -X DELETE "$KNOWNPRINT_API/v1/linked/account-1842" \
  -H "Authorization: Bearer $KNOWNPRINT_SECRET_KEY" \
  -H "Idempotency-Key: erase-account-1842"
202 Accepted
{
  "job_id": "del_r4tq6wz2hx7mnb3kv5ycp2se6a",
  "status": "queued"
}

The deletion runs in the background:

  • The linked id is cleared from every event that carried it, and its relations to visitors end.
  • Webhook deliveries that named it are deleted.
  • A visitor that carried the linked id and is left with no other linked id, on its events or in its relations, is deleted as a whole, as Delete a visitor describes. A visitor that also carries another account is kept, without this one.

The answer is 202 with the job whether or not the linked id exists, so it reveals nothing. A malformed linked id is 422 validation_failed. Deletions are rate limited to 2 a second per key (Limits). Privacy covers deletion requests in full.