Skip to main content

Endpoint

POST /api-keys/create
Auth: API Key or Session
Content-Type: application/json
The full API key is only returned once at creation time. Store it securely — it cannot be retrieved again.

Body parameters

name
string
A human-readable label to identify this key.production · staging · ci-deploy
expiresIn
number
Expiration time in seconds from now. Defaults to 365 days (31536000).86400 (1 day) · 2592000 (30 days) · 31536000 (1 year)

Response

{
  "success": true,
  "apiKey": {
    "id": "key_abc123",
    "key": "oink_xxxxxxxxxxxxxxxxxxxxxxxxxxxx",
    "name": "production",
    "start": "oink_xxx",
    "createdAt": "2024-03-15T10:30:00.000Z",
    "expiresAt": "2025-03-15T10:30:00.000Z"
  },
  "message": "API key created successfully"
}
success
boolean
Whether the key was created.
apiKey
object
Status codes: 200 success · 401 unauthorized · 500 error

Example

curl -X POST http://localhost:3000/api-keys/create \
  -H "Authorization: Bearer <api_key>" \
  -H "Content-Type: application/json" \
  -d '{"name": "production", "expiresIn": 31536000}'

List API Keys

View all active keys.

Delete API Key

Revoke a key.