---

title: Agent routes
description: The routes the knownprint browser agent calls through your proxy, what each is for and the status codes each answers, as a troubleshooting aid.
---

The knownprint agent is the script that runs on your pages. It talks to knownprint through a handful of routes under `/kp/` on your own domain, which your proxy forwards to the API. Your own code never calls these routes, and their bodies are not a public interface: they change with the agent, which knownprint keeps in step.

This page lists them so that you can recognise them in your proxy logs, your Content Security Policy and the browser's network panel, and tell what a status code means while you set up or troubleshoot. To install the agent and the proxy, follow [Run knownprint from your domain](/install/proxy) and [Add the browser agent](/install/browser).

## How a visit flows

1. Your page loads the loader, `GET /kp/agent.js`.
2. The loader fetches the agent bundle for its build, `GET /kp/a/{build}.js` (or `.s.js`).
3. The agent asks for a challenge, `POST /kp/c`, with your public key.
4. The agent sends its identification, `POST /kp/i`. The answer gives your page the request id.
5. Your page sends the request id to your backend, which reads the result with [`GET /v1/events/{request_id}`](/api/events#get-v1-events-request-id).
6. Afterwards the agent may call its follow-up routes, `POST /kp/l/{request_id}` and `POST /kp/b/{request_id}`, which can update the stored event.

Every step from 1 to 4 and step 6 goes through your proxy. Only step 5 uses your secret key.

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. Read the event when the visitor acts, not earlier.

## The routes

| Route on your domain      | Purpose                                                                                       |
| ------------------------- | --------------------------------------------------------------------------------------------- |
| `GET /kp/agent.js`        | The loader, a small script your page includes                                                 |
| `GET /kp/a/{build}.js`    | The full agent bundle of one build                                                            |
| `GET /kp/a/{build}.s.js`  | The smaller bundle of the `security` profile, for pages that load the agent with that profile |
| `POST /kp/c`              | Issues a short-lived challenge for one identification                                         |
| `POST /kp/i`              | Receives the identification and answers the request id                                        |
| `POST /kp/l/{request_id}` | A follow-up route of the agent                                                                |
| `POST /kp/b/{request_id}` | A follow-up route of the agent                                                                |

`{build}` is 12 lower case hexadecimal characters naming one agent release. `{request_id}` is the event's `evt_` id.

The API answers each route under a `/v1/` alias as well. The agent uses the `/kp/` paths on your own domain, so they stay first party; you do not need to forward or allow the aliases.

## Status codes

### Loader and bundles

| Status                                     | Meaning                                                                     | What to check                                           |
| ------------------------------------------ | --------------------------------------------------------------------------- | ------------------------------------------------------- |
| `200`                                      | The script, as `text/javascript; charset=utf-8`                             |                                                         |
| `404` [`not_found`](/api/errors#not-found) | No such file: a mistyped path, or a bundle name that is not a current build | That your proxy forwards `/kp/` with the path unchanged |

### Challenge: `POST /kp/c`

| Status | Type                                                   | Meaning                                                                                                                                                                           |
| ------ | ------------------------------------------------------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `200`  |                                                        | The challenge, valid for a short time                                                                                                                                             |
| `400`  | [`schema_mismatch`](/api/errors#schema-mismatch)       | The body is not what the agent sends                                                                                                                                              |
| `400`  | [`build_inactive`](/api/errors#build-inactive)         | The page runs an agent build that is no longer served                                                                                                                             |
| `401`  | [`unauthorized`](/api/errors#unauthorized)             | The public key is unknown or revoked                                                                                                                                              |
| `403`  | [`ip_not_allowed`](/api/errors#ip-not-allowed)         | No client address could be told for the request, or the address is outside the key's allowed ranges (often your server's own address, when the proxy sends no valid proxy secret) |
| `403`  | [`origin_not_allowed`](/api/errors#origin-not-allowed) | The page's origin is not in the key's allowed origins                                                                                                                             |
| `413`  | [`payload_too_large`](/api/errors#payload-too-large)   | The body is over 2 KB                                                                                                                                                             |
| `429`  | [`rate_limited`](/api/errors#rate-limited)             | Too many challenges from this address, or the public key's bucket is empty                                                                                                        |

### Identify: `POST /kp/i`

| Status | Type                                                   | Meaning                                                                                                                   |
| ------ | ------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------- |
| `200`  |                                                        | Identified; the answer gives the page its request id                                                                      |
| `400`  | [`schema_mismatch`](/api/errors#schema-mismatch)       | The payload is not what the agent sends                                                                                   |
| `400`  | [`field_map_mismatch`](/api/errors#field-map-mismatch) | The payload does not belong with its challenge                                                                            |
| `400`  | [`build_inactive`](/api/errors#build-inactive)         | The agent build is no longer served                                                                                       |
| `401`  | [`invalid_token`](/api/errors#invalid-token)           | No valid challenge, or a public key other than the challenge's                                                            |
| `401`  | [`token_expired`](/api/errors#token-expired)           | The challenge has expired                                                                                                 |
| `403`  | [`ip_not_allowed`](/api/errors#ip-not-allowed)         | No client address, or an address outside the key's allowed ranges                                                         |
| `403`  | [`origin_not_allowed`](/api/errors#origin-not-allowed) | The origin is not allowed, or differs from the challenge's                                                                |
| `403`  | [`ip_prefix_mismatch`](/api/errors#ip-prefix-mismatch) | The visitor's address changed during the identification and the environment is set to refuse that (it is not by default)  |
| `409`  | [`nonce_reused`](/api/errors#nonce-reused)             | The challenge was already used: a replay or a retried `POST`                                                              |
| `413`  | [`payload_too_large`](/api/errors#payload-too-large)   | The body is over 64 KB                                                                                                    |
| `422`  | [`validation_failed`](/api/errors#validation-failed)   | Collection is blocked for this visitor by your consent setting, so nothing is stored                                      |
| `429`  | [`rate_limited`](/api/errors#rate-limited)             | Too many identifications from this address or this visitor, the public key's bucket is empty, or its daily cap is reached |

A refused identification is not stored and not billed.

### Follow-up routes: `POST /kp/l/{request_id}` and `POST /kp/b/{request_id}`

| Status | Type                                                   | Meaning      |
| ------ | ------------------------------------------------------ | ------------ |
| `204`  |                                                        | Recorded     |
| `410`  | [`late_window_closed`](/api/errors#late-window-closed) | Not recorded |

These two routes answer every failure with the same `410`, whatever its cause, so a stray `410` in your logs is expected and harmless. The event they belong to is valid without them. Their bodies are limited to 1 KB.

## Rate limits

Agent routes are limited per visitor address and per visitor, so that one browser or one network cannot use up your capacity.

| Bucket                             | Limit                              | Applies to                    |
| ---------------------------------- | ---------------------------------- | ----------------------------- |
| Challenges per client address      | 60 a minute                        | `POST /kp/c`                  |
| Identifications per client address | 30 a minute                        | `POST /kp/i`                  |
| Identifications per visitor        | 60 a minute                        | `POST /kp/i`                  |
| Public key                         | 50 a second, burst 150             | `POST /kp/c` and `POST /kp/i` |
| Public key daily cap               | The key's `daily_cap`, per UTC day | `POST /kp/i`                  |

An IPv6 client counts by its `/64` network. Address buckets are counted separately for each knownprint account, so another site's traffic never uses up yours. Agent answers carry `RateLimit` and `RateLimit-Policy` headers for the address bucket, never for your key, so a visitor cannot read your traffic from them. A `429` carries `Retry-After`. [Limits](/limits) has every limit in one place.

Because the per-address limits count real client addresses, your proxy must pass the visitor's address to knownprint, with its proxy secret, as the install guide shows. Without a valid proxy secret knownprint takes the address that connected to it, your server's, so all your visitors share one address bucket and a key with allowed IP ranges refuses them with `ip_not_allowed` ([The visitor's address](/install/proxy#the-visitor-s-address)).

## Caching

| Route                           | Cache-Control from the API            |
| ------------------------------- | ------------------------------------- |
| `GET /kp/agent.js`              | `public, max-age=3600`                |
| `GET /kp/a/{build}.js`, `.s.js` | `public, max-age=31536000, immutable` |
| Every `POST` route              | `no-store`                            |

A bundle's name changes with every release, so bundles can be cached for a year; the loader is cached for an hour, so a new release reaches your pages within that hour. Keep these headers: a loader cached longer than an hour can outlive its build and answer [`build_inactive`](/api/errors#build-inactive). Never cache the `POST` routes, and never let your proxy retry them.

The API adds no `Access-Control-*` headers. Requests to the `/kp/` routes are same-origin, because they go to your own domain, so none are needed.

## Your Content Security Policy

If your site sends a Content Security Policy, it must allow the agent's scripts (`/kp/agent.js` and `/kp/a/`) and its requests to the `POST` routes above. [Content Security Policy](/install/csp) has the exact directives to add.

## Troubleshooting

| You see                                     | Likely cause                                                                                                                                         |
| ------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------- |
| `404` on `/kp/agent.js`                     | The proxy rule for `/kp/` is missing, or it rewrites the path                                                                                        |
| `403 ip_not_allowed` on every challenge     | The key has allowed IP ranges and the address knownprint sees is outside them, often your server's own because the proxy sends no valid proxy secret |
| `403 origin_not_allowed` on one host only   | That host's origin (with or without `www.`, `http` or `https`) is not on the public key                                                              |
| `401 unauthorized` on the challenge         | The page uses a revoked or mistyped public key                                                                                                       |
| `409 nonce_reused` in bursts                | A proxy, load balancer or CDN retries `POST` requests                                                                                                |
| `400 build_inactive` after a release        | The loader is cached longer than an hour somewhere between the browser and the API                                                                   |
| `429 rate_limited` from an office or school | Many visitors share one address; the limit applies per address                                                                                       |
| `410` on `/kp/l/` or `/kp/b/`               | Expected from time to time; no action needed                                                                                                         |

The [go-live checklist](/install/go-live) lists what to run before you send real traffic.
