API Authentication: OAuth, Bearer Tokens, and Best Practices
Didit's verification API authenticates with a scoped key in the x-api-key header, not OAuth. The account host apx.didit.me uses a JWT Bearer token, OAuth 2.1 is used by the hosted MCP server, and Didit Authentication issues.

Contents
In this guide
Jump to the part you need.
Didit's verification API does not use OAuth. Every request carries a scoped API key in the x-api-key header, which fits backend services. The account host apx.didit.me uses a JWT Bearer token, OAuth 2.1 is used by the hosted MCP server, and Didit Authentication issues end-user tokens. Keys cost nothing to create and you pay per completed check. The main caveat: the key is a server-side secret, so never ship it to a browser or a mobile bundle.
Last updated: November 26, 2026. Prices checked against the live Didit price feed on November 26, 2026.
| Surface | Host | Credential | Header | Who holds it |
|---|---|---|---|---|
Verification API: sessions, workflows, entities, transactions, standalone checks, lists, webhooks, billing (every /v3/... route) | verification.didit.me | Application API key | x-api-key | Your backend |
| Account, organization and application management | apx.didit.me | JWT from programmatic login | Authorization: Bearer | Setup scripts, key recovery |
| Authentication management setup | apx.didit.me | Application API key with the authentication scope, or an owner-approved grant with didit:management | x-api-key or Authorization: Bearer | Your backend or an approved owner |
| Didit Authentication, end-user sign-in | Your application issuer | PKCE code exchange, ES256 access and ID tokens | Authorization: Bearer | Your backend and frontend |
| MCP server, interactive | mcp.didit.me/mcp | OAuth 2.1 with PKCE, Log in with Didit | Handled by the client | Claude, Cursor, VS Code |
| MCP server, headless | mcp.didit.me/mcp | Application API key | Per client config | CI jobs, scheduled agents |
Start free in the sandbox at business.didit.me, no sales call, and check the per-check prices on the Didit pricing page. If you are wiring an AI assistant rather than a backend, connect it through the Didit MCP server and skip key handling for interactive work. The documented routes and OpenAPI contracts are in the API authentication docs.
Add Didit to Claude · Connect Didit in ChatGPT · MCP setup for every client
What API authentication looks like at Didit
Two hosts, two schemes, and mixing them is the most common integration bug we see. The verification host https://verification.didit.me serves every /v3/... route. It authenticates with a long-lived API key on the x-api-key header. The account host https://apx.didit.me serves organizations, applications and the programmatic auth routes, and it authenticates with a JWT access token on an Authorization: Bearer header.
The verification API does not use OAuth Bearer tokens. Most account and organization routes use a JWT Bearer token from programmatic login. Authentication management routes accept an application API key with the authentication scope, or an owner-approved grant with didit:management. The verification API always uses x-api-key, even when the account host uses Authorization: Bearer. If a call fails with 401 on one host, confirm which credential that host expects before you debug anything else.
API driven authentication: what the key proves, and what it does not
An API key authenticates the calling application. It proves a request came from a service that holds your key, and it carries the scopes, IP allowlist and expiry you gave that key. It does not identify the person at the other end. Person-level identity is the job of Didit Authentication, which issues its own end-user tokens, and of the verification session you create with the key. Keep those two layers separate in your design and in your logs.
Prerequisites
- A Didit organization. Sign up in the Business Console. The sandbox is free on every plan.
- At least one Application. API keys are scoped to an Application, which is the workspace that holds your workflows and verifications.
- The
workflow_idof the workflow you want a session to run. curlandjqif you want to paste the examples below unchanged. Any HTTP client works.- An inbox that can receive mail. The register endpoint checks deliverability before it creates anything, and reserved test domains such as
example.comare rejected with 400 and the codeemail_undeliverable.
Get a key and make your first authenticated call
The whole provisioning flow is available over the API, so you do not need the console to get a working key. The console route also exists: Developers, then API keys.
Register the organization. Didit emails a 6-character code with a 10 minute lifetime. Password rules: at least 8 characters, one uppercase, one lowercase, one digit, one special character.
curl -X POST https://apx.didit.me/auth/v2/programmatic/register/ \ -H "Content-Type: application/json" \ -d '{"email": "you@yourdomain.com", "password": "StrongP@ss1"}'Verify the email address. The response returns the tokens and both applications' keys inline.
curl -X POST https://apx.didit.me/auth/v2/programmatic/verify-email/ \ -H "Content-Type: application/json" \ -d '{"email": "you@yourdomain.com", "code": "A3K9F2"}'Store the sandbox key first. Save
response.sandbox_application.api_keyas the environment variableDIDIT_API_KEYandresponse.application.api_keyasDIDIT_LIVE_API_KEY. Sandbox keys start withsk_test_, live keys withsk_live_, followed by 43 URL-safe characters. Keys created before that format have no prefix and keep working, so never validate a key by its prefix.Call the verification API with the key. This creates a session against one of your workflows.
curl -X POST https://verification.didit.me/v3/session/ \ -H "x-api-key: $DIDIT_API_KEY" \ -H "Content-Type: application/json" \ -d '{"workflow_id":"<WORKFLOW_ID>","vendor_data":"user-42","callback":"https://myapp.com/return"}'Read the result. A session moves through the documented statuses: Not Started, In Progress, Awaiting User, In Review, Approved, Declined, Abandoned, Expired, Kyc Expired, Resubmitted. Read the decision with
GET /v3/session/{session_id}/decision/, or subscribe tostatus.updatedwebhooks so the change is pushed to you instead of polled.Recover a key you lost. Log in again for a fresh JWT and read the application record. The key is the
api_keyfield.TOK=$(curl -s -X POST https://apx.didit.me/auth/v2/programmatic/login/ \ -H "Content-Type: application/json" \ -d '{"email":"you@yourdomain.com","password":"StrongP@ss1"}' | jq -r .access_token) curl https://apx.didit.me/auth/v2/organizations/me/ -H "Authorization: Bearer $TOK" curl https://apx.didit.me/auth/v2/organizations/me/$ORG_ID/applications/$APP_ID/ \ -H "Authorization: Bearer $TOK"Go live last. An organization created through the API starts at $0 credit, so live calls need credit on the account before they run. Keep the sandbox key in test environments and point production at the live key only when you are ready to pay per completed check.
Expected output
Step 2 returns both keys inline, plus the tokens you use against the account host:
200
{
"access_token": "eyJ...",
"refresh_token": "N4y...",
"organization": { "...": "..." },
"application": { "api_key": "sk_live_...", "client_id": "...", "uuid": "...", "mode": "live" },
"sandbox_application": { "api_key": "sk_test_...", "client_id": "...", "uuid": "...", "mode": "sandbox" }
}
Step 4 returns the session object. The status you read back is one of the exact, case-sensitive strings listed in step 5; note that Kyc Expired uses a single capital K. Every sandbox check is mocked, so you can run the full flow without spending anything.

Inputs and outputs
| Field | Direction | Example | Notes |
|---|---|---|---|
x-api-key | Request header | sk_test_... or sk_live_... | Verification host only. Treat it as a secret. |
Authorization: Bearer | Request header | Bearer $TOK | Account host, plus Didit Authentication token and session calls. |
workflow_id | Request body | workflow UUID | Which checks the session runs. |
vendor_data | Request body | user-42 | Your own identifier, returned on the session and on webhooks. |
callback | Request body | https://myapp.com/return | Where the user lands after the flow. |
api_key | Response body | sk_live_... | Returned by verify-email and by the application read. |
access_token | Response body | JWT or ES256 token | Account host JWT, or the end-user access token from the token endpoint. |
status | Response body | In Review | Fixed vocabulary. Case-sensitive. |
Retry-After | Response header on 429 | 37 | Seconds to wait. Use it as the floor of your backoff. |
Failure cases and recovery
| Status | Host | Meaning | Recovery |
|---|---|---|---|
| 401 | verification.didit.me | The x-api-key header is wrong, malformed, revoked or expired | Re-fetch the key with the recover flow in step 6, or use a key that has not expired |
| 403 | verification.didit.me | No x-api-key header, a scoped key without access to this resource or action, or a call from an address outside the key's IP list | Use a key with that access, created under Developers then API keys |
403 with application_deleted | verification.didit.me | The key's application was deleted | Do not retry. The application and its keys no longer exist |
| 404 on a session route | verification.didit.me | The session sits outside the scoped key's workflows or statuses | Use a key whose limits include that session |
| 403 | apx.didit.me | The JWT Authorization header is missing or expired | Call POST /auth/v2/programmatic/login/ again |
| 429 | any | Rate limit exceeded | Read Retry-After, back off with jitter, stop after a small number of attempts |
Rate limits are applied per identifier, meaning your x-api-key or, without one, your client IP. Each scope keeps an independent 60-second fixed window: 600 requests a minute for GET, 300 a minute for writes, 600 a minute for session creation, and a separate budget for transaction and event ingestion. On the Enterprise plan the global limits and the session creation, decision and PDF limits can be raised on request. When a scope trips, the 429 response includes the scope name in X-RateLimit-Scope, while the body carries the limit and support reference. The Retry-After header tells you how long to wait before the next attempt.
Give each workload its own key. Sharing one key across several backends collapses them into a single counter, and one noisy service then starves the rest.
Bearer tokens and OAuth at Didit: three different things
The word bearer covers three credentials here, and each one belongs to a different surface.
Account JWTs for apx.didit.me
The JWT from POST /auth/v2/programmatic/login/ is minted for your application, not for the console. Send it as Authorization: Bearer to read organizations and applications, including the api_key field. When it expires, log in again; there is no reason to persist it beyond the task that needed it.
Didit Authentication tokens for end-user sign-in
Each application is its own OpenID Connect issuer, either https://name.auth.didit.me for a live application or https://name.sandbox.auth.didit.me for a sandbox one, or your own custom domain once it is active. Clients are public: there is no client secret, client_id is your application ID, PKCE is S256 only, and the signing algorithm is ES256. Supported scopes are openid, email, phone, profile and offline_access.
Send the user to {issuer}/sign-in with redirect_uri, state, code_challenge and code_challenge_method=S256. The callback receives code and state. Check state, then exchange the code within 60 seconds, because each code works once.
curl --fail-with-body "${DIDIT_AUTH_ISSUER}/token/" \
-H 'Content-Type: application/json' \
-d '{
"grant_type": "authorization_code",
"code": "CODE_FROM_CALLBACK",
"code_verifier": "YOUR_PKCE_VERIFIER",
"redirect_uri": "https://app.example.com/auth/callback"
}'
{
"access_token": "eyJhbGciOiJFUzI1NiIs...",
"id_token": "eyJhbGciOiJFUzI1NiIs...",
"refresh_token": "N4yZTl6y24YKYq77X_SO...",
"token_type": "Bearer",
"expires_in": 299,
"session_id": "c9abf6cc-2d64-4bf2-b31e-a4d09a070ab1"
}
The example response shows expires_in of 299 seconds, so refresh the access token rather than caching it for the day. Verify signatures against the issuer's JWKS at {issuer}/.well-known/jwks.json, cache by kid, and refetch at most once a minute when a token names a key you do not hold. Signing keys rotate every 30 days: Didit publishes the next key one day before it signs with it and keeps the previous key for one day after. Both discovery documents answer Cache-Control: public, max-age=300. There is no userinfo, introspection or end-session endpoint, and prompt=none is not supported; read the session with GET /session/ instead.
MCP sessions for AI assistants
The hosted MCP server is an OAuth 2.1 resource server, and the Didit Business Console is the authorization server. A person connects one URL, logs in with Didit and approves the permissions, and the agent then acts with that person's console role. An agent that runs with nobody present, in CI or a scheduled job, connects with an application API key instead and acts as that one application.

API access token best practices
- Keep the verification key server-side only. It never goes into frontend code, a mobile bundle or a public repository.
- Create one key per service or partner, scoped to the access it needs, instead of sharing the primary secret everywhere.
- Set an expiry and an IP allowlist on keys that leave your network.
- Never infer anything from a key prefix. Older keys have no prefix and keep working.
- Send the verification API key only to
verification.didit.me. Send the programmatic account JWT toapx.didit.me, end-user tokens to the configured Authentication issuer, and MCP credentials to the MCP server. Terminate TLS in front of every call. - Use short-lived end-user access tokens with refresh tokens for people, and long-lived keys only for services.
- Respect
Retry-Afteron 429, add exponential backoff with jitter, and alert when retries keep failing. - Log the key id and the application, never the secret itself.
- Rotate on a schedule and immediately when a key is exposed; the console handles rotation and IP lists.
Worked cost example
Creating keys, the sandbox, the workflow orchestrator and the MCP server are free. Didit Authentication includes the first 50,000 active users each month, then charges $0.02 per additional active user. The money sits in the checks a session runs. A full ID check is $0.33 per completed check, made of ID document verification at $0.15, passive liveness at $0.10, face match 1:1 at $0.05 and device and IP analysis at $0.03.
Take a product doing 10,000 full KYC checks a month and running Didit Authentication for 60,000 active users a month, at list prices:
- KYC: 10,000 x $0.33 = $3,300.00
- Authentication active users: the first 50,000 each month are free, so 60,000 minus 50,000 = 10,000 billable users. 10,000 x $0.02 = $200.00
- Total at list price: $3,300.00 + $200.00 = $3,500.00
On the Scale plan every Didit price is 10% lower. KYC becomes 10,000 x $0.297 = $2,970.00 and the 10,000 billable active users become 10,000 x $0.018 = $180.00, for $3,150.00. The plan costs $299.00 a month and includes $350.00 of credit. On the Growth plan the same lines are 10,000 x $0.3168 = $3,168.00 and 10,000 x $0.0192 = $192.00, for $3,360.00, with a $99.00 monthly fee and $115.00 of credit.
Paid steps and review boundaries
Everything up to the first live check is free. Keys, sandbox sessions, workflows, the MCP server and reusable KYC carry no charge. A live session bills only when a check completes, and an organization created through the API starts at $0 credit, so nothing runs live until you add credit or subscribe to a plan.
Some outcomes leave automation and land on a person. A session can sit in In Review or Awaiting User, an AML hit can sit in the review queue, and the Investigator can pause automation at a monthly spending limit. Build your support flow around those states instead of treating every non-Approved status as an error.

Sources
- Didit docs: API Authentication, read November 26, 2026.
- Didit docs: Tokens and JWKS, read November 26, 2026.
- Didit docs: Set up Didit Authentication by API, read November 26, 2026.
- Didit docs: Authentication overview, read November 26, 2026.
- Didit docs: MCP server overview, read November 26, 2026.
- Didit docs: Connect ChatGPT, read November 26, 2026.
- Didit docs: Webhooks, read November 26, 2026.
- Didit docs: Rate limiting, read November 26, 2026.
- Didit docs: API errors, read November 26, 2026.
- Didit pricing and pricing in the docs, read November 26, 2026.
- Didit MCP setup, read November 26, 2026.
Next step: create a free sandbox organization at business.didit.me, generate the sandbox key, and run the session call from step 4. There is no sales call, and every sandbox check is mocked, so the run costs nothing.
Try it
Try this in the sandbox
Run the check this guide describes, free.
The product this post is about, taken from its topic. Run it free in the sandbox.
Author
Alejandro Rosas
Co-founder and CTO

Questions
Frequently asked questions
Does the Didit verification API use OAuth or API keys?
It uses API keys. Every request to verification.didit.me carries a scoped key in the x-api-key header, and the verification API does not use OAuth Bearer tokens. The account host apx.didit.me uses a JWT Bearer token, OAuth 2.1 is used by the hosted MCP server, and Didit Authentication issues its own end-user tokens through an OpenID Connect issuer per application.
How do I send a bearer token to the verification API?
You do not. An Authorization: Bearer header on verification.didit.me will not authenticate a request; the verification API expects x-api-key. Bearer tokens belong to apx.didit.me, where the JWT comes from the programmatic login endpoint, and to Didit Authentication, where your backend exchanges a PKCE code for an access token.
Where do I find my Didit API key?
In the Business Console, pick your Application from the dropdown, open Developers then API keys, and copy the primary key or create a scoped one. You can also get both keys without the console: register, verify the email address, and read application.api_key and sandbox_application.api_key from the response.
What is the difference between a sandbox and a live API key?
Sandbox keys start with sk_test_ and live keys start with sk_live_, followed by 43 URL-safe characters. Every sandbox check is mocked, so you can test the whole flow without spending money. A live key bills per completed check and needs credit on the organization. Keys created before that prefix format exist and keep working.
Why do I get 401 or 403 from verification.didit.me?
A 401 means the x-api-key header is wrong, malformed, revoked or expired; re-fetch the key through the login and application read flow. A 403 means there is no x-api-key header, the scoped key lacks access to that resource or action, or the caller's address is outside the key's IP list. A 403 carrying application_deleted means the application is gone and retrying will not help.
What are API access token best practices?
Keep secrets server-side, issue one credential per service with the least access it needs, and set an expiry and an IP allowlist where you can. Use short-lived access tokens plus refresh tokens for people, long-lived keys only for services, and TLS on every call. Respect Retry-After on 429, log key ids rather than secrets, and rotate immediately when a credential is exposed.
Can I test API token authentication for free?
Yes. The sandbox is free on every plan and every sandbox check is mocked, so you can run registration, key provisioning and session creation without paying. On top of that, Didit Authentication gives the first 50,000 active users each month for free, and the Free plan includes $10.00 of monthly credit for eligible organizations that sign up with a work email.
Does Didit support OAuth 2.0 sign-in for my users?
Didit Authentication is an OpenID Connect issuer per application. It supports the authorization code grant with PKCE S256 and the refresh token grant, signs tokens with ES256, and publishes discovery and JWKS documents for each issuer. Clients are public, so there is no client secret and client_id is your application ID. Sandbox and live are separate issuers with separate keys.
How do I verify a Didit Authentication token?
Read the kid from the token header and verify the ES256 signature against the issuer's JWKS at {issuer}/.well-known/jwks.json. Cache keys by kid; the documents allow a 5 minute cache and keys rotate every 30 days, with the next key published a day early. If a token names a key you do not have, fetch the JWKS again at most once a minute and reject the token if the key is still missing.
How do an AI agent and a CI job authenticate to Didit?
An interactive agent connects to https://mcp.didit.me/mcp, logs in with Didit over OAuth 2.1 with PKCE, and acts with that person's role. An agent with nobody present, in CI or a scheduled job, connects with an application API key instead and acts as that one application. Every MCP client asks the person to review tool calls before they run, which matters because the Didit MCP server is read-and-write.
What happens when I exceed a Didit rate limit?
The API answers 429 with the scope name in the X-RateLimit-Scope header, and the body carries the limit, remaining count, reset time and a support reference. The Retry-After header gives the number of seconds to wait. Treat Retry-After as the floor of your backoff, add jitter, and stop after a small number of attempts so a runaway loop is visible instead of silent. Limits apply per x-api-key, or per IP when no key is sent.
Compliance built in
Audited, certified and attested.
We hold the certifications and build each country's rules into your flows, so you can launch anywhere without worrying. Security and Compliance center
- Regulation encoded into your flows
Tell us what you do and where. Didit lists the rules that apply to you, with sources, and builds the checks each country needs into one workflow.
- Ready for AMLR
Every requirement of the new EU anti-money laundering rules, from checking customers to human review, is already covered by a Didit check.
- Tested in Spain's Treasury sandbox
Spain's Treasury published its supervised sandbox report on Didit's NFC plus active liveness onboarding; SEPBLAC took part and valued the added measures positively.
- Audited, not self-declared
iBeta Level 1 and Level 2. Liveness tested under ISO/IEC 30107-3.
Your obligations · 3 regions
SOC 2 Type 2
ISO 27001
iBeta Level 1 and Level 2
EU regulator attestation
FSM youth protection
GDPR
EBA remote onboarding
MiCA compatible
FIDO Alliance member
- AMLREU AML Regulation ready
Integration · Didit MCP
Run Didit from your own AI agent
Connect Didit to Claude, Cursor, VS Code or ChatGPT and just ask in plain words. Your agent can do anything you can do in the console, with the same permissions you have.
- Build workflowsDescribe the checks you need. The agent creates and publishes the flow.
- Run investigationsAsk why a session was declined, review cases, search people and companies.
- Change rulesCreate payment rules, test them on past data and switch them on.
- Pull reportsAsk for numbers, exports or the audit log.
Didit Academy


