Billing
Get the billing account
GET /b/v1/billing-accounts/me
The organization’s billing account and its credit balances. Requires billing.account.read. A user sees both the live and the sandbox balance; an API key sees only its own mode’s. creditBalance is the available balance of mode. 404 RES101 until the account is provisioned.
Who can call it: API key or signed-in user.
Parameters
| Name | In | Type | Required | Description |
|---|---|---|---|---|
mode | query | string | No | Which ledger to read. Defaults to the token’s mode. API keys may only name their own mode (403 BIZ108). One of sandbox | live. |
Example request
Responses
The billing account.
Errors: 400, 401, 403, 404, 429, 500, 503
What each action costs your organization
GET /b/v1/billing-accounts/me/credit-costs
Requires billing.account.read. Every action and the credits one unit costs your organization: the costs of the plan version you are on (they stay as they were when you chose it, until you change plan), or the default list when you have no plan. An action your plan includes is marked included and costs no credits.
Who can call it: API key or signed-in user.
Example request
Responses
The cost list.
Errors: 401, 403, 404, 429, 500, 503
Set the low-balance threshold
PATCH /b/v1/billing-accounts/me/low-balance
Tenant user only, billing.low_balance.configure. Sets the live balance below which one low-balance email is sent each time the balance drops past it; 0 turns it off. Live ledger only.
Who can call it: Signed-in user only: do this in the Yona app.
Request body
| Field | Type | Required | Description |
|---|---|---|---|
threshold | integer | Yes | Live balance below which one low-balance email is sent per crossing; 0 disables. Between 0 and 100000000. |
Example request
Responses
The new threshold and whether the next drop below it will notify.
Errors: 400, 401, 403, 404, 413, 415, 429, 500, 503
Check the balance covers an amount
GET /b/v1/billing-accounts/{id}/check-balance
Whether the available balance covers credits, for the caller’s own account (its id or me). Advisory only: the charge itself decides. Requires billing.account.read. Reads the ledger of the token’s mode unless mode names another; an API key may read only its own mode (403 BIZ108).
Who can call it: API key or signed-in user.
Parameters
| Name | In | Type | Required | Description |
|---|---|---|---|---|
id | path | string | Yes | The caller’s own billing account id, or me. |
mode | query | string | No | Which ledger to read. Defaults to the token’s mode. API keys may only name their own mode (403 BIZ108). One of sandbox | live. |
credits | query | integer | Yes | Between 1 and 1000000000. |
Example request
Responses
Whether the balance is sufficient.
Errors: 400, 401, 403, 404, 429, 500, 503
Get billing account statistics
GET /b/v1/billing-accounts/{id}/stats
Balance, lifetime totals and the consumption rate over the last 30 days, for the caller’s own account (its id or me). Requires billing.account.read. Reads the ledger of the token’s mode unless mode names another; an API key may read only its own mode (403 BIZ108).
Who can call it: API key or signed-in user.
Parameters
| Name | In | Type | Required | Description |
|---|---|---|---|---|
id | path | string | Yes | The caller’s own billing account id, or me. |
mode | query | string | No | Which ledger to read. Defaults to the token’s mode. API keys may only name their own mode (403 BIZ108). One of sandbox | live. |
Example request
Responses
The account statistics.
Errors: 400, 401, 403, 404, 429, 500, 503
Get the plans and packages catalogue
GET /b/v1/plans
The public subscription plans and credit packages in one response. No token needed.
Who can call it: Anyone: no authentication.
Parameters
| Name | In | Type | Required | Description |
|---|---|---|---|---|
currency | query | string | No | Only prices in this currency. One of NGN | USD. |
interval | query | string | No | Only plan prices for this interval. One of monthly | yearly. |
Example request
Responses
Errors: 400, 429, 500, 503
List credit costs
GET /b/v1/plans/credit-costs
The public price list: how many credits each billable action costs, grouped by section. No token needed.
Who can call it: Anyone: no authentication.
Parameters
| Name | In | Type | Required | Description |
|---|---|---|---|---|
currency | query | string | No | Only prices in this currency. One of NGN | USD. |
interval | query | string | No | Only plan prices for this interval. One of monthly | yearly. |
Example request
Responses
Errors: 400, 429, 500, 503
List credit packages
GET /b/v1/plans/packages
The public credit packages with their prices in integer minor units; featured filters on whether a package is featured. No token needed.
Who can call it: Anyone: no authentication.
Parameters
| Name | In | Type | Required | Description |
|---|---|---|---|---|
currency | query | string | No | Only prices in this currency. One of NGN | USD. |
interval | query | string | No | Only plan prices for this interval. One of monthly | yearly. |
featured | query | boolean | No | Only featured packages (true) or only others (false). |
Example request
Responses
Errors: 400, 429, 500, 503
Get a credit package
GET /b/v1/plans/packages/{id}
One public credit package by its id. No token needed.
Who can call it: Anyone: no authentication.
Parameters
| Name | In | Type | Required | Description |
|---|---|---|---|---|
id | path | string (uuid) | Yes | |
currency | query | string | No | Only prices in this currency. One of NGN | USD. |
interval | query | string | No | Only plan prices for this interval. One of monthly | yearly. |
Example request
Responses
Errors: 400, 404, 429, 500, 503
Get the plan recommended for the organization
GET /b/v1/plans/recommendation
The Direct plan the plan chooser marks “Recommended for you”: the cheapest whose invoice caps cover the busiest of the organization’s last three months (live invoices; a foreign currency at Yona’s exchange rate). needsSales is true when no Direct plan covers it — the largest is named and a sales call offered. data is null when the invoice-capped plans are not on sale or the history cannot be read. Requires billing.subscription.read.
Who can call it: API key or signed-in user.
Example request
Responses
The recommendation, or null.
Errors: 401, 403, 429, 500, 503
List subscription plans
GET /b/v1/plans/subscriptions
The public subscription plans with their prices in integer minor units, optionally narrowed to one currency or interval. No token needed.
Who can call it: Anyone: no authentication.
Parameters
| Name | In | Type | Required | Description |
|---|---|---|---|---|
currency | query | string | No | Only prices in this currency. One of NGN | USD. |
interval | query | string | No | Only plan prices for this interval. One of monthly | yearly. |
Example request
Responses
Errors: 400, 429, 500, 503
Get a subscription plan
GET /b/v1/plans/subscriptions/{code}
One public subscription plan by its code. No token needed.
Who can call it: Anyone: no authentication.
Parameters
| Name | In | Type | Required | Description |
|---|---|---|---|---|
code | path | string | Yes | |
currency | query | string | No | Only prices in this currency. One of NGN | USD. |
interval | query | string | No | Only plan prices for this interval. One of monthly | yearly. |
Example request
Responses
Errors: 400, 404, 429, 500, 503
Get a subscription
GET /b/v1/subscriptions/{id}
One subscription of the organization. Requires billing.subscription.read. Another organization’s subscription answers 404 RES001.
Who can call it: API key or signed-in user.
Parameters
| Name | In | Type | Required | Description |
|---|---|---|---|---|
id | path | string | Yes |
Example request
Responses
The subscription.
Errors: 400, 401, 403, 404, 429, 500, 503
Get the current subscription
GET /b/v1/subscriptions/active
The organization’s active or past-due subscription and its current monthly allocation window (window is null while past due), with its open plan change (planChange: awaiting payment, or scheduled for the period end; null when none is open). Requires billing.subscription.read. 404 RES001 when there is none.
Who can call it: API key or signed-in user.
Example request
Responses
The current subscription.
Errors: 401, 403, 404, 429, 500, 503
Buy the offered deal
POST /b/v1/subscriptions/deal-checkout
Tenant user only, billing.subscription.subscribe, from a live-mode session. Starts the hosted checkout for the offered deal’s plan, monthly or yearly, at its price plus VAT — the same checkout and answer as subscribing to a plan. Optional Idempotency-Key header: the same key and body return the original checkout; the same key with another body is 409 BIZ107.
Who can call it: Signed-in user only: do this in the Yona app.
Request body
| Field | Type | Required | Description |
|---|---|---|---|
dealId | string (uuid) | Yes | |
interval | string | Yes | One of monthly | yearly. |
returnPath | string | No | Dashboard path to return to after checkout; must be one of the allowed dashboard return paths. Absolute URLs are refused. |
Example request
Responses
The same checkout is still pending and is returned again.
A new checkout was started: the subscription, the payment and the checkout URL.
Errors: 400, 401, 403, 404, 409, 413, 415, 422, 429, 500, 503
List subscriptions
GET /b/v1/subscriptions/history
Every subscription of the organization, newest first. Requires billing.subscription.read.
Who can call it: API key or signed-in user.
Parameters
| Name | In | Type | Required | Description |
|---|---|---|---|---|
page | query | number | No | Page number (1-based). Default: 1. At least 1. |
limit | query | number | No | Items per page. Default: 50. Between 1 and 100. |
Example request
Responses
A page of subscriptions.
Errors: 400, 401, 403, 404, 429, 500, 503
List subscription billing periods
GET /b/v1/subscriptions/renewals
The billing periods of the organization’s subscriptions and how each was charged, optionally for one subscription. Requires billing.subscription.read.
Who can call it: API key or signed-in user.
Parameters
| Name | In | Type | Required | Description |
|---|---|---|---|---|
page | query | number | No | Page number (1-based). Default: 1. At least 1. |
limit | query | number | No | Items per page. Default: 50. Between 1 and 100. |
subscriptionId | query | string (uuid) | No | Only this subscription’s periods (must be the caller’s). |
Example request
Responses
A page of billing periods.
Errors: 400, 401, 403, 404, 429, 500, 503
Subscribe to a plan
POST /b/v1/subscriptions/subscribe
Tenant user only, billing.subscription.subscribe, from a live-mode session. Creates a pending_payment subscription and starts a hosted checkout for its first period; it becomes active when the provider confirms the payment. When a paid plan is current (and plan changes are switched on) this is a change now: the checkout charges the new price less the value of the paid period’s allowance windows not yet issued, amountMinor is what it charges, recurringAmountMinor the plan’s price per period and planChangeId the change; the current plan is replaced only when the payment settles. A change that cannot be made now is 409 BIZ104 with the reason in meta.errors — never a silent schedule. Optional Idempotency-Key header: the same key and body return the original checkout; the same key with another body is 409 BIZ107.
Who can call it: Signed-in user only: do this in the Yona app.
Request body
| Field | Type | Required | Description |
|---|---|---|---|
planCode | string | Yes | |
interval | string | Yes | One of monthly | yearly. |
currency | string | Yes | Required; 422 BIZ101 when no provider is routed for it. One of NGN | USD. |
returnPath | string | No | Dashboard path to return to after checkout; must be one of the allowed dashboard return paths. Absolute URLs are refused. |
Example request
Responses
The same checkout is still pending and is returned again.
A new checkout was started: the subscription, the payment and the checkout URL.
Errors: 400, 401, 403, 404, 409, 413, 415, 422, 429, 500, 503
Cancel a subscription
PUT /b/v1/subscriptions/{id}/cancel
Tenant user only, billing.subscription.cancel. An active subscription is cancelled at the end of its current period (cancelAtPeriodEnd becomes true). A subscription still awaiting its first payment is checked with the payment provider first: unpaid, it and its checkout expire now; already paid, the cancellation is refused with 409 BIZ004. A plan change scheduled for the period end is withdrawn with the cancellation; a plan change awaiting payment stays open.
Who can call it: Signed-in user only: do this in the Yona app.
Parameters
| Name | In | Type | Required | Description |
|---|---|---|---|---|
id | path | string | Yes |
Request body
| Field | Type | Required | Description |
|---|---|---|---|
reason | string | No | Why the subscription is being cancelled. At most 500 characters. |
Example request
Responses
The subscription after the cancellation.
Errors: 400, 401, 403, 404, 409, 413, 415, 429, 500, 503
Change the plan of a subscription
PUT /b/v1/subscriptions/{id}/change-plan
Tenant user only, billing.subscription.change_plan. immediate: false (the default) schedules the change for the end of the current period: no money moves now, and the next period is charged at the new price. immediate: true (from a live-mode session) starts a hosted checkout for the new price less the value of the paid period’s allowance windows not yet issued; nothing about the current subscription changes until that payment settles, when the new plan starts a full period. The subscription in the answer is the one named by :id, unchanged. Optional Idempotency-Key header: the same key and body return the stored change; the same key with another body or subscription is 409 BIZ107. newPlanCode is a public plan on sale, or the plan code of the Enterprise deal offered to this organization (GET /v1/deals/offer): a credits-plan organization, which cannot take its deal now (period_end_only), schedules it here for its period end; staff withdrawing the deal withdraws the schedule. Another organization’s deal, or a withdrawn one, is 404 RES001. Every 409 carries one reason in meta.errors ([{ "<reason>": "<message>" }]): feature_disabled, free_subscription, same_plan, currency_change, period_end_only, window_boundary_near, payment_not_clear, paid_by_partner, partner_plan (BIZ104); not_active, cancel_scheduled (BIZ004); checkout_in_progress (BIZ103).
Who can call it: Signed-in user only: do this in the Yona app.
Parameters
| Name | In | Type | Required | Description |
|---|---|---|---|---|
id | path | string | Yes | |
Idempotency-Key | header | string | No | Optional; the same key and body replay the stored change. |
Request body
| Field | Type | Required | Description |
|---|---|---|---|
newPlanCode | string | Yes | The plan to move to: a paid, public plan, or the plan code of the Enterprise deal offered to this organization. |
interval | string | No | The new billing interval; absent keeps the subscription’s. One of monthly | yearly. |
immediate | boolean | No | true: change now — a hosted checkout for the new price less the credit for the paid period’s unissued allowance windows. false (default): change at the end of the current period. Default: false. |
returnPath | string | No | Dashboard path to return to after checkout; must be one of the allowed dashboard return paths. Absolute URLs are refused. |
Example request
Responses
A change scheduled for the period end, or the open change for the same target returned as it stands.
A change now awaiting payment: planChange.checkout says where to pay, and until when.
Errors: 400, 401, 403, 404, 409, 413, 415, 422, 429, 500, 503
Withdraw a plan change
DELETE /b/v1/subscriptions/{id}/change-plan
Tenant user only, billing.subscription.change_plan. Withdraws the subscription’s open change: a scheduled one at once; one awaiting payment after asking the payment provider — unpaid, its checkout expires; already paid, the change was applied and the answer is 409 BIZ004. Also allowed on a subscription that has ended while its change’s checkout was open. Works whether or not plan changes are switched on.
Who can call it: Signed-in user only: do this in the Yona app.
Parameters
| Name | In | Type | Required | Description |
|---|---|---|---|---|
id | path | string | Yes |
Example request
Responses
The subscription, with planChange: null.
Errors: 400, 401, 403, 404, 409, 429, 500, 503
Preview a plan change
GET /b/v1/subscriptions/{id}/change-plan/preview
Requires billing.subscription.read (a user or an API key). What changing now and at the period end would cost and when each would take effect, computed as the change itself would be; writes nothing. Advisory: a change now is quoted again when it is requested. Each timing says whether it is available and, if not, why; the numbers of a change now are given either way. newPlanCode may be the plan code of the Enterprise deal offered to this organization, quoted at its private price; another organization’s deal, or a withdrawn one, is 404 RES001.
Who can call it: API key or signed-in user.
Parameters
| Name | In | Type | Required | Description |
|---|---|---|---|---|
id | path | string | Yes | |
newPlanCode | query | string | Yes | |
interval | query | string | No | The new billing interval; absent keeps the subscription’s. One of monthly | yearly. |
Example request
Responses
The quote of both timings.
Errors: 400, 401, 403, 404, 409, 422, 429, 500, 503
Renew a past-due subscription
POST /b/v1/subscriptions/{id}/renew
Tenant user only, billing.subscription.renew, from a live-mode session. Starts a hosted checkout to pay the overdue period of a past_due subscription. A partner whose renewal costs nothing under its own terms renews at once with nothing to pay (unless a checkout opened for it earlier can still be paid). Optional Idempotency-Key header: the same key and body return the original checkout; the same key with another body is 409 BIZ107.
Who can call it: Signed-in user only: do this in the Yona app.
Parameters
| Name | In | Type | Required | Description |
|---|---|---|---|---|
id | path | string | Yes |
Request body
| Field | Type | Required | Description |
|---|---|---|---|
returnPath | string | No | Dashboard path to return to after checkout; must be one of the allowed dashboard return paths. Absolute URLs are refused. |
Example request
Responses
The same checkout is still pending and is returned again; or the same request under its Idempotency-Key, done earlier with nothing to pay, is answered again.
A new checkout was started: the subscription, the payment and the checkout URL. Or, when it costs nothing, it is done at once: no payment and no checkout URL, amountMinor 0.
Errors: 400, 401, 403, 404, 409, 413, 415, 422, 429, 500, 503
Resume a subscription
PUT /b/v1/subscriptions/{id}/resume
Tenant user only, billing.subscription.resume. Clears a cancellation scheduled for the end of the current period; a plan change the cancellation withdrew does not come back.
Who can call it: Signed-in user only: do this in the Yona app.
Parameters
| Name | In | Type | Required | Description |
|---|---|---|---|---|
id | path | string | Yes |
Example request
Responses
The subscription after the cancellation was cleared.
Errors: 400, 401, 403, 404, 409, 429, 500, 503
Get a payment
GET /b/v1/payments/{id}
One payment of the organization. Requires billing.payment.read. checkoutUrl is present only while the payment is pending. Another organization’s payment answers 404 RES001.
Who can call it: API key or signed-in user.
Parameters
| Name | In | Type | Required | Description |
|---|---|---|---|---|
id | path | string | Yes |
Example request
Responses
The payment.
Errors: 400, 401, 403, 404, 429, 500, 503
List payments
GET /b/v1/payments/history
The organization’s payments, newest first, optionally filtered by status and kind. Requires billing.payment.read. No checkout URL in the list.
Who can call it: API key or signed-in user.
Parameters
| Name | In | Type | Required | Description |
|---|---|---|---|---|
page | query | number | No | Page number (1-based). Default: 1. At least 1. |
limit | query | number | No | Items per page. Default: 50. Between 1 and 100. |
status | query | string | No | One of pending | succeeded | failed | expired | partially_refunded | refunded | disputed | charged_back. |
kind | query | string | No | One of credit_purchase | subscription | renewal | sub_org_slot | overage_pack | partner_seat | partner_plan_change | service_fee | metered_topup | metered_statement | add_on_slots. |
Example request
Responses
A page of payments.
Errors: 400, 401, 403, 404, 429, 500, 503
Buy a credit package
POST /b/v1/payments/purchase
Tenant user only, billing.credits.purchase, from a live-mode session. Starts a hosted checkout for one credit package in the chosen currency; the credits are granted when the provider confirms the payment. Optional Idempotency-Key header: the same key and body return the original checkout; the same key with another body is 409 BIZ107.
Who can call it: Signed-in user only: do this in the Yona app.
Request body
| Field | Type | Required | Description |
|---|---|---|---|
packageId | string (uuid) | Yes | The package id listed by GET /plans/packages. |
currency | string | Yes | Required; 422 BIZ101 when no provider is routed for it. One of NGN | USD. |
returnPath | string | No | Dashboard path to return to after checkout; must be one of the allowed dashboard return paths. Absolute URLs are refused. |
Example request
Responses
The pending payment and its hosted checkout URL.
Errors: 400, 401, 403, 404, 409, 413, 415, 422, 429, 500, 503
Transfer purchased credits to or from a parent or child organization
POST /b/v1/payments/transfer
User principals only; billing.credits.transfer. Only purchased (or previously transferred) credits move; a transfer to a child never leaves the parent below its minimumReserve. Idempotent on (source organisation, Idempotency-Key). Free: no charge. Events: billing.credits.transferred on each party.
Who can call it: Signed-in user only: do this in the Yona app.
Parameters
| Name | In | Type | Required | Description |
|---|---|---|---|---|
Idempotency-Key | header | string | Yes | Same key + same body → the original result (replayed: true); another body → 409 BIZ107. |
Request body
| Field | Type | Required | Description |
|---|---|---|---|
targetOrganizationId | string (uuid) | Yes | The caller’s parent, or one of its children. |
amount | integer | Yes | Whole credits, from 1 up to the environment’s transfer limit (10 000 000 by default). At least 1. |
description | string | No | Shown on both organizations’ ledger entries; trimmed. At most 500 characters. |
Example request
Responses
The transfer (or the original one, replayed: true).
Errors: 400, 401, 402, 403, 404, 409, 413, 415, 429, 500, 503
List ledger entries
GET /b/v1/transactions
Credit ledger entries (grants, charges, holds, refunds, expiries…), newest first, filtered by kind or family of kinds (group), date range, cost code or exact reference. With holds=collapse a charge taken through a hold reads once: the entries of a settled hold are left out and the charge’s hold says what was reserved. Requires billing.ledger.read. Reads the ledger of the token’s mode unless mode names another; an API key may read only its own mode (403 BIZ108).
Who can call it: API key or signed-in user.
Parameters
| Name | In | Type | Required | Description |
|---|---|---|---|---|
page | query | number | No | Page number (1-based). Default: 1. At least 1. |
limit | query | number | No | Items per page. Default: 50. Between 1 and 100. |
type | query | string | No | One of grant_plan | grant_purchase | grant_allowance | grant_adjustment | charge | hold | hold_release | refund | clawback | adjustment_debit | expiry | debt_settlement | transfer_out | transfer_in | pool_out | pool_in | pool_return_out | pool_return_in | included. |
group | query | string | No | Only the entries of one family: spend (a charge with its hold and release), refund, purchase, plan (plan allocations), allowance (the sandbox allowance), transfer, pool (the credit pool), adjustment, expiry or reversal (payment reversals and debt settlements). Combined with type, both must match. One of spend | refund | purchase | plan | allowance | transfer | pool | adjustment | expiry | reversal. |
holds | query | string | No | show lists every entry as written. collapse leaves out the hold and hold_release entries of a hold that has settled, so a charge taken through a hold reads once (its hold field keeps what was reserved); a hold still open stays in the list. total counts what is listed. One of show | collapse. Default: show. |
mode | query | string | No | Defaults to the token’s mode; API keys may only name their own (403 BIZ108). One of sandbox | live. |
startDate | query | string (date-time) | No | |
endDate | query | string (date-time) | No | |
costCode | query | string | No | |
reference | query | string | No | Exact business reference of the entry (no prefix or wildcard match). At most 255 characters. |
Example request
Responses
A page of ledger entries.
Errors: 400, 401, 403, 404, 429, 500, 503
Get a ledger entry
GET /b/v1/transactions/{id}
One ledger entry of the organization. Requires billing.ledger.read. Another organization’s entry answers 404 RES001.
Who can call it: API key or signed-in user.
Parameters
| Name | In | Type | Required | Description |
|---|---|---|---|---|
id | path | string | Yes |
Example request
Responses
The ledger entry.
Errors: 400, 401, 403, 404, 429, 500, 503
Get credit usage over time
GET /b/v1/transactions/analytics/usage
Credits spent per daily, weekly (ISO week) or monthly UTC bucket over a date range (the last 30 days by default, at most 366 days). Requires billing.usage.read. Reads the ledger of the token’s mode unless mode names another; an API key may read only its own mode (403 BIZ108).
Who can call it: API key or signed-in user.
Parameters
| Name | In | Type | Required | Description |
|---|---|---|---|---|
mode | query | string | No | One of sandbox | live. |
startDate | query | string (date-time) | No | |
endDate | query | string (date-time) | No | At most 366 days after startDate. |
period | query | string | No | One of daily | weekly | monthly. Default: daily. |
Example request
Responses
One row per time bucket.
Errors: 400, 401, 403, 404, 429, 500, 503
Get credit usage by cost code
GET /b/v1/transactions/breakdown/by-endpoint
Credits spent per cost code, net of refunds, over a date range (the last 30 days by default, at most 366 days). Requires billing.usage.read. Reads the ledger of the token’s mode unless mode names another; an API key may read only its own mode (403 BIZ108).
Who can call it: API key or signed-in user.
Parameters
| Name | In | Type | Required | Description |
|---|---|---|---|---|
mode | query | string | No | One of sandbox | live. |
startDate | query | string (date-time) | No | |
endDate | query | string (date-time) | No | At most 366 days after startDate. |
Example request
Responses
One row per cost code.
Errors: 400, 401, 403, 404, 429, 500, 503
Get a monthly statement
GET /b/v1/statements/{period}
One UTC month (YYYY-MM, not in the future) of one ledger: opening and closing balance, grants by source, charges by cost code, refunds, expiries and held credits; payments on live statements. Requires billing.statement.read. Reads the ledger of the token’s mode unless mode names another; an API key may read only its own mode (403 BIZ108).
Who can call it: API key or signed-in user.
Parameters
| Name | In | Type | Required | Description |
|---|---|---|---|---|
period | path | string | Yes | |
mode | query | string | No | Which ledger to read. Defaults to the token’s mode. API keys may only name their own mode (403 BIZ108). One of sandbox | live. |
Example request
Responses
The statement.
Errors: 400, 401, 403, 404, 429, 500, 503
Top up sandbox test credits (capped, no payment)
POST /b/v1/sandbox/topup
Tenant user only, billing.credits.purchase. Grants test credits on the sandbox ledger (never live), expiring with the UTC month. At most the configured per-top-up cap (1,000 credits by default) per top-up, and at most the configured number of top-ups (3 by default) per organization per UTC month. Not idempotent by key: each accepted call is one of the month’s top-ups.
Who can call it: Signed-in user only: do this in the Yona app.
Request body
| Field | Type | Required | Description |
|---|---|---|---|
credits | integer | No | Test credits to add to the sandbox ledger, from 1 up to the per-top-up cap (1,000 by default); absent means the cap. At least 1. |
Example request
Responses
The grant entry and the month’s top-up count.
Errors: 400, 401, 403, 404, 413, 415, 429, 500, 503
List sandbox ledger entries
GET /b/v1/sandbox/transactions
The sandbox ledger’s entries, newest first, with the same filters as the ledger entry list. Requires billing.ledger.read. A live-mode API key is refused with 403 BIZ108.
Who can call it: API key or signed-in user.
Parameters
| Name | In | Type | Required | Description |
|---|---|---|---|---|
page | query | number | No | Page number (1-based). Default: 1. At least 1. |
limit | query | number | No | Items per page. Default: 50. Between 1 and 100. |
type | query | string | No | One of grant_plan | grant_purchase | grant_allowance | grant_adjustment | charge | hold | hold_release | refund | clawback | adjustment_debit | expiry | debt_settlement | transfer_out | transfer_in | pool_out | pool_in | pool_return_out | pool_return_in | included. |
group | query | string | No | Only the entries of one family: spend (a charge with its hold and release), refund, purchase, plan (plan allocations), allowance (the sandbox allowance), transfer, pool (the credit pool), adjustment, expiry or reversal (payment reversals and debt settlements). Combined with type, both must match. One of spend | refund | purchase | plan | allowance | transfer | pool | adjustment | expiry | reversal. |
holds | query | string | No | show lists every entry as written. collapse leaves out the hold and hold_release entries of a hold that has settled, so a charge taken through a hold reads once (its hold field keeps what was reserved); a hold still open stays in the list. total counts what is listed. One of show | collapse. Default: show. |
startDate | query | string (date-time) | No | |
endDate | query | string (date-time) | No | |
costCode | query | string | No | |
reference | query | string | No | Exact business reference of the entry (no prefix or wildcard match). At most 255 characters. |
Example request
Responses
A page of sandbox ledger entries.
Errors: 400, 401, 403, 404, 429, 500, 503
Get sandbox allowance usage
GET /b/v1/sandbox/usage
This UTC month’s free sandbox allowance: granted, used and remaining. Requires billing.usage.read. A live-mode API key is refused with 403 BIZ108.
Who can call it: API key or signed-in user.
Example request
Responses
The month’s sandbox allowance.
Errors: 401, 403, 404, 429, 500, 503
Get the billing overview
GET /b/v1/setup
The dashboard’s billing overview in one call: the current subscription, the account, balances, the sandbox allowance and the plans on offer priced in the account’s currency (integer minor units). Requires billing.account.read. An API key sees only its own mode’s blocks.
Who can call it: API key or signed-in user.
Example request
Responses
The billing overview.
Errors: 401, 403, 404, 429, 500, 503