API keys API
Org and agent-scoped keys with scopes, expiry, rotation and revocation.
Base URL https://api.ndstill.com/v2. Send Authorization: Bearer with a key, Ndstill-Version: 2026-11-01, and an Idempotency-Key on every POST. Conventions, scopes and errors are in the API overview and Errors and decline reasons. Examples come from the mock backend; the shapes are the TypeScript types in packages/api.
Create an API key#
/v2/api-keys- namestringrequired
- scopesstring[]required
- agent_idId | null
- expires_atTimestamp | null
- modestring enum
"live""test"
- idId
- object"api_key"
- org_idId
- created_atTimestamp
- updated_atTimestampoptional
- test_modebooleanoptional
True for test-mode objects (simulations, sandbox).
- namestring
- prefixstring
Shown in lists: "nds_live_7Hq2…". The secret is returned once, on create.
- scopesstring[]
- agentRef | null
Small reference used for denormalized names in lists (no N+1 lookups in tables).
Ref: 2 fields
- idId
- namestring
- created_byRef
Small reference used for denormalized names in lists (no N+1 lookups in tables).
Ref: 2 fields
- idId
- namestring
- expires_atTimestamp | null
- revoked_atTimestamp | null
Set when revoked. A future time means the key still works until then (rotation overlap).
- last_used_atTimestamp | null
- modestring enum
"live""test" - last_used_ipstring | nulloptional
Where the last request came from.
- requests_24hnumberoptional
Requests in the last 24 hours.
- rotated_fromId | nulloptional
Rotation chain: the key this one replaced, and the key that replaced it.
- rotated_toId | nulloptional
- secretstring
- 400invalid_request
A field is missing or invalid; fields names each one.
- 401authentication
The key or token is missing, expired or revoked.
- 403permission
The key's scopes or the person's role don't allow this.
- 409conflict
The object changed or already exists, or the Idempotency-Key was reused with a different body.
- 429rate_limited
Slow down; retry after the Retry-After header.
curl -X POST "https://api.ndstill.com/v2/api-keys" \
-H "Authorization: Bearer $NDSTILL_API_KEY" \
-H "Ndstill-Version: 2026-11-01" \
-H "Idempotency-Key: $(uuidgen)" \
-H "Content-Type: application/json" \
-d '{
"name": "Docs example key",
"scopes": [
"payments:read"
],
"mode": "test"
}'{
"id": "key_01M82XPRPPT7Q17T3RRQTKKYAK",
"object": "api_key",
"org_id": "org_A99F918124609C9DAAACB209D8",
"created_at": "2026-11-23T00:43:13.494Z",
"name": "Docs example key",
"prefix": "nds_test_89c9",
"scopes": [
"payments:read"
],
"agent": null,
"created_by": {
"id": "usr_01K7WYQ6MEYNYVHTQCVYZCTCDX",
"name": "Dana Whitfield"
},
"expires_at": null,
"revoked_at": null,
"last_used_at": null,
"mode": "test",
"last_used_ip": null,
"requests_24h": 0,
"rotated_from": null,
"rotated_to": null,
"secret": "nds_test_89c91af989036e955217d869909f93c5ed38cc39"
}Runs against the in-browser mock with a test key. Nothing leaves your browser.
List API keys#
/v2/api-keys- agent_idId
- modestring enum
"live""test" - cursorstring
- limitnumber
1–200, default 50.
- qstring
Free-text search over names, ids and descriptors.
- sortstring
Sort field, prefix "-" for descending ("-created_at" is the default).
- created_gteTimestamp
created_at >= (ISO).
- created_lteTimestamp
created_at <= (ISO).
Returns a list envelope: object "list", data[], has_more, next_cursor (pass it back as cursor) and total when cheap to count. Items:
- idId
- object"api_key"
- org_idId
- created_atTimestamp
- updated_atTimestampoptional
- test_modebooleanoptional
True for test-mode objects (simulations, sandbox).
- namestring
- prefixstring
Shown in lists: "nds_live_7Hq2…". The secret is returned once, on create.
- scopesstring[]
- agentRef | null
Small reference used for denormalized names in lists (no N+1 lookups in tables).
Ref: 2 fields
- idId
- namestring
- created_byRef
Small reference used for denormalized names in lists (no N+1 lookups in tables).
Ref: 2 fields
- idId
- namestring
- expires_atTimestamp | null
- revoked_atTimestamp | null
Set when revoked. A future time means the key still works until then (rotation overlap).
- last_used_atTimestamp | null
- modestring enum
"live""test" - last_used_ipstring | nulloptional
Where the last request came from.
- requests_24hnumberoptional
Requests in the last 24 hours.
- rotated_fromId | nulloptional
Rotation chain: the key this one replaced, and the key that replaced it.
- rotated_toId | nulloptional
- 400invalid_request
A query parameter is invalid.
- 401authentication
The key or token is missing, expired or revoked.
- 403permission
The key's scopes or the person's role don't allow this.
- 429rate_limited
Slow down; retry after the Retry-After header.
curl -X GET "https://api.ndstill.com/v2/api-keys?limit=2" \
-H "Authorization: Bearer $NDSTILL_API_KEY" \
-H "Ndstill-Version: 2026-11-01"{
"object": "list",
"data": [
{
"id": "key_01M6CVBKMENJA5BND123KN6BTK",
"object": "api_key",
"org_id": "org_A99F918124609C9DAAACB209D8",
"created_at": "2026-11-02T00:43:11.374Z",
"name": "Production backend",
"prefix": "nds_live_935b",
"scopes": [
"payments:write",
"payments:read",
"budgets:read"
],
"agent": null,
"created_by": {
"id": "usr_01KD1R56ME94CCHFNYQB1CC01H",
"name": "Aisha Bello"
},
"expires_at": null,
"revoked_at": null,
"last_used_at": "2026-11-22T18:21:11.374Z",
"mode": "live",
"last_used_ip": "203.0.113.18",
"requests_24h": 949,
"rotated_from": null,
"rotated_to": null
},
{
"id": "key_01M3JQEEME8MPFVK0NAGMJ5013",
"object": "api_key",
"org_id": "org_A99F918124609C9DAAACB209D8",
"created_at": "2026-09-28T00:43:11.374Z",
"name": "Literature scout runtime",
"prefix": "nds_live_e857",
"scopes": [
"payments:write",
"budgets:read"
],
"agent": {
"id": "agt_01KQM4HZWEB7WBQNPK4NFJY5A0",
"name": "Literature scout"
},
"created_by": {
"id": "usr_01KD1R56ME94CCHFNYQB1CC01H",
"name": "Aisha Bello"
},
"expires_at": null,
"revoked_at": null,
"last_used_at": "2026-11-22T22:11:11.374Z",
"mode": "live",
"last_used_ip": "203.0.113.132",
"requests_24h": 2568,
"rotated_from": null,
"rotated_to": null
}
],
"has_more": true,
"next_cursor": "Mg==",
"total": 6
}Runs against the in-browser mock with a test key. Nothing leaves your browser.
Retrieve an API key#
/v2/api-keys/{id}- idIdrequired
A prefixed ID from this org.
The same ApiKey object as List API keys.
- 401authentication
The key or token is missing, expired or revoked.
- 403permission
The key's scopes or the person's role don't allow this.
- 404not_found
No object with that id in this org.
- 429rate_limited
Slow down; retry after the Retry-After header.
curl -X GET "https://api.ndstill.com/v2/api-keys/key_01M6CVBKMENJA5BND123KN6BTK" \
-H "Authorization: Bearer $NDSTILL_API_KEY" \
-H "Ndstill-Version: 2026-11-01"{
"id": "key_01M6CVBKMENJA5BND123KN6BTK",
"object": "api_key",
"org_id": "org_A99F918124609C9DAAACB209D8",
"created_at": "2026-11-02T00:43:11.374Z",
"name": "Production backend",
"prefix": "nds_live_935b",
"scopes": [
"payments:write",
"payments:read",
"budgets:read"
],
"agent": null,
"created_by": {
"id": "usr_01KD1R56ME94CCHFNYQB1CC01H",
"name": "Aisha Bello"
},
"expires_at": null,
"revoked_at": null,
"last_used_at": "2026-11-22T18:21:11.374Z",
"mode": "live",
"last_used_ip": "203.0.113.18",
"requests_24h": 949,
"rotated_from": null,
"rotated_to": null
}Runs against the in-browser mock with a test key. Nothing leaves your browser.
List API scopes#
/v2/api-keys/scopesEvery scope an API key or OAuth client can carry, with who it is for.
- audiencestring enum
"api_key""oauth"
Returns a list envelope: object "list", data[], has_more, next_cursor (pass it back as cursor) and total when cheap to count. Items:
- object"api_scope"
- scopestring
- groupstring
"Payments", "Agents", "Control", "Proof", "Developers", "Accept".
- labelstring
- descriptionstring
- audiencestring enum
"api_key" scopes go on keys; "oauth" scopes are what an MCP client or integration asks for.
"api_key""oauth" - sensitiveboolean
Writes, money movement or people-only powers: shown with a quiet warning.
- people_onlybooleanoptional
People-only scopes are never granted to agent-scoped tokens.
- 400invalid_request
A query parameter is invalid.
- 401authentication
The key or token is missing, expired or revoked.
- 403permission
The key's scopes or the person's role don't allow this.
- 429rate_limited
Slow down; retry after the Retry-After header.
curl -X GET "https://api.ndstill.com/v2/api-keys/scopes" \
-H "Authorization: Bearer $NDSTILL_API_KEY" \
-H "Ndstill-Version: 2026-11-01"{
"object": "list",
"data": [
{
"object": "api_scope",
"scope": "payments:write",
"group": "Payments",
"label": "Make payments",
"description": "Ask ndStill to pay (pay, x402 approvals). Every payment still runs the full decision pipeline.",
"audience": "api_key",
"sensitive": true
},
{
"object": "api_scope",
"scope": "payments:read",
"group": "Payments",
"label": "Read payments",
"description": "Payments, decisions, traces and receipts.",
"audience": "api_key",
"sensitive": false
},
{
"object": "api_scope",
"scope": "decisions:simulate",
"group": "Payments",
"label": "Simulate payments",
"description": "Dry-run the pipeline. No money moves and nothing is written to evidence.",
"audience": "api_key",
"sensitive": false
}
],
"has_more": false,
"next_cursor": null,
"total": 17
}Runs against the in-browser mock with a test key. Nothing leaves your browser.
Revoke an API key#
/v2/api-keys/{id}/revoke- idIdrequired
A prefixed ID from this org.
The same ApiKey object as List API keys.
- 401authentication
The key or token is missing, expired or revoked.
- 403permission
The key's scopes or the person's role don't allow this.
- 404not_found
No object with that id in this org.
- 409conflict
The object changed or already exists, or the Idempotency-Key was reused with a different body.
- 429rate_limited
Slow down; retry after the Retry-After header.
curl -X POST "https://api.ndstill.com/v2/api-keys/key_01M82XPRPPT7Q17T3RRQTKKYAK/revoke" \
-H "Authorization: Bearer $NDSTILL_API_KEY" \
-H "Ndstill-Version: 2026-11-01" \
-H "Idempotency-Key: $(uuidgen)"{
"id": "key_01M82XPRPPT7Q17T3RRQTKKYAK",
"object": "api_key",
"org_id": "org_A99F918124609C9DAAACB209D8",
"created_at": "2026-11-23T00:43:13.494Z",
"name": "Docs example key",
"prefix": "nds_test_89c9",
"scopes": [
"payments:read"
],
"agent": null,
"created_by": {
"id": "usr_01K7WYQ6MEYNYVHTQCVYZCTCDX",
"name": "Dana Whitfield"
},
"expires_at": null,
"revoked_at": "2026-11-23T00:43:13.665Z",
"last_used_at": null,
"mode": "test",
"last_used_ip": null,
"requests_24h": 0,
"rotated_from": null,
"rotated_to": null
}Runs against the in-browser mock with a test key. Nothing leaves your browser.
Rotate an API key#
/v2/api-keys/{id}/rotate- idIdrequired
A prefixed ID from this org.
- overlap_hoursnumber
The same ApiKeyCreated object as Create an API key.
- 400invalid_request
A field is missing or invalid; fields names each one.
- 400step_up_required
A person must confirm with a passkey first, when the org requires it.
- 401authentication
The key or token is missing, expired or revoked.
- 403permission
The key's scopes or the person's role don't allow this.
- 404not_found
No object with that id in this org.
- 409conflict
The object changed or already exists, or the Idempotency-Key was reused with a different body.
- 429rate_limited
Slow down; retry after the Retry-After header.
curl -X POST "https://api.ndstill.com/v2/api-keys/key_01M6CVBKMENJA5BND123KN6BTK/rotate" \
-H "Authorization: Bearer $NDSTILL_API_KEY" \
-H "Ndstill-Version: 2026-11-01" \
-H "Idempotency-Key: $(uuidgen)" \
-H "Content-Type: application/json" \
-d '{}'{
"id": "key_01M82XPRW2569JZ6VHJSY9CSG0",
"object": "api_key",
"org_id": "org_A99F918124609C9DAAACB209D8",
"created_at": "2026-11-23T00:43:13.666Z",
"name": "Production backend",
"prefix": "nds_live_2915",
"scopes": [
"payments:write",
"payments:read",
"budgets:read"
],
"agent": null,
"created_by": {
"id": "usr_01K7WYQ6MEYNYVHTQCVYZCTCDX",
"name": "Dana Whitfield"
},
"expires_at": null,
"revoked_at": null,
"last_used_at": null,
"mode": "live",
"last_used_ip": null,
"requests_24h": 0,
"rotated_from": "key_01M6CVBKMENJA5BND123KN6BTK",
"rotated_to": null,
"secret": "nds_live_2915bb7afe908815bb5a782a6b3615854c64d4fa"
}Runs against the in-browser mock with a test key. Nothing leaves your browser.