Skip to content
RateStack
API cookbook

Issue and rotate API keys

Create scoped keys, rotate without downtime, revoke quickly. The 30-day overlap pattern.

RTBy RateStack TeamPublishedReviewed
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)

  1. Issue a new key with the same scopes.
  2. Deploy your new key to all services.
  3. Watch the old key’s burndown drop to zero.
  4. 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.

Issue and rotate API keys — API cookbook | RateStack