Skip to main content
Every request to the Youverify API is authenticated with a single secret key passed in the token header — there is no OAuth handshake, no session cookie, and no bearer prefix. Possession of the key is authority, so keeping it server-side and out of client code is the single most important security step you can take.

Credential types

Youverify issues two distinct credentials per workspace environment. They serve different purposes and must never be swapped.

API Secret Key

Used for all server-to-server API calls. Pass it in the token header. Never expose this key in a browser, mobile app, or public repository — anyone who holds it can act on your workspace.

Public Merchant Key

Safe to embed in web and mobile SDKs or hosted flows. Scoped only to starting liveness and document-capture sessions. It cannot create entities, retrieve profiles, or trigger verifications.
Never include your API Secret Key in client-side JavaScript, Android/iOS app bundles, or any code that ships to end users. If you suspect a secret key has been compromised, rotate it immediately in your workspace settings.

The token header

Pass your secret key as the value of the token header on every server-to-server request. There is no Bearer prefix — the value is the raw key string.
A minimal cURL example:
Store your key in an environment variable (YV_SECRET_KEY) rather than hard-coding it. This keeps the key out of version control and makes rotating credentials straightforward.

Environments

Youverify operates two completely independent environments. Each has its own base URL and its own set of API credentials. A key from one environment is rejected by the other. Use sandbox throughout development and integration testing. Switch to production only when you are ready to process real subjects.
Do not mix environments. Using a sandbox key against the production URL (or vice versa) returns a 401 Unauthorized error. Entities and data created in sandbox never appear in production.

Where to find your keys

Your API keys live in your Youverify workspace settings:
1

Open your workspace

2

Navigate to Settings → API Keys

In the sidebar, go to Settings, then select the API Keys tab.
3

Select the correct environment

Use the environment selector at the top of the page to toggle between Sandbox and Production. Each environment shows its own distinct key pair.
4

Copy and store securely

Click Copy next to the API Secret Key and store it in a secrets manager, .env file (excluded from source control), or your deployment platform’s environment variables.

Authenticated request examples

Authentication errors

When authentication fails, the API returns a standard error envelope with a machine-readable name field. The two most common authentication-related errors are:
Your request arrived without a token header, or the key value is incorrect (wrong key, extra whitespace, or a production key against sandbox).
Fix: Confirm the token header is present, that the key value matches what is shown in your workspace settings, and that you are using the correct environment’s key against the correct base URL.
Your key is valid, but it does not have permission to perform the requested action. This typically happens when a Public Merchant Key is used on an endpoint that requires a secret key.
Fix: Ensure you are using the API Secret Key (not the Public Merchant Key) for server-side operations. If you have multiple roles or restricted workspace permissions, contact your workspace admin.

Security best practices

  • Rotate keys regularly. Generate a new key in workspace settings and update your deployment before retiring the old one.
  • Use environment variables. Never commit keys to Git, even in private repositories.
  • Scope access. Use the Public Merchant Key for any client-facing flow. Reserve the secret key exclusively for your backend.
  • Monitor usage. Review API activity logs in your workspace dashboard to detect unexpected usage patterns early.