Organization API keys
Manage organization-level API keys from the Dashboard — create, list, inspect scopes, and revoke keys that act across every merchant in the org.
These endpoints back the organization's API-keys screen. An organization key (sk_live_org_… / pk_live_org_…) can act across every merchant in the org, naming the target merchant with merchant_id on each call — unlike a merchant key, which is scoped to one.
The full secret is shown only at creation; afterward a key is identified by its non-secret prefix. Revoking is immediate and permanent.
These endpoints power the Tokeflow Dashboard UI at the organization level. They are session-authenticated (JWT bearer) — the token comes from signing in to the Dashboard, not from an sk_/pk_ API key. Requests also carry the x-organization-id header, and the signed-in user must be a member of that organization.
The API key object
Returned by the list and retrieve endpoints on this page.
| Field | Type | Description |
|---|---|---|
id | string | Unique identifier for the API key. |
entity_type | string | Type of entity (organization or merchant). |
entity_id | string | ID of the entity. |
name | string | Human-readable name for the API key. |
key_prefix | string | Key prefix for identification. |
scopes | array | Scopes/permissions for the API key. |
allowed_ips | array | null | Allowed IP addresses. |
is_active | boolean | Whether the API key is active. |
expires_at | string | null | Expiration date. (ISO 8601 UTC). |
last_used_at | string | null | Last time the key was used. (ISO 8601 UTC). |
created_at | string | Creation timestamp. (ISO 8601 UTC). |
key_hash | string | — |
Endpoints
GET/api/v1/org/api-keys
Auth: Dashboard session (JWT bearer). Organization membership required.
List API keys for merchant.
Query parameters
| Field | Type | Required | Description |
|---|---|---|---|
page | number | No | Page number (1-indexed). Default 1, min 1. |
limit | number | No | Number of items per page. Default 20, min 1, max 100. |
Example request
curl -G https://api.tokeflow.com/api/v1/org/api-keys \
-H "Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9…" \
-H "x-organization-id: org_4b21e7c3" \
--data-urlencode "page=1" \
--data-urlencode "limit=20"Example response — 200
{
"data": [
{
"id": "obj_1a2b3c4d",
"entity_type": "standard",
"entity_id": "string",
"name": "Acme Store",
"key_prefix": "sk_live_mer_7d21",
"scopes": [
"string"
],
"allowed_ips": [
"203.0.113.10"
],
"is_active": true,
"expires_at": "2026-01-15T12:30:00.000Z",
"last_used_at": "2026-01-15T12:30:00.000Z",
"created_at": "2026-01-15T12:30:00.000Z",
"key_hash": "sk_live_mer_7d21"
}
],
"meta": {
"page": 1,
"limit": 20,
"total": 42,
"total_pages": 3,
"has_next": true,
"has_prev": false
}
}POST/api/v1/org/api-keys
Auth: Dashboard session (JWT bearer). Organization membership required.
Create a new API key for merchant.
Request fields
| Field | Type | Required | Description |
|---|---|---|---|
entity_type | string | No | Type of entity the API key belongs to. One of organization, merchant. |
entity_id | string | No | ID of the entity (organization or merchant). |
name | string | Yes | Human-readable name for the API key. |
scopes | array | Yes | — |
allowed_ips | array | Yes | — |
expires_at | string | No | Expiration date for the API key (ISO 8601). |
key_type | string | No | Type of API key - secret or public. One of secret, public. |
Example request
curl -X POST https://api.tokeflow.com/api/v1/org/api-keys \
-H "Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9…" \
-H "x-organization-id: org_4b21e7c3" \
-H "Content-Type: application/json" \
-d '{
"entity_type": "merchant",
"entity_id": "mrc_123",
"name": "Production Key Store XPTO",
"scopes": [
[
"transactions:write",
"transactions:read"
]
],
"allowed_ips": [
[
"1.2.3.4",
"192.168.0.0/16",
"2001:db8::/32"
]
],
"expires_at": "2026-01-15T12:30:00.000Z",
"key_type": "secret"
}'Example response — 201
{
"id": "obj_1a2b3c4d",
"entity_type": "standard",
"entity_id": "string",
"name": "Acme Store",
"key_prefix": "sk_live_mer_7d21",
"scopes": [
"string"
],
"allowed_ips": [
"203.0.113.10"
],
"is_active": true,
"expires_at": "2026-01-15T12:30:00.000Z",
"last_used_at": "2026-01-15T12:30:00.000Z",
"created_at": "2026-01-15T12:30:00.000Z",
"api_key": "sk_live_mer_98765...",
"key_hash": "sk_live_mer_7d21"
}GET/api/v1/org/api-keys/scopes
Auth: Dashboard session (JWT bearer). Organization membership required.
Returns scopes that can be assigned to API keys. Filter by entity_type and/or key_type.
Query parameters
| Field | Type | Required | Description |
|---|---|---|---|
entity_type | string | Yes | — |
key_type | string | Yes | — |
Example request
curl -G https://api.tokeflow.com/api/v1/org/api-keys/scopes \
-H "Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9…" \
-H "x-organization-id: org_4b21e7c3" \
--data-urlencode "entity_type=standard" \
--data-urlencode "key_type=sk_live_mer_7d21"GET/api/v1/org/api-keys/:id
Auth: Dashboard session (JWT bearer). Organization membership required.
Get API key by ID.
Path parameters
| Field | Type | Required | Description |
|---|---|---|---|
id | string | Yes | API Key ID |
Example request
curl https://api.tokeflow.com/api/v1/org/api-keys/obj_1a2b3c4d \
-H "Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9…" \
-H "x-organization-id: org_4b21e7c3"Example response — 200
{
"id": "obj_1a2b3c4d",
"entity_type": "standard",
"entity_id": "string",
"name": "Acme Store",
"key_prefix": "sk_live_mer_7d21",
"scopes": [
"string"
],
"allowed_ips": [
"203.0.113.10"
],
"is_active": true,
"expires_at": "2026-01-15T12:30:00.000Z",
"last_used_at": "2026-01-15T12:30:00.000Z",
"created_at": "2026-01-15T12:30:00.000Z",
"key_hash": "sk_live_mer_7d21"
}PATCH/api/v1/org/api-keys/:id
Auth: Dashboard session (JWT bearer). Organization membership required.
Update API key (activate/deactivate).
Path parameters
| Field | Type | Required | Description |
|---|---|---|---|
id | string | Yes | API Key ID |
Request fields
| Field | Type | Required | Description |
|---|---|---|---|
is_active | boolean | No | Whether the API key is active. |
Example request
curl -X PATCH https://api.tokeflow.com/api/v1/org/api-keys/obj_1a2b3c4d \
-H "Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9…" \
-H "x-organization-id: org_4b21e7c3" \
-H "Content-Type: application/json" \
-d '{
"is_active": false
}'Example response — 200
{
"id": "obj_1a2b3c4d",
"entity_type": "standard",
"entity_id": "string",
"name": "Acme Store",
"key_prefix": "sk_live_mer_7d21",
"scopes": [
"string"
],
"allowed_ips": [
"203.0.113.10"
],
"is_active": true,
"expires_at": "2026-01-15T12:30:00.000Z",
"last_used_at": "2026-01-15T12:30:00.000Z",
"created_at": "2026-01-15T12:30:00.000Z",
"key_hash": "sk_live_mer_7d21"
}POST/api/v1/org/api-keys/:id/revoke
Auth: Dashboard session (JWT bearer). Organization membership required.
Revoke an API key (deactivates it).
Path parameters
| Field | Type | Required | Description |
|---|---|---|---|
id | string | Yes | API Key ID |
Example request
curl -X POST https://api.tokeflow.com/api/v1/org/api-keys/obj_1a2b3c4d/revoke \
-H "Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9…" \
-H "x-organization-id: org_4b21e7c3"Example response — 200
{
"id": "obj_1a2b3c4d",
"entity_type": "standard",
"entity_id": "string",
"name": "Acme Store",
"key_prefix": "sk_live_mer_7d21",
"scopes": [
"string"
],
"allowed_ips": [
"203.0.113.10"
],
"is_active": true,
"expires_at": "2026-01-15T12:30:00.000Z",
"last_used_at": "2026-01-15T12:30:00.000Z",
"created_at": "2026-01-15T12:30:00.000Z",
"key_hash": "sk_live_mer_7d21"
}Errors
Errors use the standard envelope. The most common cases here:
| HTTP | Meaning |
|---|---|
400 | Invalid parameters or a state that does not allow this operation. |
401 | Missing, expired, or invalid Dashboard session token. |
403 | Authenticated, but the signed-in user lacks access to this entity. |
404 | The record does not exist or is not visible to this entity. |