Skip to main content

Authentication

All API requests must be authenticated.

API Keys

Get your API key from the dashboard.

Key Types

TypePrefixAccess
Secret (Live)sk_live_Full access, production
Secret (Test)sk_test_Full access, test environment
Public (Live)pk_live_Read-only, client-safe
Public (Test)pk_test_Read-only, test environment

Using API Keys

curl https://recall.brainzlab.ai/api/v1/logs \
  -H "Authorization: Bearer sk_live_xxxxxxxx"

X-API-Key Header

curl https://recall.brainzlab.ai/api/v1/logs \
  -H "X-API-Key: sk_live_xxxxxxxx"

Query Parameter

Not recommended. Keys may be logged in server access logs.
curl "https://recall.brainzlab.ai/api/v1/logs?api_key=sk_live_xxx"

Key Security

Never expose secret keys in client-side code!

Best Practices

  1. Use environment variables - Don’t hardcode keys
  2. Rotate regularly - Generate new keys periodically
  3. Use test keys - For development and testing
  4. Limit scope - Use read-only keys where possible

Revoking Keys

  1. Go to Dashboard > Settings > API Keys
  2. Click “Revoke” on the key
  3. Generate a new key
Revoked keys stop working immediately.

Service Tokens

For server-to-server communication between Brainz Lab services:
curl https://recall.brainzlab.ai/internal/api/v1/... \
  -H "X-Service-Token: srv_xxxxxxxx"
Service tokens are only used for self-hosted deployments.

Error Responses

Invalid Key

{
  "error": {
    "code": "invalid_api_key",
    "message": "The API key provided is invalid"
  }
}

Missing Key

{
  "error": {
    "code": "missing_api_key",
    "message": "No API key was provided"
  }
}

Expired Key

{
  "error": {
    "code": "expired_api_key",
    "message": "This API key has been revoked"
  }
}