API Keys
List, make and revoke the workspace's API keys. Owners and admins; making and revoking need a live key.
Base URL https://api.imario.ai/v1. Each call needs a key that holds the scope shown and acts with at least the role shown (Authentication). Errors are described in API errors.
List API keys
GET /v1/api-keys
Scope keys:read · Role owner or admin
Every key of the workspace, revoked ones included, newest first. Needs keys:read (owner or admin). An api_key object: id, livemode (false: a test key, imk_test_...), created_at, name, principal (member: a personal key acting as its maker with their current role; service: the workspace's, acting with service_role), service_role, scopes (null = full access), prefix (enough to recognise it, useless to use), created_by (user id), last_used_at, expires_at, revoked_at, ip_allowlist (null = any address). Never the secret.
Parameters
| Name | In | Type | Required | Description |
|---|---|---|---|---|
limit | query | integer | No | How many objects to return (1-100). Default 20. |
cursor | query | string | No | The next_cursor of the previous page. Up to 200 characters. |
Example
curl https://api.imario.ai/v1/api-keys \
-H "Authorization: Bearer $IMARIO_API_KEY"Response
Returns a list: {"object": "list", "data": [...], "has_more": false, "next_cursor": null}. See Pagination.
Create an API key
POST /v1/api-keys
Scope keys:write · Role owner or admin · Live keys only
Returns the key with its secret, the only time the secret is shown. 400 scope_unknown for a scope that does not exist, 403 scope_exceeds_key for one this key does not hold, 403 service_role_too_high, 409 key_limit_reached. Live keys only; needs keys:write (owner or admin). An api_key object: id, livemode (false: a test key, imk_test_...), created_at, name, principal (member: a personal key acting as its maker with their current role; service: the workspace's, acting with service_role), service_role, scopes (null = full access), prefix (enough to recognise it, useless to use), created_by (user id), last_used_at, expires_at, revoked_at, ip_allowlist (null = any address). Never the secret.
Request body
| Field | Type | Required | Description |
|---|---|---|---|
name | string | Yes | Up to 120 characters. |
principal | string | Yes | member: a personal key for the member this key acts as; service: a service account. One of member, service. |
service_role | string | No | A service account's role (required for one); never above yours. One of admin, editor, viewer. |
livemode | boolean | Yes | false makes a test key (imk_test_...) for the sandbox. |
scopes | string[] | No | null (and no preset) = full access. Up to 64 items. |
preset | string | No | One of full_access, read_only. |
expires_in_days | integer | No | null = never. From 1 to 3,650. |
ip_allowlist | string[] | No | IPv4/IPv6 addresses or CIDR ranges; null = any. Up to 50 items. |
Example
curl https://api.imario.ai/v1/api-keys \
-H "Authorization: Bearer $IMARIO_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"name": "Nightly CI job",
"principal": "service",
"service_role": "editor",
"livemode": true,
"preset": "read_only",
"expires_in_days": 90
}'Revoke an API key
DELETE /v1/api-keys/{id}
Scope keys:write · Role owner or admin · Live keys only
The key is refused from the next request on. Revoking a revoked key returns it as it is. Live keys only; needs keys:write (owner or admin). An api_key object: id, livemode (false: a test key, imk_test_...), created_at, name, principal (member: a personal key acting as its maker with their current role; service: the workspace's, acting with service_role), service_role, scopes (null = full access), prefix (enough to recognise it, useless to use), created_by (user id), last_used_at, expires_at, revoked_at, ip_allowlist (null = any address). Never the secret.
Example
curl -X DELETE https://api.imario.ai/v1/api-keys/API_KEY_ID \
-H "Authorization: Bearer $IMARIO_API_KEY"