API cookbook
Issue and rotate API keys
Create scoped keys, rotate without downtime, revoke quickly. The 30-day overlap pattern.
beginnercURL · Bash
Issue
curl -fsS -X POST https://api.ratestack.com/v1/api-keys \
-H "X-API-Key: $ADMIN_KEY" \
-H "Content-Type: application/json" \
-d '{ "name": "production-api-2026-Q2", "scopes": ["WRITE"] }'
# Response includes plaintext key — only shown once.
{ "id": "key_8a7c4f", "key": "rsk_live_3K7...", "scopes": ["WRITE"], "createdAt": "..." }Rotate (zero-downtime)
- Issue a new key with the same scopes.
- Deploy your new key to all services.
- Watch the old key’s burndown drop to zero.
- Revoke the old key.
# Revoke the old key
curl -fsS -X DELETE https://api.ratestack.com/v1/api-keys/$OLD_KEY_ID \
-H "X-API-Key: $ADMIN_KEY"Emergency revocation
If a key is compromised, revoke immediately — the service is back to a consistent state in under a second across replicas. Re-issue, redeploy, done.