Reading your balance
Check what your organization can spend before you order, and read a campaign budget by its ID.
For AI agents: this page is available as Markdown, and every guide plus the API reference is in llms-full.txt.
An order is paid for from your On Me balance, so the question before any POST /v1/orders is whether there is enough in it. GET /v1/balance answers that for your organization, and takes an optional campaign_id to report a campaign's budget instead.
Your organization balance
Send the request with no parameters:
curl https://api.onme.com/v1/balance \
-H "Authorization: Bearer $ONME_API_KEY"{
"scope": "organization",
"spendable": 125000
}Balance object
- scopestringrequiredenum: organization | campaign
Whose funds
spendabledescribes.campaignonly when the campaign you asked for has a budget of its own; otherwise it spends the organization balance and this readsorganization. - spendableintegerrequired
The most an order may draw from this balance right now, in cents. An order whose total exceeds it is refused. Negative means that much must be added before anything can be sent.
spendable is an integer in US cents, so 125000 is $1,250.00. It is the whole answer: an order whose total exceeds it comes back insufficient_balance, with nothing created and nothing charged. It can be negative, which means that much has to be added before anything at all can be sent.
An organization that has never added funds gets zero, not an error. There is nothing wrong; there is simply no money yet.
Add funds under Billing in the business portal. There is no API for topping up, and the fuller picture — what you have added, what you have spent, and anything still clearing — lives there too.
A campaign's budget
Campaigns are created in the business portal, and a campaign can be given a budget of its own. Pass its ID to read that budget instead:
curl "https://api.onme.com/v1/balance?campaign_id=ocp-7mJ0fQ2a" \
-H "Authorization: Bearer $ONME_API_KEY"{
"scope": "campaign",
"spendable": 30000
}Not every campaign has a budget of its own. One that doesn't spends the organization balance directly, so that is what comes back — scope reads organization and spendable is your organization's:
{
"scope": "organization",
"spendable": 125000
}Read scope to know whose money the figure is, rather than assuming a campaign_id in the request means a campaign in the response.
A campaign ID we don't recognise — including one belonging to another organization, and a value that isn't shaped like an ID at all — is a 422 with parameter_invalid naming campaign_id. POST /v1/orders answers the same way for the same ID.
In the sandbox
GET /v1/balance works the same way with a sandbox key, against your sandbox funds. Those are credited without a card being charged, and a sandbox reset deletes them — after which the endpoint reports zero again. A reset clears campaign budgets too, so a campaign that had one reads back as spending the organization balance until you give it another.