API keys
API keys are how your application authenticates with Toden. You create and manage them in the console. This page is for the developer who sets up an integration and for whoever is responsible for keeping its credentials safe. For how to send a key with a request, see Authentication.
Where to find it
Open Developers → API Keys at console.toden.co. The environment selector in the console header decides which keys you see and which kind you create: Sandbox or Production. Keys from one environment never appear in the other.
Key types and prefixes
A publishable key starts verifications from a client. A secret key does everything a publishable key can, and also reads full results, personal data and captured media. A publishable key that calls a secret-only endpoint gets 403 secret_key_required. A publishable key created with scopes has Verification flow access: it runs the applicant verification flow, reads the SDK configuration and reads a verification’s status (flow.run, flow.config.read and verifications.status.read), and nothing else.
A key works only in its own environment, on that environment’s host: Sandbox keys on https://sandbox-api.toden.co, Production keys on https://api.toden.co. Each environment holds only its own keys, so a key sent to the other host is not recognised and returns 401 Invalid API key.
Create a key
A secret key is shown once, when you create or rotate it. Toden stores only a hash of it, so nobody, including Toden support, can show it to you again. If you lose it, rotate the key or create a new one.
What you can see afterwards
A publishable key is safe to ship in client code, but it can still start billable verifications. That is why read-only roles do not see it in full.
The list also shows each key’s name, type, status (Active or Revoked), who created it, when it was created and when it was last used. A rotated key shows when it stops working.
Production keys need an approved business
Creating a pk_live_ or sk_live_ key requires that Toden has approved your business profile. Until then the Production option is locked in the console, and the request returns 403 business_not_approved. Sandbox keys are available from the start. See Go live.
Restrict a key
Restrictions limit where a key can be used, so a copied key is useless elsewhere. They are optional: a key with an empty list is unrestricted. Open a key’s actions and choose Restrict key (or Edit restrictions once some are set).
The kind of restriction depends on the key type.
Each list holds up to 20 entries. Duplicates are removed.
Publishable: web origins
Secret: IP ranges
Enter each origin as scheme and host, with a port if it is not the default: https://app.example.com. Paths are ignored, and only http and https are accepted.
- A browser request whose
Origin(or, failing that,Referer) is not on the list is refused. - A request with no origin at all is allowed. Native mobile SDKs and server callers send no
Origin, so an origin list does not affect them. - A request whose
Originisnull(a sandboxed iframe, or a page opened from afile:ordata:address) is refused, because no allowed origin can match it. Serve the SDK from a page on an allowed origin.
This is a browser control. It stops a key lifted from your site being used on another site. It does not stop a non-browser client, which can omit the header. For a backend, use a secret key restricted by IP.
Enter your backend’s public egress addresses as single IPs or CIDR ranges, IPv4 or IPv6: 203.0.113.5 or 203.0.113.0/24. A single address is stored as a /32 (IPv4) or /128 (IPv6) range.
- A request from any address outside the list is refused.
- If Toden cannot determine the caller’s address, a restricted key is refused.
Add restrictions in Sandbox first and confirm your integration still works. A wrong IP range on a live secret key stops your backend from reading results until you correct it.
Revoke a key
Choose Revoke key from the key’s actions. Revocation is immediate and permanent: the next request made with that key returns 401 with Invalid API key. A revoked key stays in the list, marked Revoked, so the history remains readable. It cannot be re-enabled.
Rotate a key
Choose Rotate key from the key’s actions. Toden creates a replacement with the same name, type, environment and restrictions, and shows its secret once. The old key keeps working for 24 hours, so you can deploy the replacement without downtime. After that, a request made with the old key returns 401 with Invalid API key.
A key is rotated once. Rotating a key that is already counting down its 24 hours is refused with 409 api_key_already_rotated, and the answer’s successorId names its replacement: rotate that one instead. A revoked key answers 409 api_key_revoked, a replaced key 409 api_key_already_replaced (with successorId), and an expired key 409 api_key_expired: create a new key instead. A Production key needs an approved business to rotate, as it does to create. Each rotation carries an idempotency key, as creating and replacing a key do, so a retried rotation answers the first one and never makes a second key.
For a publishable key in a mobile app, 24 hours may be too short for every installed version to update. Create a new key, release it, and revoke the old one once it is idle.
If a secret key may have been exposed, do not wait for the 24 hours: rotate it, then revoke the old key straight away. A short outage is better than a leaked key that can read personal data.
What is recorded
Creating a key, rotating a key, revoking a key and changing restrictions are written to the audit log as api_key.created, api_key.rotated, api_key.revoked and api_key.restrictions_updated. Rotating writes two entries: api_key.rotated on the old key, with when it stops working, and api_key.created on its replacement. The entry holds the key name, type, environment and prefix, never the key itself. Toden also sends the api_key.created and api_key.revoked webhook events, including api_key.created for a replacement.
A key with an expiry date is announced before it stops working: 30, 7 and 1 days ahead, and again when it expires. Each notice appears in the console for members who can see API keys and is sent as the api_key.expiring or api_key.expired webhook event. For a Production key, members who can create API keys or manage security are also emailed, unless your organisation has turned expiry emails off in its API key policy. Each notice is recorded in the audit log as api_key.expiry_notice or api_key.expired_notice. A rotated key’s 24 hours do not send notices.
User tokens
A publishable key with Verification flow access reaches presence checks, face re-authentication and face enrolment only for a person your server vouches for, including when your app starts face re-authentication or face enrolment in the SDK. Your server issues a short-lived user token for the person signed in to your app with a secret key that holds user_tokens.presence.write or user_tokens.biometric.write, naming the publishable key your app uses, and your app sends it in the X-Toden-User-Token header. See the User tokens endpoints in the API reference. Issuing, revoking and the face check limit are recorded as user_token.issued, user_token.revoked and user_token.biometric_locked. Ending a key’s sessions also ends the user tokens it issued or is bound to, and the result says how many in userTokensRevoked.