Authbound uses separate keys for server and browser code. Verification flows also need a built-in preset ID or a custom policy ID from your project.
| Value | Example | Use it from |
|---|
| Secret key | sk_test_... | Server only. Creates verifications and credential offers. |
| Publishable key | pk_test_... | Browser safe. Scopes status checks for a single project. |
| Client token | Returned per verification | Browser safe. Authorizes status for one verification. |
| Policy ID | YOUR_POLICY_ID | Server route and browser UI. Identifies what the wallet must prove. |
Never expose a secret key in browser code, mobile apps, logs, or client-accessible configuration.
API URL
Every request goes to the API URL for your key’s mode. Every guide sets it as AUTHBOUND_API_URL:
| Key | API URL |
|---|
Test (sk_test_..., pk_test_...) | https://sandbox-check.authbound.io |
Live (sk_live_..., pk_live_...) | Your live API URL, which you receive with your live secret key |
The test API accepts test keys only. Always set the URL explicitly. Without it, the SDKs send requests to their built-in default, https://api.authbound.io, which doesn’t know your test keys and answers 401 with invalid_key.
Set the same URL on the server and in the browser:
| Where | Setting |
|---|
| Server environment | AUTHBOUND_API_URL |
AuthboundClient, createAuthboundHandlers, createAuthboundRouter and createAuthboundApp | apiUrl: process.env.AUTHBOUND_API_URL |
The single-route helpers in @authbound/nextjs/server, such as createVerificationRoute | gatewayUrl: process.env.AUTHBOUND_API_URL |
| Nuxt module server routes | Read AUTHBOUND_API_URL from the environment |
| Next.js browser code | NEXT_PUBLIC_AUTHBOUND_API_URL, passed as gatewayUrl on AuthboundProvider |
| React or Vue with Vite | VITE_AUTHBOUND_API_URL, passed as gatewayUrl on AuthboundProvider or AuthboundPlugin |
| curl and other REST clients | $AUTHBOUND_API_URL in front of the path, such as $AUTHBOUND_API_URL/v1/verifications |
Signed results carry the host you read them from as their issuer, so verify a result with the same AUTHBOUND_API_URL you read it with.
1. Copy keys and choose a policy ID
Open your project in the Authbound dashboard and go to API Keys. Then:
- create a secret key, which starts with
sk_test_
- copy the publishable key, which starts with
pk_test_
If you already received keys, use those. Don’t have access yet? Contact us.
Then choose a policy. The guides start with the built-in preset pol_identity_basic_eudi_v1, which asks for a name and date of birth. Policies lists every preset, and Test with a wallet says which policy a test wallet can answer. To ask for something else, create a policy on your project’s Policies page and copy its ID.
Use the same policy ID on the server and in the browser.
Secret keys are shown once when created. Save the value before closing the dialog; create a replacement key if it was not saved. Keep secret and publishable keys in the same project and environment.
The dashboard creates test keys. When your test flow works end to end, contact us to go live. You’ll receive your live secret key and your live API URL together.
Policy builder
Create a policy from your project’s Policies page. Start from a task, or use the advanced custom builder. Review the fields and requirements before saving: every selected field is required and returned to your API. Open the saved policy to inspect its requirements and copy its ID.
2. Add server environment variables
AUTHBOUND_SECRET_KEY=sk_test_...
AUTHBOUND_SESSION_SECRET=replace-with-a-random-32-byte-secret
AUTHBOUND_WEBHOOK_SECRET=whsec_...
AUTHBOUND_POLICY_ID=pol_identity_basic_eudi_v1
AUTHBOUND_API_URL=https://sandbox-check.authbound.io
AUTHBOUND_API_URL is the API URL for your key’s mode. Pass it explicitly to every server helper.
AUTHBOUND_SESSION_SECRET encrypts the HttpOnly SDK session cookie used by framework route helpers. Use at least 32 random bytes.
AUTHBOUND_WEBHOOK_SECRET verifies webhook signatures from Authbound. You need it when your app receives webhook events, such as /api/authbound/webhook in Next.js or Nuxt, or /api/authbound/callback for Express or Hono mounted at /api/authbound.
Built-in presets don’t appear in your project’s policy list. Custom policies belong to your project; create them on the Policies page and copy their IDs there.
3. Add browser environment variables
Use the prefix expected by your framework.
NEXT_PUBLIC_AUTHBOUND_PK=pk_test_...
NEXT_PUBLIC_AUTHBOUND_POLICY_ID=pol_identity_basic_eudi_v1
NEXT_PUBLIC_AUTHBOUND_API_URL=https://sandbox-check.authbound.io
The Nuxt module has no browser setting for the API URL yet; see the Nuxt quickstart.
4. Use the right auth method
Each credential has one job:
| Credential | Sent as | Used for |
|---|
| Secret key | X-Authbound-Key: sk_test_... | Every server call: creating, reading and canceling verifications, reading results. |
| Publishable key | X-Authbound-Publishable-Key: pk_test_... | Browser status checks. It names your project and environment. In a browser, it works only from an allowed origin. |
| Client token | Authorization: Bearer <clientToken> | Browser status checks for the one verification that returned it. It lasts as long as the verification. |
Send the secret key in X-Authbound-Key. The API also accepts it as Authorization: Bearer sk_.... The API answers a missing key, a publishable key or a client token in its place, and a revoked key with 401 and code invalid_api_key, and its message says which mistake it saw. Troubleshooting lists each mistake and what it returns.
Browser status checks send the client token and the publishable key together:
Authorization: Bearer <clientToken>
X-Authbound-Publishable-Key: pk_test_...
The Authbound browser SDKs send these headers for you.
Secret keys are scoped. Keys you create in the dashboard carry verifications:write, which creating and canceling verifications requires, and verifications:read, which reading verifications and their results requires. Accounts with issuance also get issuer:read and issuer:write. Dashboard keys can’t manage policies or webhook endpoints. Create those on your project’s Policies and Webhooks pages instead. A key without the scope a call needs gets 403 with code insufficient_scope.
5. Allow browser origins
Browser status requests carry your publishable key. Authbound accepts them only from origins you allow. The browser asks first with a CORS preflight, and Authbound refuses the preflight for any other origin with 403 origin_not_allowed. Your code sees a CORS error, and the browser’s network panel shows the 403.
Add the origin of each site that runs the browser SDK, such as https://shop.example.com, under Allowed origins on your project’s API Keys page. One list covers every environment of the project.
- An origin is a scheme, a host and an optional port, with no path.
- It must use HTTPS. Plain HTTP works only for
localhost and 127.0.0.1.
- Test keys also work from
localhost and 127.0.0.1 on any port without being listed. Live keys work only from listed origins.
Self-hosted installations
If you run Authbound in your own infrastructure, your installation’s admin API holds the same settings. GET /admin/v1/projects/{project_id} returns the project’s publishable keys in publishable_keys, one per environment. To allow an origin, call the admin API with an organization admin token:
curl -X POST "$ADMIN_API_URL/admin/v1/projects/$PROJECT_ID/allowed-origins" \
-H "Authorization: Bearer $ADMIN_TOKEN" \
-H "Content-Type: application/json" \
-d '{"origin": "https://shop.example.com"}'
An origin that’s already allowed returns 409. GET on the same path lists the project’s origins, and DELETE /admin/v1/projects/{project_id}/allowed-origins/{origin_id} removes one.