API Keys / Tokens
POST
/v1/orgs/{org_id}/tokens/adminCreate Admin Token
Create an org-level admin token.
Admin tokenscope: org:adminoperation_id: tokens.createAdmin
Authentication
Create via POST /v1/orgs/{org_id}/tokens/admin. Org-wide scope — keep tightly held.
SDK install
pip install znyx-sdknpm install @znyx/sdkPath parameters
| Name | Type | Required | Description |
|---|---|---|---|
| org_id#path | string | required | — |
Header parameters
| Name | Type | Required | Description |
|---|---|---|---|
| X-API-Key#header | string | null | optional | — |
| authorization#header | string | null | optional | — |
Request bodyrequired
| Field | Type | Required | Description |
|---|---|---|---|
| expires_in_days | integer | optional | — |
Responses
| Status | Description |
|---|---|
| 201 | Successful Response |
| 422 | Validation Error |
Response schema
idrequiredinteger
key_prefixrequiredstring
key_typerequiredstring
org_idstring | null
project_idstring | null
environment_idstring | null
scopesstring[]
is_activerequiredboolean
expires_atstring | null
created_atrequiredstring
raw_keyrequiredstring
Errors & what triggers them
| Code | Trigger | Fix |
|---|---|---|
| 403 | Caller is not an org admin. | — |
| 404 | project_id or environment_id does not belong to this org. | — |
| 409 | A runtime token for this (project, environment) already exists. | Use POST /v1/orgs/{org_id}/tokens/{key_id}/rotate to get a fresh raw value. |
Request
curl -X POST 'https://api.znyx.ai/v1/orgs/00000000-0000-0000-0000-000000000000/tokens/admin' \
-H 'Authorization: Bearer $ZNYX_TOKEN' \
-H 'Content-Type: application/json' \
-d '{
"expires_in_days": 90
}'Response
application/json
Successful Response
{
"id": 0,
"key_prefix": "string",
"key_type": "string",
"org_id": null,
"project_id": null,
"environment_id": null,
"scopes": [
"string"
],
"is_active": false,
"expires_at": null,
"created_at": "string",
"raw_key": "string"
}Schema: object