API Keys

Create and manage the keys used to authenticate every other request.

GET/api/auth/api-keys

List API keys

Never returns full key values — only a masked preview.

Response 200

{
  "data": [
    {
      "id": "k1a2b3c4-...",
      "name": "production-backend",
      "key_preview": "cmd_ab12cd34...",
      "permissions": [
        "emails:send",
        "emails:read"
      ],
      "is_active": true,
      "created_at": "2026-08-01T12:00:00.000Z",
      "last_used": "2026-08-02T09:15:00.000Z"
    }
  ]
}
POST/api/auth/api-keys

Create an API key

Body

ParameterDescription
name
stringrequired
A label to identify the key later.
permissions
('emails:send' | 'emails:read')[]
Defaults to both.

Response 201

{
  "id": "k1a2b3c4-...",
  "name": "production-backend",
  "key": "cmd_ab12cd34ef56...",
  "key_preview": "cmd_ab12cd34...",
  "permissions": [
    "emails:send",
    "emails:read"
  ],
  "is_active": true,
  "created_at": "2026-08-01T12:00:00.000Z"
}

The key field is only ever returned on creation.

DELETE/api/auth/api-keys/:id

Revoke an API key

Takes effect immediately. Returns 204 with no body.