Create statement
POST/statements
Request an account statement for whole local days.
Sandbox: test money only. No request moves real money.
Authenticate with your sandbox key as a bearer token: Authorization: Bearer nbk_test_..
Needs statements:read. from and to are local dates in the workspace's finance zone, to excluded and at most the current day,
at most 366 days. The server prepares the statement once the period is complete and reconciles it before any file exists:
opening plus every movement must equal the closing recomputed from the ledger, or it fails with reconciliation_failed.
CSV always, PDF only where the server offers it. The files are downloaded from the dashboard. Amounts are micro-dollars (1 USD = 1,000,000) as integer strings, and
exact dollars to six decimals in the CSV. A retry with the same Idempotency-Key answers the same statement.
Request
| Header | Value | Sent |
|---|---|---|
Authorization | Bearer nbk_test_... | Required |
Content-Type | application/json | Required |
Idempotency-Key | 3f1c9a52-7d4e-4b8a-9c21-5e6f7a8b9c0d | Required |
Parameters
| Field | Description |
|---|---|
| Idempotency keyIdempotency-Key · header string · required | Bound permanently to the operation it created (an order, a simulated funding). Reuse it on every retry of the same request. Pattern ^[A-Za-z0-9_-]{16,64}$. |
Body
Unknown fields are rejected.
| Field | Description |
|---|---|
| Fromfrom · string · required | Format date. |
| Toto · string · required | Format date. |
| Formatsformats · array of string | At least 1 item. No duplicates. Each one of csv, pdf. |
// One key per purchase: make it once, keep it with the purchase, and send the same key on every retry.const idempotencyKey = process. env. IDEMPOTENCY_ KEY;if ( !idempotencyKey) throw new Error( 'Set IDEMPOTENCY_ KEY once for this purchase ( a new UUID) and keep it for every retry');const response = await fetch( 'https:// sandbox-api. nasfampay. com/ v1/ statements', { method: 'POST', headers: { Authorization: `Bearer ${process. env. NASFAM_ SANDBOX_ KEY}`, 'Content-Type': 'application/ json', 'Idempotency-Key': idempotencyKey, }, body: JSON. stringify( { from: '2026-10-10', to: '2026-10-10' }),});if ( !response. ok) { const problem = await response. json(); throw new Error( `${problem. status} ${problem. code}: ${problem. title} ( request ${problem. request_ id})`);}const result = await response. json();console. log( response. status, result);// npm install axiosimport axios from 'axios';// One key per purchase: make it once, keep it with the purchase, and send the same key on every retry.const idempotencyKey = process. env. IDEMPOTENCY_ KEY;if ( !idempotencyKey) throw new Error( 'Set IDEMPOTENCY_ KEY once for this purchase ( a new UUID) and keep it for every retry');try { const { status, data: statement } = await axios. post( 'https:// sandbox-api. nasfampay. com/ v1/ statements', { from: '2026-10-01', to: '2026-10-10', formats: ['csv'], }, { headers: { Authorization: `Bearer ${process. env. NASFAM_ SANDBOX_ KEY}`, 'Idempotency-Key': idempotencyKey, }, }, ); console. log( status, statement);} catch ( error) { if ( !axios. isAxiosError( error) || !error. response) throw error; const problem = error. response. data; throw new Error( `${problem. status} ${problem. code}: ${problem. title} ( request ${problem. request_ id})`);}Responses
| Status | Meaning | Body |
|---|---|---|
| OK200 | Replay of an earlier request with the same Idempotency-Key. Headers: RateLimit (draft-ietf-httpapi-ratelimit-headers-11. the same buckets, each "<bucket>";r=<whole requests remaining, never negative>;t=<seconds until the quota is fully available again>.
), RateLimit-Policy (draft-ietf-httpapi-ratelimit-headers-11. a structured field list with one item per bucket the request drew on (orders, quotes, quotes_daily, reads, webhooks, lookups, lookups_org, lookups_daily), each "<bucket>";q=<quota>;w=<window seconds>. no partition key (pk) is sent.
), Idempotent-Replayed. | Statement object |
| Accepted202 | The statement, queued. Headers: RateLimit (draft-ietf-httpapi-ratelimit-headers-11. the same buckets, each "<bucket>";r=<whole requests remaining, never negative>;t=<seconds until the quota is fully available again>.
), RateLimit-Policy (draft-ietf-httpapi-ratelimit-headers-11. a structured field list with one item per bucket the request drew on (orders, quotes, quotes_daily, reads, webhooks, lookups, lookups_org, lookups_daily), each "<bucket>";q=<quota>;w=<window seconds>. no partition key (pk) is sent.
). | Statement object |
| Content too large413 | The request body is over 16 KB (payload_too_large). Refused before authentication; nothing is read further. Headers: Request-Id. | Problem object |
| Too many requests429 | Too many requests (rate_limited), or your queued orders are at your cap (queue_limit). A bucket that cannot be read at once because of contention is answered here too, never waited on. Honour Retry-After.
. Headers: Request-Id, Retry-After (seconds to wait before retrying), RateLimit (draft-ietf-httpapi-ratelimit-headers-11. the same buckets, each "<bucket>";r=<whole requests remaining, never negative>;t=<seconds until the quota is fully available again>.
), RateLimit-Policy (draft-ietf-httpapi-ratelimit-headers-11. a structured field list with one item per bucket the request drew on (orders, quotes, quotes_daily, reads, webhooks, lookups, lookups_org, lookups_daily), each "<bucket>";q=<quota>;w=<window seconds>. no partition key (pk) is sent.
). | Problem object |
| Any other statusdefault | Error (RFC 9457). A 503 service_unavailable with Retry-After means the request was not processed: the rate limiter or the database could not answer, and the API refuses rather than serve unlimited (reads included). For a money-moving operation, retrying with the same Idempotency-Key is always safe.
. Headers: Request-Id, Retry-After (on 429 and some 503 responses). | Problem object |
The statement object
| Field | Description |
|---|---|
| IDid · string · required | Pattern ^stm_[0-9A-HJKMNP-TV-Z]{26}$. |
| Statestate · string · required | One of queued, ready, failed. |
| Failure codefailure_ | One of reconciliation_failed, too_large, null. |
| Currencycurrency · string · required | One of USD. |
| Timezonetimezone · string · required | |
| Reconciledreconciled · boolean · required | |
| Periodperiod · object · required | |
| Fromperiod. | Format date. |
| Toperiod. | Format date. |
| From atperiod. | Format date-time. |
| To atperiod. | Format date-time. |
| Formatsformats · array of string · required | Each one of csv, pdf. |
| Movement countmovement_ | At least 0. |
| Created atcreated_ | Format date-time. |
| Finished atfinished_ | Format date-time. |
| Filesfiles · array of object · required | |
| Formatfiles[]. | One of csv, pdf. |
| Byte sizefiles[]. | At least 1. |
| Sha256files[]. | Pattern ^[0-9a-f]{64}$. |
| Expires atfiles[]. | Format date-time. |
| Availablefiles[]. | |
| Summarysummary · object, one of 2 · required | Either shape 1: ; or shape 2: opening, closing, categories, spent, orders_charged, deposits_credited, reservations_returned, refunded, adjustments, spent_by_product. |
Responses are extensible: ignore fields, enum values and event types you do not know. Any other status is a Problem (see Errors).
{ "id": "stm_ 01K7SAMP000000000000000001", "state": "queued", "failure_ code": null, "currency": "USD", "timezone": "string", "reconciled": true, "period": { "from": "2026-10-10", "to": "2026-10-10", "from_ at": "2026-10-10T10:05:02Z", "to_ at": "2026-10-10T10:05:02Z" }, "formats": [ "csv" ], "movement_ count": null, "created_ at": "2026-10-10T10:05:02Z", "finished_ at": null, "files": [ { "format": "csv", "byte_ size": 1, "sha256": "0000000000000000000000000000000000000000000000000000000000000000", "expires_ at": "2026-10-10T10:05:02Z", "available": true } ], "summary": null}Not finished. Only a final status means it is done: read it again or wait for its webhook. An outcome that is not known yet is held, never a failure.
{ "id": "stm_ 01K7SAMP000000000000000090", "state": "queued", "failure_ code": null, "currency": "USD", "timezone": "Africa/ Lagos", "reconciled": false, "period": { "from": "2026-10-01", "to": "2026-10-10", "from_ at": "2026-09-30T23:00:00.000Z", "to_ at": "2026-10-09T23:00:00.000Z" }, "formats": [ "csv" ], "movement_ count": null, "created_ at": "2026-10-10T10:20:00.000Z", "finished_ at": null, "files": [], "summary": null}{ "type": "about:blank", "title": "Too many requests", "status": 429, "code": "rate_ limited", "category": "rate_ limit", "detail": "Too many requests. Retry after the time in Retry-After. ", "param": null, "request_ id": "req_ 01K7SAMP000000000000000090"}How it behaves
| What to expect | |
|---|---|
| Authentication | Your key as a bearer token in the Authorization header: a nbk_test_ key on the sandbox host. |
| Idempotency | Required, and bound permanently to what the first request made. Reuse it on every retry: a retry answers with the same operation, never a second one. |
| In the sandbox | Served, on your own test records. |
| On Live | The same request, on the Live host with a live key, which exists only for a workspace activated for Live. See Go live. |
| Funding | None. This request does not touch your balance. |
| Status changes | None. |
| Webhook events | None. |
Error responses
Any request can answer with invalid_request, invalid_api_key, key_expired, key_environment_mismatch, insufficient_scope, rate_limited, service_unavailable, internal_error. Errors says what to do about each one.
