Skip to main content
Relay uses API keys to authenticate requests. Include your API key in the X-API-Key header of every request.

API key basics

API keys are tied to your tenant account and have full access to all resources within that account. Each key has:
  • Name: A label to identify the key’s purpose
  • Prefix: First 8 characters shown for identification (e.g., rl_live_a1b2...)
  • Scopes: Optional permission restrictions (coming soon)
  • Expiration: Optional expiration date

Creating API keys

Via the dashboard

  1. Sign in to app.relayai.dev
  2. Navigate to Settings > API Keys
  3. Click Create API Key
  4. Enter a descriptive name (e.g., “Production Server”, “CI/CD Pipeline”)
  5. Copy the key immediately
API keys are only displayed once when created. Store your key securely before closing the dialog.

Via the API

Create keys programmatically using an existing key:
Response:
The full key value is only returned on creation. Store it securely.

Using API keys

Include the key in the X-API-Key header:

Listing API keys

View all keys for your account:
Response:

Revoking API keys

Revoke a key to immediately invalidate it:
Revoked keys cannot be restored. Any requests using a revoked key will receive a 401 Unauthorized response.

Security best practices

Environment variables

Never hardcode API keys in your source code. Use environment variables:
Python

Git ignore

Add API key files to your .gitignore:
.gitignore

Rotate keys regularly

Create new keys periodically and revoke old ones:
  1. Create a new key
  2. Update your applications to use the new key
  3. Verify everything works
  4. Revoke the old key

Use descriptive names

Name keys by their purpose to make auditing easier:
  • “Production API Server”
  • “CI/CD Pipeline”
  • “Local Development - John’s Laptop”
  • “Monitoring Service”

Set expiration dates

For temporary or time-limited access, set an expiration:

Error responses

401 Unauthorized

Returned when:
  • No X-API-Key header is provided
  • The API key is invalid or revoked
  • The API key has expired

Troubleshooting