Privacy and security
Limits
Every rate limit, size limit, lifetime, page size, retention period and webhook retry rule of knownprint in one place, with what your code should do when it meets one.
This page lists every number your integration can run into: how fast you may call, how large a request may be, how long ids and records live, and how webhooks retry. The same limits apply on every account today.
Rate limits
knownprint limits requests with token buckets. A bucket holds a burst of requests and refills at a steady rate; a request that finds it empty answers 429 with the problem type rate_limited and a Retry-After header.
Server API
These apply to every route your backend calls with a secret key (API reference).
| Bucket | Counted per | Rate | Burst |
|---|---|---|---|
| Requests | Secret key | 50 a second | 150 |
Deletions (DELETE /v1/visitors/{visitor_id}, DELETE /v1/linked/{linked_id}) | Secret key, on top of the request bucket | 2 a second | 2 |
| Failed authentication | Client address | 30 a minute | 30 |
A failed authentication is a request with a missing, malformed, unknown or revoked key. Once a client address has used up its 30, further failures from it answer 429 instead of 401 until the bucket refills. A request with a valid key never touches this bucket.
Browser agent
These apply to the requests the script makes through your proxy (browser agent). A visitor's address is counted as the full IPv4 address, or the /64 network of an IPv6 address, and per account.
| Bucket | Counted per | Rate | Burst |
|---|---|---|---|
| Challenges (the request that starts an identification) | Visitor address | 60 a minute | 60 |
| Identifications | Visitor address | 30 a minute | 30 |
| Identifications | Recognised visitor | 60 a minute | 60 |
| Challenges and identifications | Public key | 50 a second | 150 |
Identifications, when the key has a daily_cap | Public key, per UTC day | Your cap |
A visitor who goes past a limit gets no request id for that action; the page's identify() rejects (browser agent errors). Your backend then sees the action arrive without a request id: treat it as an unknown visit, not as a pass. A daily cap that is reached answers 429 with a Retry-After that runs to the next UTC midnight.
Thirty identifications a minute from one address is far above what one person causes. Offices, schools and mobile carriers put many people behind one address, so identify at the moments that matter (signup, login, checkout, a sensitive change) rather than on every page view.
Rate limit headers
Every answer of the server API reports the key's request bucket, once the key and its scope check out. The script's challenge and identification answers report the visitor address bucket instead, never your key's.
RateLimit: limit=150, remaining=149, reset=1
RateLimit-Policy: 150;w=3| Header | Meaning |
|---|---|
RateLimit | limit is the burst, remaining the requests left now, reset the whole seconds until the bucket is full again. |
RateLimit-Policy | The burst, and w, the seconds over which the bucket refills from empty. |
Retry-After | On a 429 only: the whole seconds to wait before retrying. |
Retrying after a 429
Wait for Retry-After, then retry the same request. A write that carries an Idempotency-Key is safe to repeat: a 429 is never stored against the key, so the retry runs.
async function callKnownprint(path, init = {}, attempts = 5) {
for (let i = 0; ; i++) {
const res = await fetch(`${process.env.KNOWNPRINT_API}${path}`, {
...init,
headers: {
...init.headers,
Authorization: `Bearer ${process.env.KNOWNPRINT_SECRET_KEY}`,
},
});
if (res.status !== 429 || i + 1 >= attempts) return res;
const wait = Number(res.headers.get('retry-after') ?? '1');
await new Promise((resolve) => setTimeout(resolve, Math.max(1, wait) * 1000));
}
}For batch work, such as a backfill of feedback or a run of deletions, pace requests below the rate instead of relying on retries: under 50 a second per key, and under 2 a second for deletions.
Request size limits
A request whose body is larger than its route allows answers 413 payload_too_large. Bodies are JSON: send Content-Type: application/json. Any other media type, and a body that is not valid JSON, answers 400 schema_mismatch.
| Request | Largest body |
|---|---|
| An identification from the script | 64 KB |
| A challenge from the script | 2 KB |
| A follow-up request from the script | 1 KB each |
| Any server API request | 64 KB |
Other limits on every request:
| Limit | Value |
|---|---|
| JSON nesting | 64 levels; deeper answers 400 schema_mismatch |
| Time to send a request | 60 seconds from the start of the request to the end of its body |
Field limits
| Field | Where | Limit |
|---|---|---|
linkedId | The script's load() and identify() | Up to 128 characters as JavaScript counts a string's length, well-formed Unicode |
linked_id | PATCH /v1/events/{request_id}, GET /v1/events, DELETE /v1/linked/{linked_id} | 1 to 128 characters (Unicode code points) |
tags | The script's load() and identify() | A plain object with non-empty names and string, finite number or boolean values, under 4,096 bytes as canonical JSON |
tags | PATCH /v1/events/{request_id} | Up to 64 properties; names 1 to 64 characters; string values up to 256 characters; under 4,096 bytes as canonical JSON |
note | POST /v1/events/{request_id}/feedback | Up to 1,000 characters |
label | POST /v1/events/{request_id}/feedback | fraud or legit |
ip | GET /v1/events | An address or CIDR range, up to 49 characters |
min_suspect_score | GET /v1/events | 0 to 100 |
url | POST /v1/webhooks, PATCH /v1/webhooks/{id} | Up to 2,048 characters, https, resolving to public addresses only |
event_types | POST /v1/webhooks, PATCH /v1/webhooks/{id} | 1 to 8 distinct types |
allowed_origins | POST /v1/keys, public key | At least one serialised origin |
daily_cap | POST /v1/keys, public key | 1 to 2,147,483,647, or null for none |
allowed_ip_ranges | POST /v1/keys, public key | Addresses or CIDR ranges whose host bits are zero |
scopes | POST /v1/keys, secret key | At least one of the six scopes, each once |
Idempotency-Key | Every write route | 1 to 255 visible ASCII characters, no spaces |
A field outside its limit answers 422 validation_failed on the server API. In the page, a linkedId or tags outside its limit makes load() or identify() reject with invalid_options before anything is sent (LoadOptions).
Ids and lifetimes
| What | Lifetime | What it means for your code |
|---|---|---|
Request id (evt_...), for your backend to act on | 10 seconds: expiresAt in the page, received_at plus 10 seconds | Send it to your backend with the action and check it there at once. Accept each request id once (verify in your backend). |
| Request id, as the id of its event | The event clock (below) | GET /v1/events/{request_id} reads it for as long as the event is kept. |
| Signals refined after the identification | incognito and suspect_score within about ten seconds; bot up to 30 minutes | Read the event when the visitor acts (when signals change). |
Idempotency-Key | 24 hours | A repeat within 24 hours answers the stored result, with Idempotency-Replayed: true. A repeat while the first is still running waits up to 5 seconds, then answers 409 idempotency_conflict. The same key with another method, path or body answers 409 idempotency_conflict at once. A 429 or a 5xx is not stored, so a retry runs again. |
| A revoked key, a new or retired proxy secret | Takes effect within a minute | Wait a minute after creating a proxy secret before your proxy uses it (security). |
Deletion job (del_...) | Runs within minutes | Reads of the visitor answer 409 deletion_pending until it finishes. |
Pagination
| Route | Page size | Order |
|---|---|---|
GET /v1/events | limit 1 to 500, 50 by default | Newest first |
GET /v1/webhooks/{id}/deliveries | limit 1 to 500, 50 by default | Newest first |
GET /v1/visitors/{visitor_id}/related, GET /v1/linked/{linked_id}/related | Up to 50 visitors and 50 linked ids, not paged | |
GET /v1/keys, GET /v1/webhooks | Every key or webhook of the environment, not paged | Oldest first |
A paged answer carries next_cursor, an opaque string of at most 512 characters, or null on the last page. Pass it back as cursor with the same filters to read the next page. A limit outside its range answers 422 validation_failed ("A query parameter is unknown, repeated or has an invalid value."), and a cursor that is not one knownprint gave answers 422 with "The cursor is malformed." (events API).
# Every event of one account, page by page (needs jq).
cursor=""
while :; do
args=(--data-urlencode "linked_id=$ACCOUNT_ID" --data-urlencode "limit=500")
[ -n "$cursor" ] && args+=(--data-urlencode "cursor=$cursor")
page=$(curl -sS -G "$KNOWNPRINT_API/v1/events" "${args[@]}" \
-H "Authorization: Bearer $KNOWNPRINT_SECRET_KEY")
echo "$page" | jq -c '.data[]'
cursor=$(echo "$page" | jq -r '.next_cursor // empty')
[ -z "$cursor" ] && break
doneRetention
Two clocks are set for your account; everything else has a fixed period. The full table, and what each record holds, is on the privacy page.
| What | How long |
|---|---|
| Events | The event clock: 30 to 365 days, 90 by default |
| Raw values the browser sent | The raw clock: 7 to 90 days, 30 by default |
| Full IP address in an event | 30 days, then cut to its /24 or /48 network |
| Visitor record | Until 400 days pass without a visit |
| Match records: how each identification was decided | The event clock, except the newest record for each stored token, which is kept with the visitor record |
| Keyed one-way hashes of the visitor's address, its network and its operator | Kept with the visitor record until 400 days pass without the browser being seen there; a full IPv6 address about a day |
knownprint's cookie (kp_t, unless your account names another) | Up to 400 days from the last answer that set it |
| The token in the browser's storage | Until the browser removes it, or your page calls forget() |
| Feedback you send on an event | The event clock |
| One-way record of a deletion | 30 days |
| Webhook delivery records | 30 days after the last attempt |
| Idempotency records | 24 hours |
Webhooks
| Rule | Value |
|---|---|
| Attempts per delivery | 8 |
| When each attempt runs, counted from the first | At once, then after 1 minute, 5 minutes, 30 minutes, 2 hours, 12 hours, 24 hours and 72 hours |
| Timeout of one attempt | 10 seconds |
| Success | Any 2xx answer. Any other status, a 3xx included, is a failure; redirects are not followed. |
| After the eighth failure | The delivery is dead. Replay it with POST /v1/deliveries/{id}/replay once your receiver is fixed. |
| Signature timestamp tolerance | 5 minutes either way |
| Delivery records | Listed with GET /v1/webhooks/{id}/deliveries for 30 days after their last attempt |
A delivery that times out or fails is attempted again even if your receiver did act on it, so make your handler safe to run twice: use the webhook-id header, which stays the same across the attempts of one delivery, to skip one you already handled. See webhooks and verify webhooks.
Related pages
- API reference: authentication, idempotency and errors.
- Errors: every problem type and status.
- Privacy: retention and deletion in full.
- Security: keys, scopes and rotation.