Skip to content

keys.create

Create a key. The value is shown once.

Authentication

This endpoint requires a valid user session token. If you do not yet have an API key, obtain a session token by logging in first and pass it as a Bearer token in the Authorization header.

Step 1 — Log in to get a session token

Terminal window
curl -X POST https://api.decibyl.ai/api/v1/auth/login \
-H "Content-Type: application/json" \
-d '{"email": "you@example.com", "password": "your-password"}'

The response contains a token field. Use it in the next step.

Step 2 — Create an API key

Terminal window
curl -X POST https://api.decibyl.ai/api/v1/users/api-keys \
-H "Authorization: Bearer <token>" \
-H "Content-Type: application/json" \
-d '{"name": "my-api-key"}'

Once you have an API key, you can use X-API-Key: <key> in place of Authorization: Bearer for all subsequent requests.

Reference

POST/api/v1/users/api-keys

Auth
API key in X-API-Key
Content
application/json
Returns
200 · CreateAPIKeyResponse

Create a new API key for the user's selected organization.

Arguments

ArgumentInTypeRequiredDescription
namebodystringrequired
environmentbody"production" | "sandbox"default "production"

Example request

curl -X POST "https://api.decibyl.ai/api/v1/users/api-keys" \
  -H "X-API-Key: dcb_your_key" \
  -H "Content-Type: application/json" \
  -d '{"name":"string","environment":"production"}'

Response

{
  "id": 1,
  "name": "string",
  "key_prefix": "string",
  "environment": "production",
  "api_key": "string",
  "created_at": "2026-09-14T09:30:00Z"
}

Errors

StatusWhen
404Not found
422Validation Error