Rex uses API keys for programmatic access and Clerk JWT tokens for the web UI. This page covers API key authentication — the method used by integrations, scripts, and AI agents.
Every API request must include a key in the X-Api-Key header:
curl https://acme.rexgtm.com/contacts \
-H "X-Api-Key: rex_live_abc123..."
API keys use the prefix rex_live_ for production and rex_test_ for sandbox environments. The full key is shown once at creation — store it securely. Only the last 4 characters are visible afterward.
| Scope | Permissions | Use case |
|---|---|---|
read | GET endpoints only | Dashboards, reporting, AI agents that only query |
read-write | Full CRUD on all endpoints | Integrations, automations, admin scripts |
capture-only | Only POST /capture | Landing page forms, public lead capture |
Choose the narrowest scope that fits your use case. Give AI agents read keys unless they need to modify data.
Create, view, and revoke keys in Settings > API Keys or via the API:
# Create a new key
curl -X POST "$REX_URL/apikeys" \
-H "X-Api-Key: $REX_API_KEY" \
-H "Content-Type: application/json" \
-d '{"name": "Claude Agent", "scope": "read"}'
# List keys (shows last 4 chars only)
curl "$REX_URL/apikeys" \
-H "X-Api-Key: $REX_API_KEY"
# Revoke a key
curl -X DELETE "$REX_URL/apikeys/key_01HQ..." \
-H "X-Api-Key: $REX_API_KEY"
Revocation is immediate — the revoked key fails on the next request.
Requests are rate-limited per API key using a token bucket algorithm:
| Limit | Value |
|---|---|
| Requests per minute | 1,000 |
| Burst allowance | Short bursts above the per-minute limit are tolerated |
Every response includes rate limit headers:
X-RateLimit-Limit: 1000
X-RateLimit-Remaining: 994
X-RateLimit-Reset: 1710590460
When you exceed the limit, you receive a 429 Too Many Requests response with a Retry-After header:
{
"error": {
"code": "rate_limit_exceeded",
"message": "Rate limit exceeded. Retry after 12 seconds."
}
}
X-RateLimit-Remaining before making burst requestsRetry-After headers — don't retry immediatelyread scope keys for agents that don't need write access (they share the same limits, but it's a good security practice)