Skip to main content
Every request to the AuditRails API must be authenticated using an API key passed as a Bearer token in the Authorization header. Keys are scoped by environment — live keys write to your production audit chain and count against your plan limits, while test keys use a separate free-tier pool and are safe to use during development and CI.

Obtaining an API Key

You create and manage API keys from your AuditRails dashboard. Keys are displayed only once at creation time and are stored as a one-way hash — if you lose a key, revoke it and create a new one. Dashboard → API Keys → Create API Key
Copy your API key immediately after creation. AuditRails cannot show it to you again after you close the creation dialog. Store it in a secrets manager (e.g. AWS Secrets Manager, HashiCorp Vault) and never commit it to source control.

Key Types

AuditRails issues two distinct key prefixes with different behaviors:
Never use at_test_ keys to handle production traffic. The test-key pool is shared across all customers and is not covered by uptime SLAs.

Sending the Authorization Header

Pass your API key as a Bearer token in every request:
The header must be formatted exactly as shown — the word Bearer (capital B), a single space, then your key. No other authentication schemes (Basic, API-Key header, query-string tokens) are accepted.

Authentication Errors

All authentication failures return HTTP 401 Unauthorized with a structured error body. The code field tells you exactly what went wrong: Example 401 response:
The request_id in every error body matches the X-Request-Id response header. Include it when contacting AuditRails support — it lets the team look up the exact request in server-side logs.

Security Best Practices

  • Rotate keys regularly. Use the dashboard to revoke old keys and issue new ones on a schedule that fits your security policy.
  • Use separate keys per service. Issuing one key per application or microservice limits blast radius if a key is compromised.
  • Set expiry dates. For short-lived jobs (e.g. batch migrations), create a key with a tight expiry window.
  • Never expose keys client-side. API keys must only be used from server-to-server calls. If you need to log events from a browser, proxy requests through your own backend.
  • Monitor for unexpected usage. The AuditRails dashboard shows per-key request counts — an unusual spike can indicate a leaked key.