Authentication
Every request to the Toden verification and Risk Intelligence APIs (except the public health check) must be authenticated with an API key.
Two key types: publishable and secret
Keys come in two scopes. The scope decides which endpoints a key may call:
Each scope also carries the environment dimension in its prefix:
A key looks like pk_test_aB3dE5fG7hJ9kL1mN3pQ5rS7tU9vW1xY: the prefix plus 32 random alphanumeric characters.
Never ship a secret (sk_) key in your SDK, mobile app, or any client code.
The publishable key in your frontend can only start verifications and poll
minimal status; it can never read identity data. Fetch results from your
backend with a secret key. A publishable key hitting a secret-only endpoint
gets 403 secret_key_required.
Authenticating a request
Pass the full key as a Bearer token in the Authorization header:
The key identifies your organisation and its environment. There is no separate organisation ID to send.
Risk Intelligence uses https://sandbox-api.toden.co/api/v1 with sk_test_
and https://api.toden.co/api/v1 with sk_live_. The official Node.js SDK
selects the host from its environment option.
Creating and managing keys
API keys are managed in the dashboard under Developers → API Keys.
- Pick the key type (Publishable or Secret) when creating a key. The environment selector in the dashboard header decides whether it’s a
_test_(sandbox) or_live_(production) key. - Secret keys are shown only once, at creation. Store the value immediately in a secrets manager; it cannot be retrieved again, only the prefix is displayed afterward.
- Publishable keys can be viewed again in the dashboard by anyone whose role holds
api_keys:create: they’re public by design (they ship in your frontend), so there’s no secret to protect. Other roles see the first 16 characters only. - Creating a key requires the
api_keys:createpermission and revoking one requiresapi_keys:revoke. Members without them see keys read-only. - Revoke a key the moment it may be compromised. Revocation is immediate: the next request with that key returns
401.
Creating and revoking keys emit the api_key.created and api_key.revoked webhook events so you can wire them into your own security auditing.
Errors
See Errors for the full list.
Where each key is used
- Publishable (
pk_…): the client SDKs, which take anapiKeyand call the API from the user’s device, plus any frontend code that starts verifications. Match the environment:pk_test_with the SDK’ssandboxenvironment,pk_live_withproduction. - Secret (
sk_…): your backend reading results:GET /verifications/:idfor the full result + PII andGET /verifications/:id/media/:kindfor captured media, plus every Risk Intelligence request under/api/v1. Keep it server-side only. See the Risk Intelligence quickstart.
Best practices
- Never put a secret key in client code. If a publishable key leaks it can only start verifications; a leaked secret key exposes identity data, so treat it like a password.
- Never commit a key to a public repository or paste it where it could be scraped. Revoke immediately if a key leaks.
- Use
_test_keys while integrating and in CI; reserve_live_keys for production traffic. - Rotate keys periodically.
- Scope keys per service or environment so you can revoke one without disrupting everything.