Skip to main content
DRIFTSTACK

API keys

Customer API keys are how code authenticates to Driftstack on a paid tier, including any Manual tier. Each key carries a fixed scope set; pick the narrowest scope that fits the integration's purpose.

Free uses browser sign-in in the desktop app. That flow stores a restricted ds_test_… device credential automatically; it is not a customer API key, a general SDK key, or a sandbox credential.

Minting a key

On a paid tier, open the dashboard → Settings → API keys → Create. You'll see the full plaintext key once — copy it now and store it in your config / secret manager. We only store the hash; if you lose the plaintext, revoke and mint a new one.

Customer-key format: ds_live_<random>. The ds_live_ prefix is how Driftstack detects "this looks like an API key" during request parsing.

A Free dashboard web session can list and revoke keys retained from before a downgrade, but create and rotate return an RFC 9457 403 Forbidden. Existing ordinary keys are rejected while the account is Free and work again after an upgrade unless revoked or expired.

Scopes

Each key carries one or more scopes. Driftstack offers two shapes:

Broad scopes (most common)

ScopeGrants
readRead sessions and profiles.
writeMutate sessions and profiles. Does NOT include billing.
account_ownerRead-write across the whole account, including billing and team management.

Granular scopes (verb:resource)

For tighter least-privilege integrations:

ScopeGrants
read:sessionsRead session metadata + history.
write:sessionsStart + stop sessions.
read:profilesRead browser-profile metadata.
write:profilesMutate profiles.
admin:profilesReserved — no route enforces it; profile writes use write:profiles.
read:webhooksList webhook endpoints + delivery history.
write:webhooksReserved — endpoint management requires account_owner.
admin:webhooksReserved — secret rotation and deletion require account_owner.
read:api-keysList the account's API keys (metadata only).
admin:api-keysReserved — minting and revoking require account_owner.
read:billingRead invoices, usage, and crypto-order history.
admin:billingInitiate checkout sessions + manage subscriptions.
read:auditRead the account audit log.

Broad scopes satisfy the corresponding granular scopes on the same verb. A key with read can call any endpoint that requires read:sessions, but a key with only read:sessions cannot call endpoints that require read:profiles.

Using a key

On an API-enabled paid tier, use bearer-token auth:

Authorization: Bearer ds_live_…

Every authenticated response carries rate-limit headers (see /docs/rate-limits). Watch them; they'll save you a 429 down the line.

Rotating a key

Routine hygiene: rotate any production key at least every 90 days. The flow:

  1. Mint a new key with the same scope set as the old one.
  2. Deploy the new key to your environment.
  3. Verify your production traffic is using the new key. The API Keys page shows each key's last_used_at, so you can confirm the successor is active and the old key has stopped advancing.
  4. Revoke the old key from the dashboard.

If a key leaks

Immediately revoke the key from the dashboard. Effects:

Email [email protected] if the leak resulted in unauthorized activity — we'll help audit the account.

How many keys should I have?

API key metadata in audit logs

An API-key-authenticated audit entry carries the acting actor_key_id. Dashboard-session and system entries can carry actor_key_id: null; the public field is not named api_key_id. View the audit log in the dashboard or via GET /v1/account/audit-log.

FAQ

Can I view a key's plaintext after creation?
No. We only store the hash; the plaintext is shown once on creation. If you lost it, revoke and mint a new one.
What happens if I use the same key from two regions simultaneously?
Fine — keys aren't bound to a region. Rate limits are per-account, so the two regions share the bucket budget.
Can I scope a key to a specific session id?
No. API-key authorization uses verb:resource scopes (e.g. read:sessions).

Support

Email [email protected].