Get started · Concept
Authentication and API keys
Authentication is how Provenance knows who is calling: an API key for your code, or a signed-in session for a person in the console. Every request except /health needs one, and each key carries scopes that limit what it can do. This page covers API keys; how people sign in is in Sign-in, two-factor and teams.
When to use it
- Call the API from your backend, scripts or the SDKs: use an API key.
- Work in the console: sign in with a password, Google, GitHub, or your company's single sign-on, as in Sign-in, two-factor and teams.
- Give a service only the access it needs: issue a key with only the scopes it uses.
How it works
- Send a key with every request, as
Authorization: Bearer <key>orX-API-Key: <key>. - Provenance looks it up by hash. It stores only a SHA-256 hash of each key, plus its prefix and last four characters for display, so a key is shown once, when you create it.
- Each endpoint checks a scope. A key without the scope the endpoint needs gets
403insufficient_scope.
A missing key returns 401 authentication_required, and an unknown one 401 invalid_api_key.
Send a key
Both headers work the same way. This lists the keys on the sandbox account:
export PROVENANCE_API=https://sandbox-api.provenanceauth.com
export PROVENANCE_KEY=prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5
curl $PROVENANCE_API/v1/account/keys \
-H "X-API-Key: $PROVENANCE_KEY"
import { Provenance } from "@provenanceauth/sdk";
const prov = new Provenance({ apiKey: process.env.PROVENANCE_KEY!, baseUrl: process.env.PROVENANCE_API });
const keys = await prov.account.keys();
import os
from provenanceauth import Provenance
prov = Provenance(os.environ["PROVENANCE_KEY"], base_url=os.environ["PROVENANCE_API"])
keys = prov.account.keys()
The response, trimmed:
{
"object": "list",
"data": [
{
"object": "api_key",
"key_prefix": "prv_test",
"key_last4": "1kR5",
"name": "Sandbox policy account (Authorize)",
"plan": "growth",
"revoked_at": null
}
],
"has_more": false
}
Keys start prv_test_ in the sandbox and prv_live_ in live; see sandbox and keys for the published sandbox keys.
A key ends in a 6-character checksum, so secret scanners can recognize a Provenance key that leaks. Keys made before the checksum keep working; the console marks them, so you can rotate them. See if a key leaks.
Scopes
| Scope | Lets a key | Required on |
|---|---|---|
mandate | Use Mandate: intents, decisions, grants, revocations and runs | every / route |
authorize | Use Authorize: verifications, checkout approvals, deals and tabs | every / route |
attest | Submit, read and verify Attest claims and attestations, and open capture sessions | every / route |
escalate | Escalate claims, act on cases and create appeal links | the escalation, case and appeal-link routes, with attest |
screen | Run synthetic-media screening | POST /, with attest |
trace | Use Trace: traced inference, traces and the kill switch | every / route |
identify | Use Identify: agent lookups and your traffic policy | every / route |
admin | Manage devices and carrier settings | the device and carrier settings routes |
all_ | Act with every product scope above for the products your account has, never admin (All products key) | stands in for each product's scope |
Each product's scope is required on every route of that product: a key without it gets 403 insufficient_scope, even when its account has the product. A route under a product also needs that product on the key's account, or it answers 403 product_not_enabled first.
Each product's policies take that product's scope, so a key saves only the policies of the products it covers:
| Policy | Scope a key needs to change it |
|---|---|
Agent policy, its lists, webhooks and approver groups (/, /) | mandate |
Checkout rules (/) | authorize |
Claims risk policy (/) | attest |
Traffic policy (/) | identify |
Approval expiry default (/) | authorize or mandate |
Policy migrations (POST /) | the scope of each policy it replays (mandate, authorize or attest); with no system, a key runs only what its scopes cover and lists the rest in skipped |
A person in the console needs the Manage policies permission instead (who can change a policy).
Keyless public routes (POST /v1/verify, the JWKS, the public registry and directory reads, and the publishable-key embed routes) take no key, and a person signed in to the console acts as the account. A risk provider's push key carries only risk_signals:write and sends verdicts to POST /v1/mandate/risk_signals.
Give each integration only the scopes it uses: a merchant's checkout needs only authorize. A key on a self-serve account also carries its account's plan; see plans and usage.
Create a key for your products
A secret key is one of two kinds:
| Kind | What it reaches |
|---|---|
| All products (standard) | Every product your account has, now and later. A product you add later works at once, and one you remove stops at once. The key you get at sign-up is one. |
| Restricted | Only the products you tick. Use one for each service that needs only part of the API. |
Neither kind gets admin, and an All products key never gets a risk provider's push scope. A sign-up key made before All products keys existed (2026-11-16) is a restricted key for Mandate, Authorize, Trace and Identify; create an All products key to replace it if you want one. An All products key's scopes are worked out on each request from your account's products, and its scopes read all_products. A product your account doesn't have answers 403 product_not_enabled for both kinds.
Create a secret key under Developers → API keys → Create key: name it, then tick All products, or tick the products it's for. The sheet lists only the products your account has, and a restricted key gets only those products' scopes. A restricted key can be for one product or several.
| Product | The key gets |
|---|---|
| Identify | identify |
| Authorize | authorize |
| Attest | attest, escalate and screen, and your account's own carrier |
| Mandate | mandate |
| Trace | trace |
Scripts call POST / with a name and either the products, such as { "name": "Agent server", "products": ["mandate", "authorize"] }, or { "name": "Server", "all_products": true } for an All products key. A product your account doesn't have answers 400 parameter_invalid, and no key is made. The response and the key list say what each key covers. An All products key gets your account's own carrier, so it works in Attest whenever your account has Attest.
A script makes and revokes keys with an All products key. A key limited to some products can only revoke itself.
The older single product field still works: "product": "authorize" makes the older self-serve key, with the Mandate, Authorize, Trace and Identify scopes for each of those products your account has.
productsarray- On a new key, the products it covers. For an All products key, your account's products at that moment.
all_productsboolean- Whether the key covers every product your account has, now and later.
scopesarray- What the key can do, or
all_productsfor an All products key.
No key from the console gets admin. Browsers and apps use a publishable key instead, from the Publishable tab (embeds); it renders your embeds and never reads your data.
Rotate a key
To replace a key, create the new one in the console under Developers → API keys, deploy it, then revoke the old one. POST / does both in one call: it revokes the key you call it with and returns the replacement once. A revoked key returns 401 api_key_revoked, and an expired one 401 api_key_expired.
Provenance can't recover a lost key, because it never stores the key itself. Revoke it and create a new one.
Revoke a key
To stop a key without a replacement (it leaked, or nothing uses it any more), choose Revoke on its row under Developers → API keys, or call POST / with the key's id from the key list and an optional reason. The key's next request answers 401 api_key_revoked. Revoking can't be undone.
- Owners and admins can revoke a key. A person with two-factor sign-in confirms a second factor first.
- You can revoke the key you call with; that request is its last. The console signs in without keys, so revoking every key never locks you out: sign in and create a new one.
- Revoking a key that is already revoked changes nothing and answers with
already_revoked: true. - Each revocation is written to the account's security events (
GET /v1/org/security_events) and sends theapi_key.revokedwebhook.