Authentication and API keys
Every request to the Verify API is authenticated with an API key. A key belongs to one project and carries its own permissions.
Sending the key
Send the key in one of two headers:
Authorization: Bearer <your-key>
x-api-key: <your-key>The Bearer scheme name is not case sensitive. If a request carries an Authorization header that starts with Bearer, Verify reads the key from it. Otherwise it reads the x-api-key header. Keep the key on your server. Do not put it in browser code, a URL or a log.
Creating a key
In the console, open your project, then Developers, then API keys. When you create a key you choose:
- a name, up to 80 characters;
- the access the key has to each resource (see Permissions below);
- an optional expiry, in whole days.
The full key is shown once, when you create it or rotate it. Copy it then. Verify keeps only a SHA-256 hash of the key, so the key cannot be shown again. A key begins with mi_live_ followed by random characters.
Rotating and revoking
Rotating a key issues a new secret for the same key. The old secret stops working at once. Revoking a key stops it working. A revoked key is refused with 401 and Invalid API key.
Permissions
The console lists eleven resources: sessions, decisions, media, people, companies, transactions, workflows, webhooks, application settings, analytics and API keys. Each one is set to none, read or write. The API uses two of them:
| Resource | Access needed | Endpoints |
|---|---|---|
sessions | write to create, read to list | POST /api/v1/sessions, GET /api/v1/sessions |
decisions | read | GET /api/v1/sessions/{sessionId} |
The console offers a Full access preset, which gives write access to every resource except media and analytics (read only), and a Read only preset. You can also choose each resource yourself. Give each key only the access its job needs.
Expiry
A key can be set to expire after a number of whole days. An expired key is refused with 401 and API key expired.
Environment
A key belongs to one project. Whether a project runs in the sandbox or the live environment is a setting of the project, not of the key. See Billing for what each environment charges.
Errors
A request without a usable key is refused:
401withMissing API keywhen no key is sent.401withInvalid API keywhen the key does not match an active key. This includes a revoked key.401withAPI key expiredwhen the key has passed its expiry.403withAPI key lacks <access> access to <resource>, for exampleAPI key lacks 'write' access to 'sessions', when the key exists but its access does not allow the request.
The rate limit is checked before the key. See Rate limits.