Skip to main content
ARouter uses two distinct types of API keys with different permissions:
Key TypePrefixPurpose
Standard API Keylr_live_...LLM inference, all /v1/* endpoints
Management API Keylr_admin_...Key management, /api/v1/keys/* endpoints only
Management keys cannot call /v1/chat/completions or other inference endpoints. Standard keys cannot manage other keys.

Creating a Management API Key

  1. Go to ARouter Dashboard
  2. Click New Key
  3. Select Management Key type
  4. Copy the key — it’s shown only once

Use Cases

Management keys are designed for:
  • CI/CD pipelines that rotate application keys on deployment
  • Key provisioning services that create per-user or per-tenant keys
  • Admin scripts that audit or clean up unused keys
  • Terraform / infrastructure-as-code that manages key lifecycle

Key Management Endpoints

All management endpoints require a Management API key:

List Keys

curl https://api.arouter.ai/api/v1/keys \
  -H "Authorization: Bearer lr_admin_xxxx"
{
  "data": [
    {
      "hash": "abc123...",
      "name": "production-app",
      "label": "Production",
      "created_at": "2026-01-01T00:00:00Z",
      "last_used_at": "2026-04-01T12:00:00Z",
      "usage": {"prompt_tokens": 1500000, "completion_tokens": 450000, "cost": 12.50},
      "limit_usd": 100.0,
      "rate_limit": {"requests_per_minute": 100}
    }
  ]
}

Create a Key

curl -X POST https://api.arouter.ai/api/v1/keys \
  -H "Authorization: Bearer lr_admin_xxxx" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "staging-app",
    "label": "Staging",
    "limit_usd": 25.0,
    "allowed_models": ["openai/gpt-5.4", "anthropic/claude-sonnet-4.6"]
  }'
Response:
{
  "key": "lr_live_xxxx...",
  "hash": "def456...",
  "name": "staging-app"
}
The key value is returned only once at creation time. Store it securely — it cannot be retrieved again.

Update a Key

curl -X PATCH https://api.arouter.ai/api/v1/keys/{key_hash} \
  -H "Authorization: Bearer lr_admin_xxxx" \
  -H "Content-Type: application/json" \
  -d '{
    "label": "Staging (v2)",
    "limit_usd": 50.0
  }'

Delete a Key

curl -X DELETE https://api.arouter.ai/api/v1/keys/{key_hash} \
  -H "Authorization: Bearer lr_admin_xxxx"
{"deleted": true, "hash": "def456..."}

Key Object Reference

FieldTypeDescription
hashstringUnique key identifier (safe to store, not the key itself)
namestringInternal name for your reference
labelstringDisplay label shown in Dashboard
created_atstringISO 8601 creation timestamp
last_used_atstringISO 8601 timestamp of last use
usage.prompt_tokensintegerCumulative prompt tokens
usage.completion_tokensintegerCumulative completion tokens
usage.costnumberCumulative cost in USD
limit_usdnumber|nullSpending limit. null = unlimited.
rate_limit.requests_per_minuteinteger|nullRPM limit. null = unlimited.
allowed_modelsstring[]|nullModel allow-list. null = all models allowed.
allowed_providersstring[]|nullProvider allow-list. null = all providers allowed.

Automated Key Rotation

See API Key Rotation for a complete guide to zero-downtime key rotation using Management keys.