Skip to main content

POST /api-keys

This endpoint creates a new API key for the authenticated user.

Request Body

name
string
required
A descriptive name for the API key.
description
string
A description of what the key will be used for.
permissions
array
A list of permissions to grant to the key.
expiresAt
string
An optional expiration date for the key in ISO 8601 format.

Response

apiKey
string
The newly created API key. This is the only time the key will be shown in full.
id
string
The unique identifier for the API key.
metadata
object
An object containing the key’s metadata.
curl -X POST https://api.llmgenerator.com/api/v1/api-keys \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
        "name": "New Production Key",
        "description": "For the new service integration"
      }'
{
  "apiKey": "llmgen_xxxxxxxxxxxxxxxxxxxxxxxx",
  "id": "key_zzzzzzzzzzzzz",
  "metadata": {
    "name": "New Production Key",
    "description": "For the new service integration",
    "permissions": ["generate", "sites:read"],
    "expiresAt": null
  }
}