---

title: Visitors API
description: Read a visitor and its recent events, list the visitors and accounts related to it, and delete it, with every field, response and error.
---

A visitor is one browser that knownprint recognises across visits, named by a visitor id (`v_...`). Every event carries the visitor id it was answered with. These routes read a visitor, show what is related to it and delete it.

| Method and path                                                                       | Scope             | Idempotency-Key |
| ------------------------------------------------------------------------------------- | ----------------- | --------------- |
| [`GET /v1/visitors/{visitor_id}`](#get-v1-visitors-visitor-id)                        | `events:read`     | No              |
| [`GET /v1/visitors/{visitor_id}/related`](#get-v1-visitors-visitor-id-related)        | `events:read`     | No              |
| [`DELETE /v1/visitors/{visitor_id}`](#delete-v1-visitors-visitor-id)                  | `visitors:delete` | Yes             |
| [`GET /v1/visitors/{visitor_id}/export`](#get-v1-visitors-visitor-id-export) (coming) | `events:read`     | No              |

Every route takes a secret key in `Authorization: Bearer` and works inside that key's environment; see [Authentication](/api#authentication). What a visitor is, and how to use visitor ids in your decisions, is on [Visitor ids over time](/visitors).

## Visitor ids that merge

A visitor id never changes its spelling and is never reused, but which visitor answers for it can change:

- **Merge.** When knownprint learns that two visitor ids are the same browser, the older id survives and the other becomes its alias. Reads of the alias answer the surviving visitor. The `visitor.merged` webhook announces it.
- **Unmerge.** A merge can be undone; the alias becomes its own visitor again (`visitor.unmerged`).
- **Split.** Events of one visitor can move to a new visitor id (`visitor.split`).
- **Suggestion.** knownprint can suggest that two visitors may be the same without changing either id (`visitor.suggested`).

An event keeps the visitor id it was answered with, unless an unmerge or a split moves it. So store the visitor id you got, and resolve it through [`GET /v1/visitors/{visitor_id}`](#get-v1-visitors-visitor-id) when you need the current picture, or follow the webhooks. See [Webhooks](/webhooks).

## GET /v1/visitors/{visitor_id}

Reads the visitor that holds the id now, with its 20 most recent events.

```bash
curl "$KNOWNPRINT_API/v1/visitors/v_c6hgpj3u5l4q7txx4plbw6uvgy" \
  -H "Authorization: Bearer $KNOWNPRINT_SECRET_KEY"
```

```js title="node"
async function getVisitor(visitorId) {
  const res = await fetch(
    `${process.env.KNOWNPRINT_API}/v1/visitors/${encodeURIComponent(visitorId)}`,
    { headers: { Authorization: `Bearer ${process.env.KNOWNPRINT_SECRET_KEY}` } },
  );
  if (res.status === 404) return null;
  if (!res.ok) throw new Error(`knownprint answered ${res.status}`); // 409 included
  return res.json();
}

const visitor = await getVisitor(storedVisitorId);
if (visitor && visitor.visitor_id !== storedVisitorId) {
  // The stored id was merged into another visitor: update your record.
  await saveVisitorId(accountId, visitor.visitor_id);
}
```

### Path parameters

| Parameter    | Type                   | Meaning                                                |
| ------------ | ---------------------- | ------------------------------------------------------ |
| `visitor_id` | `v_` and 26 characters | Any id of the visitor, including an alias from a merge |

### Response

`200` with the visitor:

```json
{
  "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": []
}
```

| Field                | Type                      | Meaning                                                                                                                                                                                                                                                                               |
| -------------------- | ------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `visitor_id`         | `v_` id                   | The visitor's own id. When you asked for an alias, this is the surviving visitor's id, not the one you sent.                                                                                                                                                                          |
| `canonical_id`       | `v_` id                   | The same as `visitor_id`.                                                                                                                                                                                                                                                             |
| `aliases`            | Array of `v_` ids         | Every id merged into this visitor, oldest merge first. Empty when none.                                                                                                                                                                                                               |
| `first_seen_at`      | RFC 3339 time             | The visitor's first visit.                                                                                                                                                                                                                                                            |
| `last_seen_at`       | RFC 3339 time             | The visitor's latest visit.                                                                                                                                                                                                                                                           |
| `event_count`        | Integer                   | How many events the visitor has had.                                                                                                                                                                                                                                                  |
| `linked_ids`         | Array of strings          | The distinct linked ids on the visitor's events, at most 100, in code point order.                                                                                                                                                                                                    |
| `labels`             | Array of strings          | Labels knownprint sets on the visitor, such as `high_activity` while it is among your most active visitors of the day. See [Activity signals](/signals/activity).                                                                                                                     |
| `device_cluster_id`  | `c_` id or `null`         | The device cluster of the visitor's newest event: a group of visitors that appear to share one device, such as two browsers on one computer. It is a grouping, never an identity of its own. Device clusters are coming: `null` today ([Device clusters](/visitors#device-clusters)). |
| `cluster_confidence` | `low`, `medium` or `null` | How strongly the cluster is supported. `medium` is the highest. `null` today.                                                                                                                                                                                                         |
| `recent_events`      | Array of events           | The visitor's 20 newest events, newest first, each a full [event object](/api/events#the-event-object).                                                                                                                                                                               |

A visitor with no activity for 400 days expires and is deleted, after which its id answers `404`.

### Errors

| Status | Type                                               | When                                                                                       |
| ------ | -------------------------------------------------- | ------------------------------------------------------------------------------------------ |
| `401`  | [`unauthorized`](/api/errors#unauthorized)         | No valid secret key                                                                        |
| `403`  | [`forbidden_scope`](/api/errors#forbidden-scope)   | The key lacks `events:read`                                                                |
| `404`  | [`not_found`](/api/errors#not-found)               | The id is malformed, belongs to another environment, never existed, expired or was deleted |
| `409`  | [`deletion_pending`](/api/errors#deletion-pending) | A deletion of this visitor is in progress                                                  |
| `429`  | [`rate_limited`](/api/errors#rate-limited)         | The key's bucket is empty                                                                  |

## GET /v1/visitors/{visitor_id}/related

Lists the other visitors and the linked ids related to a visitor, each with the evidence that relates it. It is a moderator's aid: it answers "what else is connected to this browser?" when you review an account, a ban appeal or a payment dispute. It never changes an id or an event, and it is not an identification: two related visitors are not the same visitor.

```bash
curl "$KNOWNPRINT_API/v1/visitors/v_c6hgpj3u5l4q7txx4plbw6uvgy/related" \
  -H "Authorization: Bearer $KNOWNPRINT_SECRET_KEY"
```

The visitor id resolves first, as in the read above, so an alias answers for its surviving visitor.

### Response

`200` with two lists:

```json
{
  "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_c6hgpj3u5l4q7txx4plbw6uvgy", "weight": 1 }]
    }
  ]
}
```

| Field                    | Type              | Meaning                                                                      |
| ------------------------ | ----------------- | ---------------------------------------------------------------------------- |
| `visitors`               | Array, at most 50 | Other visitors related to this one, strongest first                          |
| `visitors[].visitor_id`  | `v_` id           | The related visitor                                                          |
| `visitors[].evidence`    | Array, at most 50 | What relates it                                                              |
| `linked_ids`             | Array, at most 50 | The linked ids this visitor carries; each item's evidence names this visitor |
| `linked_ids[].linked_id` | String            | The related linked id                                                        |
| `linked_ids[].evidence`  | Array, at most 50 | What relates it                                                              |

Each evidence item has three members:

| Member   | Type   | Meaning                                                                                                                                                                                                                                                                 |
| -------- | ------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `kind`   | String | What kind of connection it is. `linked_id`: a shared account of yours (on a linked id entry, the visitor that carries it). `cluster`: a shared device cluster. The other kinds (`shared_network`, `ip_day`, `exact`) are network or similarity evidence for a reviewer. |
| `detail` | String | A short human-readable description for a moderator, such as the shared linked id or the cluster id and its confidence.                                                                                                                                                  |
| `weight` | Number | Orders the entries, strongest first, then by id. For knownprint's own use; do not build rules on it.                                                                                                                                                                    |

Show `kind` and `detail` to a reviewer as they are; do not parse `detail`, whose wording may change, and do not act automatically on a relation alone. [Accounts and linked ids](/accounts) explains how to use related accounts in a review.

### Errors

| Status | Type                                               | When                                                        |
| ------ | -------------------------------------------------- | ----------------------------------------------------------- |
| `401`  | [`unauthorized`](/api/errors#unauthorized)         | No valid secret key                                         |
| `403`  | [`forbidden_scope`](/api/errors#forbidden-scope)   | The key lacks `events:read`                                 |
| `404`  | [`not_found`](/api/errors#not-found)               | The id is malformed or names no visitor of this environment |
| `409`  | [`deletion_pending`](/api/errors#deletion-pending) | A deletion of this visitor is in progress                   |
| `429`  | [`rate_limited`](/api/errors#rate-limited)         | The key's bucket is empty                                   |

## DELETE /v1/visitors/{visitor_id}

Deletes a visitor and everything stored about it. Use it to honour a person's erasure request, or when you close an account and want its browser data gone.

```bash
curl -X DELETE "$KNOWNPRINT_API/v1/visitors/v_c6hgpj3u5l4q7txx4plbw6uvgy" \
  -H "Authorization: Bearer $KNOWNPRINT_SECRET_KEY" \
  -H "Idempotency-Key: erase-request-20981"
```

### Response

`202` with the deletion job:

```json
{
  "job_id": "del_7xq4bqv2m3rd5kz6h2l4wz7nya",
  "status": "queued"
}
```

| Field    | Type                  | Meaning                                                  |
| -------- | --------------------- | -------------------------------------------------------- |
| `job_id` | `del_` id             | The deletion job. Keep it as your record of the request. |
| `status` | `queued` or `running` | The job's state when you asked.                          |

The answer is the same whether or not the visitor exists, so it never confirms that a person visited your site. Asking again while the job is open returns the same job.

### What happens

1. The job is accepted at once. From that moment, reads of the visitor answer `409` [`deletion_pending`](/api/errors#deletion-pending), and searches leave its events out.
2. A background worker deletes the visitor, every visitor merged into it, their events and the browser data stored for them, their feedback, their ties to linked ids and the webhook deliveries that name them. A failed attempt is retried.
3. When the purge commits, the `visitor.deleted` webhook fires with the `visitor_id` and the `job_id`. When you named an id that had merged into another visitor, `visitor_id` is the surviving visitor's id.
4. Afterwards the visitor's ids answer `404`. knownprint keeps only one-way hashes of the deleted ids, for 30 days, so that the deleted visitor does not come back.

Deleting any id of a merged visitor deletes the surviving visitor together with every id merged into it.

To delete by your own account id instead of a visitor id, use [`DELETE /v1/linked/{linked_id}`](/api/linked#delete-v1-linked-linked-id). [Privacy for integrators](/privacy) covers deletion, retention and data subject requests in full.

### Rate limit

Deletions are limited to 2 a second per key, burst 2, on top of the key's general bucket. A batch of erasures should be paced at that rate; a `429` carries `Retry-After`.

### Errors

| Status | Type                                                       | When                                                                          |
| ------ | ---------------------------------------------------------- | ----------------------------------------------------------------------------- |
| `401`  | [`unauthorized`](/api/errors#unauthorized)                 | No valid secret key                                                           |
| `403`  | [`forbidden_scope`](/api/errors#forbidden-scope)           | The key lacks `visitors:delete`                                               |
| `409`  | [`idempotency_conflict`](/api/errors#idempotency-conflict) | The `Idempotency-Key` was used for another request, or is still in flight     |
| `422`  | [`validation_failed`](/api/errors#validation-failed)       | `invalid_subject` (the id is not `v_` and 26 characters) or `idempotency_key` |
| `429`  | [`rate_limited`](/api/errors#rate-limited)                 | The key's bucket or the deletion bucket is empty                              |

## GET /v1/visitors/{visitor_id}/export

:::note Coming
A machine-readable export of everything stored about one visitor, for data access requests, is planned and not served yet. Until it is, `GET /v1/visitors/{visitor_id}` and `GET /v1/events?visitor_id=...` together return the visitor and all of its events within retention.
:::

```bash
curl -G "$KNOWNPRINT_API/v1/events" \
  -H "Authorization: Bearer $KNOWNPRINT_SECRET_KEY" \
  --data-urlencode "visitor_id=v_c6hgpj3u5l4q7txx4plbw6uvgy" \
  --data-urlencode "limit=500"
```
