Balance
Read the current credit balance for the bearer in the Authorization header. Returns integer credits at 1,000,000 credits = $1.00.
GEThttps://api.usequota.ai/v1/balance
Authorization#
Send a Quota-issued bearer token. The endpoint returns whoever the bearer is — there is no “current user” concept.
| sk-quota-…API key | Returns the developer's own wallet balance and plan. |
| quota_token_…OAuth access token | Returns the signed-in user's wallet balance. Requires the credits.read scope. |
Get developer balance#
Default behaviour for an API key. No parameters required.
curl https://api.usequota.ai/v1/balance \
-H "Authorization: Bearer sk-quota-your-api-key"{
"wallet": "developer",
"developer_balance": 98500000,
"plan": "free",
"user_id": "bc9aac4f-6b9d-4f1c-9c91-6b3e21a4f0a2",
"billing_mode": "developer"
}Get a user's balance#
Pass the user's OAuth access token instead of the developer API key. The user must have granted the credits.read scope at consent time.
curl https://api.usequota.ai/v1/balance \
-H "Authorization: Bearer quota_token_…"{
"wallet": "oauth_user",
"balance": 4250000,
"plan": "starter",
"user_id": "ce4f1c91-6b3e-21a4-f0a2-bc9aac4f6b9d",
"billing_mode": "developer"
}Response fields#
| walletstring | Discriminator. Either "developer" or "oauth_user". Branch on this field before reading the balance. |
| developer_balanceinteger | Developer wallet balance in credits. Present when wallet === "developer". 1 credit = $0.000001. |
| balanceinteger | User wallet balance in credits. Present when wallet === "oauth_user". |
| billing_modestring | Echoes the API key's configured billing mode. Useful when the same key handles both flows. |
| user_idstring | The bearer's account UUID — developer or OAuth user, matching the wallet field. |
| planstring | The account's current plan, e.g. "free". |
Error responses#
401invalid_api_keyMissing or invalid bearer token.
403insufficient_scopeOAuth token missing the credits.read scope. Re-run consent with credits.read added.
All errors return a JSON body:
{
"error": {
"code": "invalid_api_key",
"message": "Not authenticated"
}
}