Skip to main content

POST /api-keys/:keyId/regenerate

This endpoint regenerates an API key. This will invalidate the old key and issue a new one, while keeping the same metadata and permissions.

Path Parameters

keyId
string
required
The ID of the API key to regenerate.

Response

apiKey
string
The new API key. This is the only time it will be shown in full.
metadata
object
The metadata associated with the regenerated key.
regeneratedAt
string
The timestamp for when the key was regenerated.
curl -X POST https://api.llmgenerator.com/api/v1/api-keys/key_xxxxxxxxxxxxx/regenerate \
  -H "Authorization: Bearer YOUR_API_KEY"
{
  "apiKey": "llmgen_new_xxxxxxxxxxxxxxxx",
  "metadata": {
    "name": "Production Key",
    "description": "Used for the main application"
  },
  "regeneratedAt": "2023-10-27T10:00:00Z"
}