API overview
Base URL, authentication, scopes, idempotency, errors, pagination and test mode for the /v2 API.
The ndStill API is a JSON API over HTTPS. Agents use it to pay, check budgets and ask for approval; your own backend uses it to manage agents, policies, funding and the books. The MCP server and the SDKs are thin layers over the same endpoints, so everything on this page applies to them too.
Base URL and format#
Every endpoint lives under one base URL:
https://api.ndstill.com/v2- Requests and responses are JSON (
Content-Type: application/json). Send UTF-8. - Every object carries
object(its kind, such as"agent"or"payment_intent"), a prefixedidand, for org data,org_idandcreated_at. - Timestamps are ISO 8601 in UTC (
2026-11-02T18:04:11Z). Dates without a time areYYYY-MM-DD. - Unknown fields in responses are additive. Your code should ignore fields it doesn't know, because new ones can appear in any version (see Versioning).
A minimal request looks like this:
curl https://api.ndstill.com/v2/agents?limit=2 \
-H "Authorization: Bearer $NDSTILL_API_KEY" \
-H "Ndstill-Version: 2026-11-01"Authentication#
Send a credential in the Authorization header as a bearer token on every request. There are three kinds of credential, and the API treats them differently.
| Credential | Looks like | Who uses it | What it can do |
|---|---|---|---|
| Org API key | nds_live_… or nds_test_… | Your backend, CI | What its scopes allow, across the org |
| Agent-scoped API key | nds_live_… with an agent attached | One agent's runtime | Only that agent's payments, budgets and approvals |
| OAuth 2.1 access token | Opaque bearer token | MCP clients and platforms | The scopes a person granted on the consent screen, capped by the allowance they set |
Agents can also sign requests with their passport key (Ed25519, RFC 9421 HTTP Message Signatures). A signed request identifies the exact agent and key, and sellers can verify it without calling ndStill. See Agents and agent trees and the request-signing tester.
Some rules hold for every credential:
- Agents never change their own controls. No agent-scoped key or agent token can edit its policy, mandates, limits or freeze state.
- Keys are shown once. ndStill stores a keyed hash, not the key. Lost keys are rotated, not recovered.
- People-only powers stay with people. Approving, rejecting and freezing from an MCP client need a human-scoped token; agent tokens never get them.
Live and test keys#
nds_live_ keys act on real funding sources. nds_test_ keys run the same pipeline against a snapshot: no reservation, no credential, no rail call, and nothing written to evidence. Use test keys in CI and in local development. A test key used on an endpoint that would move money returns a simulated result with test_mode: true on the objects it returns.
Scopes for API keys#
Pick the narrowest set when you create a key in the console under Developers, API keys, or with POST/api-keys.
| Scope | Group | What it allows |
|---|---|---|
payments:write | Payments | Ask ndStill to pay (pay, x402 approvals). Every payment still runs the full decision pipeline.Sensitive |
payments:read | Payments | Payments, decisions, traces and receipts. |
decisions:simulate | Payments | Dry-run the pipeline. No money moves and nothing is written to evidence. |
agents:read | Agents | Agents, their status, rails and trees. |
agents:write | Agents | Create agents and change their details. Agents can never change their own policy or limits.Sensitive |
budgets:read | Control | Budgets and what's left in each window. |
approvals:read | Control | Held payments and their status. Deciding stays with people. |
evidence:read | Proof | Signed evidence events, proofs and packs. |
events:read | Developers | Events and webhook deliveries. |
webhooks:write | Developers | Add, change and delete webhook endpoints.Sensitive |
accept:write | Accept | Verify buyer agents, open checkouts, issue receipts and forward refund requests from your server. |
Scopes for OAuth clients#
MCP clients and integrations ask for these on the consent screen. A person picks the agent and its allowance before granting them.
| Scope | Group | What it allows |
|---|---|---|
pay | Payments | The MCP pay tool, capped by the allowance set on the consent screen.Sensitive |
check_budget | Control | See what's left before paying. |
read_activity | Payments | This agent's payments and receipts. |
request_approval | Control | Ask a person to approve a payment above the line. |
approvals:write | Control | Decide held payments. People only; never granted to agent tokens. People only.Sensitive |
agents:freeze | Agents | Freeze and unfreeze agents. People only. People only.Sensitive |
Idempotency#
Every POST requires an Idempotency-Key header. Use a fresh random value (a UUID is fine) per logical operation, and reuse it when you retry that operation.
- Same key, same body: ndStill returns the original response again, with the same status code. A retried
pay()never pays twice. - Same key, different body: the request fails with
409 conflictand codeidempotency_key_reused. - Keys are kept for 24 hours per org. After that, the same key starts a new operation.
curl https://api.ndstill.com/v2/payment-intents \
-H "Authorization: Bearer $NDSTILL_API_KEY" \
-H "Idempotency-Key: 6b0f3a8e-1d2c-4f5b-9a7e-2c1d0e9f8a7b" \
-H "Content-Type: application/json" \
-d '{
"agent_id": "agt_01JC…",
"amount": { "amount": 4200, "asset": "USD" },
"counterparty": "Delta Air Lines",
"purpose": "Flight SFO to JFK for the offsite"
}'The SDKs create an idempotency key for you on every POST and reuse it across their automatic retries. Pass your own when the operation spans processes, such as a job queue that may run twice.
Versions#
The API is versioned by date. Send Ndstill-Version: 2026-11-01 to pin the shape of requests and responses. Without the header, a request uses the version pinned on the key. Additive changes (new endpoints, new optional fields, new event types, new enum values on fields documented as open) can arrive in any version; anything that would break a client ships as a new dated version. Versioning has the full rules.
Pagination and filtering#
List endpoints return a cursor-paginated envelope:
{
"object": "list",
"data": [{ "id": "pi_01JC…", "object": "payment_intent" }],
"has_more": true,
"next_cursor": "eyJpZCI6InBpXzAxSkM…",
"total": 1284
}| Parameter | What it does |
|---|---|
limit | Items per page, 1 to 200. Default 50. |
cursor | Pass the previous page's next_cursor to get the next page. Stop when has_more is false. |
q | Free-text search over names, IDs and descriptors. |
sort | A field name; prefix with - for descending. -created_at is the default. |
created_gte, created_lte | Only items created at or after, or at or before, an ISO timestamp. |
Each list also takes its own filters, such as status, rail or agent_id on payment intents; the reference page for each resource lists them. total is included when it is cheap to count. Cursors are opaque and short-lived, so don't store them.
Errors in brief#
Errors use HTTP status codes and one JSON shape:
{
"object": "error",
"type": "declined",
"code": "payment_declined",
"message": "Over Travel desk's weekly budget by $112.00.",
"decline_reasons": [
{ "code": "over_budget", "stage": "budget", "effect": "decline", "params": { "scope_name": "Travel desk", "window": "week" } }
],
"docs_url": "https://docs.ndstill.com/api/errors",
"request_id": "req_7f3a9c…"
}message is written for people; code and decline_reasons[].code are for your code. A held payment is not an error: it comes back as a normal response with status: "held" and an approval_id. Errors and decline reasons lists every type and code.
Rate limits#
Limits are set per org and per key, and the hot paths are protected separately so a busy reporting job can't slow down payments.
| Traffic | Designed limit | Notes |
|---|---|---|
| Payments and decisions | 100 requests per second per org | Card authorizations from processors are never rate limited |
| Simulations (test mode) | 20 requests per second per org | Shed first under load |
| Everything else | 50 requests per second per key | Lists, reads and admin writes |
When you go over, the API answers 429 rate_limited with a Retry-After header in seconds. The SDKs wait and retry for you. These figures are design targets; the console shows the limits that apply to your org.
Test mode#
Every decision can be dry-run. POST/decisions/simulate runs the same eleven-stage pipeline as a real payment and returns would_outcome (approve, hold or decline), every reason and the full trace, without moving money. Policies have their own POST/policies/{id}/simulate and POST/policies/{id}/replay for checking a draft before you activate it.
curl https://api.ndstill.com/v2/decisions/simulate \
-H "Authorization: Bearer $NDSTILL_TEST_KEY" \
-H "Idempotency-Key: $(uuidgen)" \
-H "Content-Type: application/json" \
-d '{ "agent_id": "agt_01JC…", "amount": { "amount": 4200, "asset": "USD" }, "counterparty": "Delta Air Lines", "rail": "card" }'See Test mode, simulation and replay for how simulations differ from real decisions.
Request IDs#
Every response carries an x-request-id header, and error bodies repeat it as request_id. Log it next to your own request IDs. Support can find any request from it, and the console's request log under Developers is searchable by it.
Money, IDs and other conventions#
- Money is never a float. Amounts are integers in the asset's minor units, always paired with an asset code:
{ "amount": 4200, "asset": "USD" }is $42.00. USD has 2 decimals and USDC has 6, so{ "amount": 10000, "asset": "USDC" }is 0.01 USDC. - IDs are prefixed and time-sortable:
org_,agt_,pol_,mdt_,pi_(payment intent),dec_,apr_,crd_,cred_,acct_,con_,cpy_(counterparty),rcpt_,evt_. Treat them as opaque strings up to 64 characters. - Statuses use one vocabulary everywhere: requested, held, approved, declined, authorized, settled, refunded, disputed, frozen, expired, failed.
- Every list is filterable and exportable. Exports run through POST
/exportsfor large ranges.
Reference by resource#
Each page below is generated from the endpoint registry and its types: the methods, paths, parameters, request and response shapes, errors and a working example from the mock, with a panel to try the call yourself.
Generated at build time from the endpoint registry (packages/api/src/resources.ts) and its types. Versions are explained in Versioning.