knownprintDocs

Install

Go-live checklist

Everything to check before knownprint sees production traffic: keys, proxy, content security policy, the verify path, webhooks, deletion, your privacy notice, monitoring and key rotation.

Work through this list on your staging site with your test keys, then once more on production with your live keys. Each item says what to check and how to tell that it passed. Most take a few minutes.

1. Test and live keys

Your account has two environments, test and live. Each has its own keys, its own proxy secret and its own data:

CredentialTestLiveWhere it lives
Public keypk_test_...pk_live_...In your page, passed to the browser agent. Safe to publish.
Secret keysk_test_...sk_live_...On your server only. Reads events, writes links, deletes visitors.
Proxy secretone per environmentone per environmentIn your proxy configuration only. Tells knownprint the request came through your proxy.

The two environments never see each other's data: a request id made with the test public key reads as 404 not_found with the live secret key, and the reverse. That is the most common go-live mistake, so check:

  • Production pages render pk_live_..., and production servers hold sk_live_... and the live proxy secret. Staging holds the three test credentials.
  • The three credentials of one deployment belong to the same environment. A quick test: identify on the page, then read the event with the server's key. A 404 means the page and the server are on different environments.
  • Your production origin is in the live public key's allowed origins, written exactly as the browser serialises it (https://www.shop.example: scheme and host in lower case, no default port, no path, no trailing slash). A page on an origin that is not listed gets 403 origin_not_allowed and no request id. Add every origin that serves the form, such as both https://shop.example and https://www.shop.example if you serve both.
  • The secret key is not in any page, bundle, mobile app, log line or repository. Load it from your secret store at runtime.
  • The server's secret key has the scopes it uses and no more: events:read to verify, events:write to attach account ids and send feedback, visitors:delete for deletion requests, webhooks:manage and keys:manage only where you manage those from code. See Keys.

2. Proxy check

knownprint runs from your own domain through a proxy rule (Proxy setup). Check it on the production host, from outside your network:

  • https://<your site>/kp/agent.js answers 200 with JavaScript, and sets no cookie.
  • A form submit on the production page sends a kp_request_id with the form (check the request in the browser's developer tools).
  • Reading that event shows network.ip equal to your own public address, as a site such as your router's status page shows it. It must not be null, your proxy's address, a loopback address or a private address (10.x, 172.16.x to 172.31.x, 192.168.x).
  • integrity.origin equals your page's origin.
  • Repeat from a phone on mobile data, so you also see an IPv6 address if your site serves IPv6.
Shell
curl -s "$KNOWNPRINT_API/v1/events/$REQUEST_ID" \
  -H "Authorization: Bearer $KNOWNPRINT_SECRET_KEY" \
  | jq '{ip: .network.ip, origin: .integrity.origin, visitor_id, confidence}'

If network.ip is wrong, the proxy is not passing the client address, or a load balancer or CDN in front of it hides the address and the proxy does not restore it. Fix that before go-live: the address check of the verify path depends on it, and so do the network signals.

3. Content Security Policy check

If your site sends a Content-Security-Policy header, the browser agent needs a few allowances (Content Security Policy).

  • Open the protected pages with the production policy (not a relaxed staging one) and submit each form once. The browser console shows no Refused to load, Refused to connect or Refused to create a worker messages.
  • If you run the policy in report-only mode first, your report endpoint receives no violations that name /kp/ or blob:.

A policy that blocks the script does not break your form (the form still submits, without a request id), so this failure is silent unless you look. The missing-id metric below catches it in production.

4. The verify path

Your backend must check every request id before it trusts the event (Verify a request in your backend).

  • Every protected form (signup, login, checkout, password reset, whatever you protect) reads the event on the server. No decision is taken in the page.
  • Each request id is accepted once. The store of used ids is shared by every process and every host that handles the form (Redis, Valkey or your database), and an entry lives at least 70 seconds.
  • Events older than 10 seconds are refused, and the server's clock is synchronised (NTP).
  • integrity.replayed true is refused.
  • integrity.origin is compared with your origin, exactly.
  • network.ip is compared with the address your own proxy reports for the form post: the entry your proxy appended to X-Forwarded-For, never the first entry. Your proxy sends that header to your application (nginx needs proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; in your application's location, see Install on nginx).
  • A missing, unknown or failed request id takes your medium-risk path (a second factor, a review, a lower limit), not a silent pass and not a hard block (Handle a missing request id).
  • A slow or failing knownprint call never fails the form: reads have a timeout (5 seconds is plenty) and an error takes the missing-id path.
  • After signup and login, your account id is written to the event with PATCH /v1/events/{request_id} (Attach your account id), and the visitor_id is stored beside the account.
  • Your logs never hold request ids, visitor ids or addresses beside a user's identity unless your privacy notice covers it. Log the verification code instead.

5. Webhooks

Webhooks push events and visitor changes to your backend (Webhooks). If you use them:

  • The endpoint is registered in the live environment (POST /v1/webhooks, see Webhooks API) with the types you handle, and its whsec_ signing secret is in your secret store.
  • Every delivery's signature is checked against the raw body before anything is parsed or stored, and deliveries with a timestamp more than 5 minutes off are refused (Verify webhooks).
  • Your handler is idempotent: a delivery can arrive more than once, so store the envelope id and skip one you have already processed.
  • Your handler answers 2xx quickly and does slow work afterwards. A failed delivery is retried over 72 hours from its first attempt.
  • You sent a test delivery (POST /v1/webhooks/{id}/test) to production and saw it verified and logged.
  • If you store visitor ids, you handle visitor.merged, visitor.unmerged and visitor.split, so your stored ids follow knownprint's (Visitors).

6. Deletion requests

When a user asks you to delete their data, the data knownprint holds for your site must go too (Privacy).

  • Your deletion process (the one that handles a user's erasure request) calls knownprint with a secret key that has visitors:delete:
    • DELETE /v1/visitors/{visitor_id} for each visitor id you stored for the user, and
    • DELETE /v1/linked/{linked_id} with the user's account id. It removes the account id from every event and link, and deletes the visitors it leaves with no other account id of yours, even where you did not store their ids. A visitor that another account of yours also uses is unlinked, not deleted (Linked accounts API).
  • Both answer 202 with { "job_id": "del_...", "status": "queued" } (or running), whether or not the subject exists; the deletion runs in the background. Record the job_id with the user's request as your evidence.
  • If you subscribe to visitor.deleted, your handler removes the visitor id from your own records too.
  • Deletion calls are limited to 2 per second per key. A batch job (for example after closing many accounts) waits for Retry-After on 429.
Shell
curl -X DELETE "$KNOWNPRINT_API/v1/visitors/v_jxz4djj6egpy6r4sreptmrwlna" \
  -H "Authorization: Bearer $KNOWNPRINT_SECRET_KEY" \
  -H "Idempotency-Key: erasure-4711-v_jxz4djj6egpy6r4sreptmrwlna"

If your site offers "forget this device" in the browser, call the agent's forget() in the page and expire knownprint's cookie from your server in the same flow (Forget this browser); deleting the visitor is what removes the data on knownprint's side.

7. Your privacy notice

knownprint processes data on your behalf when your page runs it, so your privacy notice must say so. Before go-live, update it to cover at least:

  • What is collected: technical characteristics of the visitor's browser and device, and the IP address and the network it belongs to, on the pages that run the script.
  • Why: to keep accounts secure, to detect fraud and accounts made to get around a ban, and to detect bots.
  • Who processes it: knownprint, as your service provider (processor).
  • How long: the retention periods of your account (see Privacy for the defaults and the ranges you can choose).
  • Storage on the device: a random token in a first-party HttpOnly cookie set through your site's knownprint path (kp_t, unless your account names another), kept for up to 400 days, and the same token in the browser's storage, so the browser is recognised when it comes back (Privacy).
  • The visitor's rights, and how to ask you to delete their data (your process from item 6).

A starting point you can adapt with your counsel (this is not legal advice):

Text
Security and fraud prevention

When you sign up, log in or check out, we use knownprint, a fraud prevention service, to
recognise the browser and device you use and to detect bots and fraud. For this, knownprint
collects technical characteristics of your browser and device, your IP address and the network
it belongs to, and stores a random token in a cookie (up to 400 days) and in your browser's
storage so that it can recognise your browser on a later visit. We use the result only to keep accounts secure, to prevent
fraud and abuse, and to enforce bans. knownprint processes this data on our behalf and keeps
it for [retention period]. You can ask us to delete it at [link to your rights page].
  • The disclosure file your proxy serves at /.well-known/knownprint.json names your company as operator, your rights page as rights_url and your privacy contact as contact, not example values (Proxy setup).
  • If your site asks for consent before such processing, the page loads the script with the consent mode your policy needs (Add the browser agent and Privacy).

8. Monitoring

Watch the integration the way you watch your own dependencies. Put these on a dashboard and alert on the ones marked.

MetricWhere it comes fromAlert when
Share of protected form posts with no request idYour form handlerIt jumps (a broken proxy rule, a new CSP, an ad blocker list, an attack that strips the field).
Verification failures by codeYour verify step: consumed, stale, replayed, origin_mismatch, ip_mismatch, low_confidenceorigin_mismatch or ip_mismatch rise for everyone at once (usually configuration, not attack).
Read errors by statusGET /v1/events/{request_id} answersAny 401 or 403 (a revoked or wrong key), 5xx or timeouts that last more than a few minutes.
429 rate_limited answersAny server API callThey appear at all in normal traffic.
Webhook verification failuresYour webhook endpointAny sustained rate (a rotated secret not deployed, or forged deliveries).
Outcomes of your rulesYour decision step: allow, challenge, review, blockThe block or review share moves sharply after a deploy or a rule change.

Rate limits: secret-key calls carry RateLimit and RateLimit-Policy headers with the key's budget, and a 429 carries Retry-After in seconds. Wait at least that long before you retry, and do not retry a form's read in a loop while the user waits: take the missing-id path instead. Repeated calls with an invalid key are themselves limited per client address, so a misconfigured server sees 429 after a burst of 401. The limits are on Limits; every error code is on Errors.

9. Key rotation

Rotate the secret key on a schedule, when someone with access leaves, and at once if it may have leaked. The secret key can rotate itself with no downtime when it has the keys:manage scope (or use another key that has it):

  1. Create the new key: POST /v1/keys with {"kind": "secret", "scopes": [...]}, sent with a key that has keys:manage. The answer (201) shows the key's value once, in value, beside its id; store the value in your secret store straight away.
  2. Deploy the new key to every server and wait until all of them use it.
  3. Revoke the old key: DELETE /v1/keys/{id} with its key_... id, sent with the new key, which therefore needs keys:manage as well (or send it with another key that has that scope). A key cannot revoke itself (422, detail own_key). The answer is 204, also when the key was already revoked.
  4. Watch for 401 in your metrics: a server still holding the old key shows up there. A revoked key can keep working for about a minute while caches expire, so do not rely on the revocation being instant.
Shell
# 1. Create the new secret key (with the old one). It keeps keys:manage so that it can do
#    step 3 and the next rotation; leave that scope out if another key revokes for it.
curl -X POST "$KNOWNPRINT_API/v1/keys" \
  -H "Authorization: Bearer $OLD_SECRET_KEY" \
  -H "Content-Type: application/json" \
  -d '{"kind": "secret", "scopes": ["events:read", "events:write", "visitors:delete", "keys:manage"]}'

# 3. Revoke the old key (with the new one).
curl -X DELETE "$KNOWNPRINT_API/v1/keys/$OLD_KEY_ID" \
  -H "Authorization: Bearer $NEW_SECRET_KEY"

GET /v1/keys lists the environment's keys with their ids and the first characters of each value (prefix), never the full value, so you can tell which id is the old key. The same steps rotate a public key ("kind": "public" with allowed_origins, then update your pages) and the proxy secret ("kind": "proxy_secret", then update your proxy configuration; a new proxy secret takes up to a minute to be accepted everywhere). See Keys and Security.

Ready

When every box is ticked on production, you are live. Keep the dashboard from item 8, review your rules' outcomes after the first week, and send feedback on the cases your team reviews (Feedback) so you can tune thresholds on your own traffic.