API reference

Wallet

Check your balance, price a plan, read the ledger and usage, and top up.

How the wallet works

The API is prepaid. Priced calls draw on your balance and are refused with 402 when it is not enough. Nothing is charged for a refused or failed call. Everything on this page is free to call except that the top-up itself is a payment you make in a browser.

Balance and quote

GET /v1/wallet/balance

Your credit balance. Free

Returns 200. Credit balance, held, available, and this month's spend and limit.

POST /v1/wallet/quote

What a plan of steps would cost. Free

Send the steps you plan to run. The reply gives the price of each, the total, and whether your available credit and this month’s limit cover it. Nothing is charged.

Returns 200. The price of each step, the total, and whether your available credit and this month's limit cover it. Nothing is charged.

Ledger and usage

GET /v1/wallet/ledger

Your charges, refunds and top-ups. Free

ParameterInRequiredDescription
after_idqueryNoReturn entries after this id.
limitqueryNoPage size.

Returns 200. A page of entries.

GET /v1/usage

Your spend over a period. Free

ParameterInRequiredDescription
fromqueryNoStart, YYYY-MM-DD or RFC 3339. Default: the start of this month.
toqueryNoEnd, same format. Default: now.
group_byqueryNoaction, source, day, product or brand. Default: day.

Returns 200. Spend rows.

Top up

POST /v1/wallet/topup

Start a top-up. Free

This starts a Stripe Checkout. Open checkout_url in a browser to pay. The amount is credited when the payment is confirmed.

ParameterInRequiredDescription
Idempotency-KeyheaderNoA retry with the same key is answered from the stored response and charged once.

Body (JSON)

FieldTypeRequiredDescription
amount_microsintegerYesAmount in millionths of a dollar, a whole number of cents. At least 5000000, which is $5.
success_urlstringNo
cancel_urlstringNo

Returns 200. checkout_url: open it in a browser to pay. The amount is credited when the payment is confirmed.