Create API key
post
https://api.intelig.ai/api/v1/intelig/api-keys
Auth: Authorization: ApiKey <key> (an API key sent as
Bearer is rejected) or Authorization: Bearer <jwt>
for a dashboard session. operationId: createApiKey
Creates a new API key with specified scopes. The full key is returned only once.
Example request
curl -X POST "https://api.intelig.ai/api/v1/intelig/api-keys" \
-H "Authorization: ApiKey $INTELIG_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"name": "tree-inventory-ai integration",
"scopes": [
"strategy:read",
"strategy:write",
"code:read"
],
"expiresAt": "2027-01-01T00:00:00Z"
}' Request body
application/json
| Field | Type | Required | Description |
|---|---|---|---|
name | string | yes | Human-readable label for the key, so you can tell keys apart when revoking one. Example: tree-inventory-ai integration |
scopes | string[] | yes | Scopes granted to the key. A request outside the granted scopes is rejected with 403. Grant the narrowest set the integration needs. Example: ["strategy:read","strategy:write","code:read"] |
expiresAt | string (date-time) | no | Optional expiry instant (ISO-8601, UTC). Omit for a key that never expires. Example: 2027-01-01T00:00:00Z |
Response 201
application/json · ApiResponseCreateApiKeyResponseDto
| Field | Type | Description |
|---|---|---|
success | boolean | — |
message | string | — |
data | CreateApiKeyResponseDto | — |
Status codes
201— API key created successfully400— Invalid request or max keys reached401— User is not authenticated403— User does not have access to requested scopes409— API key with this name already exists429— —
Every response is wrapped in { success, message, data }. A 4xx means the request
is wrong — do not retry it unchanged. A 429 carries Retry-After in seconds.