Docs / API keys & auth

API keys & auth

Two keys: fk_pk_ in the browser, fk_sk_ only on your server. Never call assess from the client.

Key types

TypePrefixAllowedForbidden
Publishable fk_pk_ Create session, collect, beacon Assess, email, account, read session
Secret fk_sk_ Assess, email, account, webhooks, profiles Browser pages (will leak)
# Header (preferred)
X-Api-Key: fk_sk_…

# Also accepted
GET /v1/account?api_key=fk_sk_…

Origins

Publishable collect validates the browser Origin against your allowlist (max 20).

PUT /v1/account/origins
{ "origins": ["https://app.example.com", "http://localhost:5173"] }

Mismatch → 403 origin_not_allowed.

Idempotency

On POST /v1/assess, send Idempotency-Key: <uuid>. Retries with the same key return the same result for ~24 hours — safe for flaky networks.

Rotate keys

POST /v1/account/keys/rotate
X-Api-Key: fk_sk_old

Returns new secret (and publishable on live plans). Update env immediately; old key is revoked.

Plans gate live network

Free accounts calling session create/collect get 402 plan_upgrade_required. Upgrade via Billing or work-email trial on Get started.

Checklist Secret only in server env · origins set before production traffic · Idempotency-Key on assess · rotate if a key ever hits logs or a ticket.