Skip to navigation

API keys

Create, restrict, rotate and revoke the keys your integration uses.

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.

ActionPermission needed
View the key listapi_keys:read
Create or rotate a key, edit its restrictions, see a publishable key in fullapi_keys:create
Revoke a keyapi_keys:revoke

Key types and prefixes

PrefixTypeEnvironmentWhere it belongs
pk_test_PublishableSandboxClient SDKs and frontends
sk_test_SecretSandboxYour backend only
pk_live_PublishableProductionClient SDKs and frontends
sk_live_SecretProductionYour backend only

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

1

Choose the environment

Set the environment selector in the console header to Sandbox or Production.

2

Start a new key

On Developers → API Keys, choose Create key.

3

Name it and pick a type

Enter a Key name that says where the key is used, for example “Mobile app sandbox”, and choose Publishable or Secret under Key type.

4

Copy the key

The console shows the new key once the request succeeds. Copy it before you close the dialog.

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

Key typeIn the list
SecretThe first 16 characters only, for identification
PublishableThe full key, for roles that hold api_keys:create. Other roles see the first 16 characters only

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.

Key typeRestrictionFieldRefusal
PublishableAllowed web originsallowedOrigins403 origin_not_allowed
SecretAllowed IP addresses or CIDR rangesallowedIpCidrs403 ip_not_allowed

Each list holds up to 20 entries. Duplicates are removed.

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 Origin is null (a sandboxed iframe, or a page opened from a file: or data: 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.

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.

1

Rotate the key

Choose Rotate key and copy the new key before you close the dialog.

2

Deploy it

Update your secrets manager or client configuration, and release within 24 hours.

3

Confirm the old key is idle

Watch the Last used column for the old key. When it stops moving, nothing is using it. You can revoke it early.

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.