iblai-api-token
Manage the organization's Platform API Tokens — the keys that authenticate every
ibl.ai API call. List the tokens, create a new Api-Token (the secret is shown only
once), retrieve or update a token by name, and delete a token by name. Tokens are
platform_key-scoped, not agent-scoped.
A token's RBAC authority is controlled by its mode:
owner (default) — the token resolves permissions using its creator's RBAC
permissions. Simplest option; the token acts with the owner's authority.
token_policies — the token carries its own fine-grained RBAC, independent
of the owner. You attach specific RBAC policies/groups to the token, and only those
determine what it can do. Use this to issue narrowly-scoped service tokens for an
organization.
Auth & conventions
- Base URL:
https://api.iblai.app
- Header:
Authorization: Api-Token $IBLAI_API_KEY on every request.
- Path vars:
{org} = $IBLAI_ORG, {username} = $IBLAI_USERNAME.
- Host: these endpoints live under
…/dm/api/core/….
- Not connected yet? Run
/iblai-api-login first to populate IBLAI_ORG,
IBLAI_USERNAME, and IBLAI_API_KEY.
Reads
- GET
https://api.iblai.app/dm/api/core/platform/api-tokens/?platform_key={org} — list API keys. The list view omits policies/groups.
- GET
https://api.iblai.app/dm/api/core/platform/api-tokens/{name}?platform_key={org} — retrieve a single token, including its currently associated policies and groups.
- GET
https://api.iblai.app/dm/api/core/platform/api-tokens/field-permissions/?platform_key={org} — report which RBAC-gated fields (mode, policies_to_add, policies_to_remove, groups_to_add, groups_to_remove) the caller may write. Returns {field: {"write": bool}}. Useful for building the create form. Gated on create access.
Writes
- POST
https://api.iblai.app/dm/api/core/platform/api-tokens/ — create a token (returns the secret only once):{
"username": "string (required)",
"name": "string (required)",
"key": "",
"platform_key": "{org} (required)",
"created": "ISO datetime (required)",
"expires": "'' or seconds-string (required)",
"expires_in": "seconds-string | undefined",
"mode": "owner | token_policies (optional, default 'owner')",
"policies_to_add": "[int] policy IDs (optional, mode=token_policies only)",
"groups_to_add": "[int] group IDs (optional, mode=token_policies only)"
}
- PATCH
https://api.iblai.app/dm/api/core/platform/api-tokens/{name}?platform_key={org} — update a token's mode and its policy/group associations:{
"mode": "owner | token_policies",
"policies_to_add": "[int] policy IDs",
"policies_to_remove": "[int] policy IDs",
"groups_to_add": "[int] group IDs",
"groups_to_remove": "[int] group IDs"
}
- DELETE
https://api.iblai.app/dm/api/core/platform/api-tokens/{name}?platform_key={org} — delete a key by name. Destructive — confirm with the user first.
RBAC-scoped fields
mode and the four relation fields (policies_to_add, policies_to_remove,
groups_to_add, groups_to_remove) are privileged: writing them needs
field-level RBAC write access (Ibl.Core/ApiTokens/*/write), separate from ordinary
create/update access. Constraints the server enforces:
- Policies/groups can only be set when
mode is token_policies; sending them with
owner mode is rejected.
- Referenced policies/groups must belong to the token's platform (the organization),
otherwise the request is rejected.
- No escalation: you cannot grant a token more authority than you hold yourself —
each candidate policy (including those reached via
groups_to_add) must be a subset
of the granter's own permissions.
- A
token_policies token does not inherit the owner's staff/superuser flags
(fail-closed).
Examples
Create a basic (owner-mode) Platform API Token named prod-integration (capture the
secret from the response — it is shown only once):
curl -X POST \
"https://api.iblai.app/dm/api/core/platform/api-tokens/" \
-H "Authorization: Api-Token $IBLAI_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"username": "'"$IBLAI_USERNAME"'",
"name": "prod-integration",
"key": "",
"platform_key": "'"$IBLAI_ORG"'",
"created": "2026-06-12T00:00:00Z",
"expires": ""
}'
Create an RBAC-scoped token for the organization — its own policies/groups decide what it
can do, independent of the creator:
curl -X POST \
"https://api.iblai.app/dm/api/core/platform/api-tokens/" \
-H "Authorization: Api-Token $IBLAI_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"username": "'"$IBLAI_USERNAME"'",
"name": "scoped-service-token",
"key": "",
"platform_key": "'"$IBLAI_ORG"'",
"created": "2026-06-12T00:00:00Z",
"expires": "",
"mode": "token_policies",
"policies_to_add": [12, 34],
"groups_to_add": [5]
}'
Re-scope an existing token's policies:
curl -X PATCH \
"https://api.iblai.app/dm/api/core/platform/api-tokens/scoped-service-token?platform_key=$IBLAI_ORG" \
-H "Authorization: Api-Token $IBLAI_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"mode": "token_policies",
"policies_to_add": [56],
"policies_to_remove": [12]
}'
Notes
- The create response returns the token secret only once — store it
immediately; it cannot be retrieved again afterward.
/iblai-api-login uses this same POST …/platform/api-tokens/ endpoint to mint
the Api-Token it stores as IBLAI_API_KEY.
- Retrieve, update, and delete are by token name (not id), and are scoped to the
org via
platform_key={org}.
policies/groups are returned only on detail responses (retrieve/create/update),
not in the list view.
1---2name: iblai-api-token3description: Manage an organization's Platform API Tokens via the platform API — list, create (secret shown once), and delete Api-Tokens by name. Use when issuing or rotating the keys that authenticate ibl.ai API access.4---56# iblai-api-token78Manage the organization's **Platform API Tokens** — the keys that authenticate every9ibl.ai API call. List the tokens, create a new Api-Token (the secret is shown only10once), retrieve or update a token by name, and delete a token by name. Tokens are11`platform_key`-scoped, not agent-scoped.1213A token's RBAC authority is controlled by its **`mode`**:1415- **`owner`** (default) — the token resolves permissions using its creator's RBAC16 permissions. Simplest option; the token acts with the owner's authority.17- **`token_policies`** — the token carries its **own** fine-grained RBAC, independent18 of the owner. You attach specific RBAC policies/groups to the token, and only those19 determine what it can do. Use this to issue narrowly-scoped service tokens for an20 organization.2122## Auth & conventions2324- **Base URL:** `https://api.iblai.app`25- **Header:** `Authorization: Api-Token $IBLAI_API_KEY` on every request.26- **Path vars:** `{org}` = `$IBLAI_ORG`, `{username}` = `$IBLAI_USERNAME`.27- **Host:** these endpoints live under `…/dm/api/core/…`.28- Not connected yet? Run **`/iblai-api-login`** first to populate `IBLAI_ORG`,29 `IBLAI_USERNAME`, and `IBLAI_API_KEY`.3031## Reads3233- **GET** `https://api.iblai.app/dm/api/core/platform/api-tokens/?platform_key={org}` — list API keys. The list view omits `policies`/`groups`.34- **GET** `https://api.iblai.app/dm/api/core/platform/api-tokens/{name}?platform_key={org}` — retrieve a single token, including its currently associated `policies` and `groups`.35- **GET** `https://api.iblai.app/dm/api/core/platform/api-tokens/field-permissions/?platform_key={org}` — report which RBAC-gated fields (`mode`, `policies_to_add`, `policies_to_remove`, `groups_to_add`, `groups_to_remove`) the caller may write. Returns `{field: {"write": bool}}`. Useful for building the create form. Gated on create access.3637## Writes3839- **POST** `https://api.iblai.app/dm/api/core/platform/api-tokens/` — create a token (returns the secret only once):40 ```json41 {42 "username": "string (required)",43 "name": "string (required)",44 "key": "",45 "platform_key": "{org} (required)",46 "created": "ISO datetime (required)",47 "expires": "'' or seconds-string (required)",48 "expires_in": "seconds-string | undefined",49 "mode": "owner | token_policies (optional, default 'owner')",50 "policies_to_add": "[int] policy IDs (optional, mode=token_policies only)",51 "groups_to_add": "[int] group IDs (optional, mode=token_policies only)"52 }53 ```54- **PATCH** `https://api.iblai.app/dm/api/core/platform/api-tokens/{name}?platform_key={org}` — update a token's `mode` and its policy/group associations:55 ```json56 {57 "mode": "owner | token_policies",58 "policies_to_add": "[int] policy IDs",59 "policies_to_remove": "[int] policy IDs",60 "groups_to_add": "[int] group IDs",61 "groups_to_remove": "[int] group IDs"62 }63 ```64- **DELETE** `https://api.iblai.app/dm/api/core/platform/api-tokens/{name}?platform_key={org}` — delete a key by name. Destructive — confirm with the user first.6566## RBAC-scoped fields6768`mode` and the four relation fields (`policies_to_add`, `policies_to_remove`,69`groups_to_add`, `groups_to_remove`) are **privileged**: writing them needs70field-level RBAC write access (`Ibl.Core/ApiTokens/*/write`), separate from ordinary71create/update access. Constraints the server enforces:7273- Policies/groups can only be set when `mode` is `token_policies`; sending them with74 `owner` mode is rejected.75- Referenced policies/groups must belong to the token's platform (the organization),76 otherwise the request is rejected.77- **No escalation:** you cannot grant a token more authority than you hold yourself —78 each candidate policy (including those reached via `groups_to_add`) must be a subset79 of the granter's own permissions.80- A `token_policies` token does **not** inherit the owner's staff/superuser flags81 (fail-closed).8283## Examples8485Create a basic (owner-mode) Platform API Token named `prod-integration` (capture the86secret from the response — it is shown only once):8788```bash89curl -X POST \90 "https://api.iblai.app/dm/api/core/platform/api-tokens/" \91 -H "Authorization: Api-Token $IBLAI_API_KEY" \92 -H "Content-Type: application/json" \93 -d '{94 "username": "'"$IBLAI_USERNAME"'",95 "name": "prod-integration",96 "key": "",97 "platform_key": "'"$IBLAI_ORG"'",98 "created": "2026-06-12T00:00:00Z",99 "expires": ""100 }'101```102103Create an RBAC-scoped token for the organization — its own policies/groups decide what it104can do, independent of the creator:105106```bash107curl -X POST \108 "https://api.iblai.app/dm/api/core/platform/api-tokens/" \109 -H "Authorization: Api-Token $IBLAI_API_KEY" \110 -H "Content-Type: application/json" \111 -d '{112 "username": "'"$IBLAI_USERNAME"'",113 "name": "scoped-service-token",114 "key": "",115 "platform_key": "'"$IBLAI_ORG"'",116 "created": "2026-06-12T00:00:00Z",117 "expires": "",118 "mode": "token_policies",119 "policies_to_add": [12, 34],120 "groups_to_add": [5]121 }'122```123124Re-scope an existing token's policies:125126```bash127curl -X PATCH \128 "https://api.iblai.app/dm/api/core/platform/api-tokens/scoped-service-token?platform_key=$IBLAI_ORG" \129 -H "Authorization: Api-Token $IBLAI_API_KEY" \130 -H "Content-Type: application/json" \131 -d '{132 "mode": "token_policies",133 "policies_to_add": [56],134 "policies_to_remove": [12]135 }'136```137138## Notes139140- The create response returns the token secret **only once** — store it141 immediately; it cannot be retrieved again afterward.142- `/iblai-api-login` uses this same `POST …/platform/api-tokens/` endpoint to mint143 the Api-Token it stores as `IBLAI_API_KEY`.144- Retrieve, update, and delete are by token **name** (not id), and are scoped to the145 org via `platform_key={org}`.146- `policies`/`groups` are returned only on detail responses (retrieve/create/update),147 not in the list view.