Update API Key

Update mutable API key fields.

PATCH/v1/customer/api-keys/{id}

Request Parameters

NameTypeRequiredDescription
id
string (UUID)RequiredAPI key identifier.
name
stringNew key name.
expires_at
string (ISO-8601) | nullSet/update expiration time, or null to clear.

Request Example

bash
curl -X PATCH https://api.therouter.ai/v1/customer/api-keys/4d953cc1-b4d5-45fd-9d51-0f0a6e2ec7d8
  -H "Authorization: Bearer $THEROUTER_API_KEY"
  -H "Content-Type: application/json"
  -d '{
    "name": "backend-rotated",
    "expires_at": "2026-06-01T00:00:00.000Z"
  }'

Response

json
{
  "id": "4d953cc1-b4d5-45fd-9d51-0f0a6e2ec7d8",
  "name": "backend-rotated",
  "key_preview": "a8c9X2zQ",
  "expires_at": "2026-06-01T00:00:00.000Z",
  "is_active": true,
  "status": "active",
  "usage": {
    "request_count": 241,
    "total_spend": 12.441
  },
  "last_used_at": "2026-02-26T08:11:00.000Z",
  "created_at": "2026-02-20T08:30:00.000Z",
  "updated_at": "2026-02-26T08:42:00.000Z"
}
Notes
This endpoint supports name and expires_at. It does not accept is_active or rate_limit_per_minute.