Get the credit balance
Returns your organization's spendable credit position: the credits you can draw on right now, split by where they came from, and any amount owed.
Fields:
-
available_creditsis what you can spend now: the sum of your granted and pay-as-you-go credits. bucket_creditsare credits granted by your plan and promotions.-
wallet_creditsare pay-as-you-go credits funded by your wallet balance, drawn once your granted credits are used up. -
receivable_amountis the amount owed for pay-as-you-go usage not yet settled, in the currency's minor units.
An organization that has never been granted or drawn credits reads an all-zero balance.
Permissions
| Key type | Accepted | Permission required | Notes |
|---|---|---|---|
| Org API key | yes | billing:read |
Key must be scoped to the org whose balance is read |
| Personal API key | yes | billing:read |
Requires X-Org-ID; caller needs a role granting billing:read |
Error Codes
| Code | HTTP | Description |
|---|---|---|
| credit.handler.identity_missing | 401 | An authenticated organization identity is required |
| credit.balance.not_provisioned | 409 | Billing is not set up for this organization |
| credit.balance.currency_changed | 409 | The organization's billing currency changed; contact support |
| credit.balance.failed | 500 | Failed to read the credit balance |
Responses
- application/json
- application/json
- application/json
- application/json
Request Example for get/credits
curl https://api.nametrust.com/credits
{
"object": "credit_balance",
"currency": "USD",
"available_credits": 1840,
"bucket_credits": 1500,
"wallet_credits": 340,
"receivable_amount": 0
}