Spend reports API
Spend by agent, team, customer, task and counterparty, and saved reports.
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 a saved report#
/v2/spend/reports- namestringrequired
- querystringrequired
- idId
- object"saved_report"
- org_idId
- created_atTimestamp
- updated_atTimestampoptional
- test_modebooleanoptional
True for test-mode objects (simulations, sandbox).
- namestring
- querystring
- created_byRef
Small reference used for denormalized names in lists (no N+1 lookups in tables).
Ref: 2 fields
- idId
- namestring
- 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/spend/reports" \
-H "Authorization: Bearer $NDSTILL_API_KEY" \
-H "Ndstill-Version: 2026-11-01" \
-H "Idempotency-Key: $(uuidgen)" \
-H "Content-Type: application/json" \
-d '{
"name": "Docs report 3483",
"query": "group=agent&window=month"
}'{
"id": "rpt_a0f97570f7f52edd81b4",
"object": "saved_report",
"org_id": "org_A99F918124609C9DAAACB209D8",
"created_at": "2026-11-23T00:43:13.483Z",
"name": "Docs report 3483",
"query": "",
"created_by": {
"id": "usr_01K7WYQ6MEYNYVHTQCVYZCTCDX",
"name": "Dana Whitfield"
}
}Runs against the in-browser mock with a test key. Nothing leaves your browser.
List saved reports#
/v2/spend/reports- 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:
The same SavedReport object as Create a saved report.
- 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/spend/reports?limit=2" \
-H "Authorization: Bearer $NDSTILL_API_KEY" \
-H "Ndstill-Version: 2026-11-01"{
"object": "list",
"data": [
{
"id": "rpt_309ac01fdf68e96134fd",
"object": "saved_report",
"org_id": "org_A99F918124609C9DAAACB209D8",
"created_at": "2026-11-15T00:43:11.374Z",
"name": "Travel team, month to date",
"query": "by=agent&team=team_01K98QFDMEY82YFGH9FZ0NDM5Y&range=mtd",
"created_by": {
"id": "usr_01KBNZCZMEJ4J4XDKT3YA99REX",
"name": "Elena Petrova"
}
},
{
"id": "rpt_13e9fa179e324135940a",
"object": "saved_report",
"org_id": "org_A99F918124609C9DAAACB209D8",
"created_at": "2026-11-11T00:43:11.374Z",
"name": "Research tree by counterparty",
"query": "by=counterparty&tree=agt_01KQ667RMEP9Y30VHM3RCA9HZN&range=30d",
"created_by": {
"id": "usr_01KBNZCZMEJ4J4XDKT3YA99REX",
"name": "Elena Petrova"
}
}
],
"has_more": true,
"next_cursor": "Mg==",
"total": 4
}Runs against the in-browser mock with a test key. Nothing leaves your browser.
Retrieve a saved report#
/v2/spend/reports/{id}- idIdrequired
A prefixed ID from this org.
The same SavedReport object as Create a saved report.
- 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/spend/reports/rpt_309ac01fdf68e96134fd" \
-H "Authorization: Bearer $NDSTILL_API_KEY" \
-H "Ndstill-Version: 2026-11-01"{
"id": "rpt_309ac01fdf68e96134fd",
"object": "saved_report",
"org_id": "org_A99F918124609C9DAAACB209D8",
"created_at": "2026-11-15T00:43:11.374Z",
"name": "Travel team, month to date",
"query": "by=agent&team=team_01K98QFDMEY82YFGH9FZ0NDM5Y&range=mtd",
"created_by": {
"id": "usr_01KBNZCZMEJ4J4XDKT3YA99REX",
"name": "Elena Petrova"
}
}Runs against the in-browser mock with a test key. Nothing leaves your browser.
Delete a saved report#
/v2/spend/reports/{id}- idIdrequired
A prefixed ID from this org.
Returns the object as it was, with deleted: true.
- 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 DELETE "https://api.ndstill.com/v2/spend/reports/rpt_a0f97570f7f52edd81b4" \
-H "Authorization: Bearer $NDSTILL_API_KEY" \
-H "Ndstill-Version: 2026-11-01"{
"object": "deleted",
"id": "rpt_a0f97570f7f52edd81b4"
}Runs against the in-browser mock with a test key. Nothing leaves your browser.
Get a spend report#
/v2/spend- group_bySpendGroupByrequired
"team""agent""day""customer""tree""counterparty""rail""task""category" - fromDateOnly
- toDateOnly
- agent_idId
- team_idId
- rail"card" | "network_token" | "checkout_token" | "stablecoin" | "bank" | "ai" | "cloud" | Rail[]
One rail, or several (OR).
"card""network_token""checkout_token""stablecoin""bank""ai""cloud" - counterparty_idId
- assetstring
- tree_idId
Root agent of a tree (the whole tree).
- customerstring
End customer dimension; "none" = payments with no customer.
- taskstring
Task dimension; "none" = payments with no task.
- categorystring
Counterparty category ("AI models", "Travel" …).
- object"spend_report"
- group_bySpendGroupBy
"team""agent""day""customer""tree""counterparty""rail""task""category" - fromDateOnly
- toDateOnly
- totalMoney
An amount: integer minor units + asset.
Money: 2 fields
- amountnumber
- assetAssetCode
"USD""USDC""EUR""GBP"
- paymentsnumber
- groupsobject[]
6 fields
- keystring
- labelstring
- amountMoney
An amount: integer minor units + asset.
Money: 2 fields
- amountnumber
- assetAssetCode
"USD""USDC""EUR""GBP"
- paymentsnumber
- sharenumber
- averageMoneyoptional
An amount: integer minor units + asset.
Money: 2 fields
- amountnumber
- assetAssetCode
"USD""USDC""EUR""GBP"
- seriesobject[]
Daily totals over the range (for the time series).
3 fields
- dateDateOnly
- amountMoney
An amount: integer minor units + asset.
Money: 2 fields
- amountnumber
- assetAssetCode
"USD""USDC""EUR""GBP"
- paymentsnumber
- outcomesobject[]
Outcomes per day (approved / held / declined) for the Overview chart.
4 fields
- dateDateOnly
- approvednumber
- heldnumber
- declinednumber
- stopsobject[]
Where payments stop, per pipeline stage.
3 fields
- stagestring
- heldnumber
- declinednumber
- 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/spend" \
-H "Authorization: Bearer $NDSTILL_API_KEY" \
-H "Ndstill-Version: 2026-11-01"{
"object": "spend_report",
"group_by": "agent",
"from": "2026-10-25",
"to": "2026-11-23",
"total": {
"amount": 25071079,
"asset": "USD"
},
"payments": 935,
"groups": [
{
"key": "agt_01KXX2ZXGEHCQDDER8JPXBWH4F",
"label": "Invoice payer",
"amount": {
"amount": 4494871,
"asset": "USD"
},
"payments": 27,
"share": 0.1793,
"average": {
"amount": 166477,
"asset": "USD"
}
},
{
"key": "agt_01KW0P2WME52Y6RB8NQX9XBJ35",
"label": "Ad buyer",
"amount": {
"amount": 3396876,
"asset": "USD"
},
"payments": 50,
"share": 0.1355,
"average": {
"amount": 67938,
"asset": "USD"
}
},
{
"key": "agt_01KYW6M8REDTGCTQ2ZK0CMDADJ",
"label": "Cloud cost guard",
"amount": {
"amount": 2838085,
"asset": "USD"
},
"payments": 35,
"share": 0.1132,
"average": {
"amount": 81088,
"asset": "USD"
}
}
],
"series": [
{
"date": "2026-10-25",
"amount": {
"amount": 1345274,
"asset": "USD"
},
"payments": 32
},
{
"date": "2026-10-26",
"amount": {
"amount": 266205,
"asset": "USD"
},
"payments": 22
},
{
"date": "2026-10-27",
"amount": {
"amount": 340790,
"asset": "USD"
},
"payments": 22
}
],
"outcomes": [
{
"date": "2026-10-25",
"approved": 32,
"held": 1,
"declined": 3
},
{
"date": "2026-10-26",
"approved": 20,
"held": 2,
"declined": 3
},
{
"date": "2026-10-27",
"approved": 22,
"held": 1,
"declined": 1
}
],
"stops": [
{
"stage": "authenticate",
"held": 0,
"declined": 2
},
{
"stage": "entitlement",
"held": 0,
"declined": 0
},
{
"stage": "freeze",
"held": 0,
"declined": 11
}
]
}Runs against the in-browser mock with a test key. Nothing leaves your browser.