Skip to main content
GET
https://api.apimart.ai
/
v1
/
balance
curl --request GET \
  --url 'https://api.apimart.ai/v1/balance' \
  --header 'Authorization: Bearer <token>'
{
  "success": true,
  "remain_balance": 10.5,
  "used_balance": 2.3,
  "unlimited_quota": false
}
Get the remaining and used balance of the current API Key (token). This endpoint is used to monitor the usage of a single token.
curl --request GET \
  --url 'https://api.apimart.ai/v1/balance' \
  --header 'Authorization: Bearer <token>'
{
  "success": true,
  "remain_balance": 10.5,
  "used_balance": 2.3,
  "unlimited_quota": false
}

Authorization

Authorization
string
required
All API endpoints require Bearer Token authenticationGet your API Key:Visit the API Key Management Page to get your API KeyAdd it to the request header:
Authorization: Bearer YOUR_API_KEY

Endpoints

GET /v1/balance
GET /balance
Both endpoints have the same functionality, you can use either one.

Response

success
boolean
Whether the request was successful
message
string
Error message (only returned on failure)
remain_balance
float
Token remaining balance (returned on success). Returns -1 when unlimited_quota is true
used_balance
float
Token used balance (returned on success)
unlimited_quota
boolean
Whether the token has unlimited quota. true means unlimited, false means limited

Use Cases

  • Monitor consumption of a single API Key
  • Display current token balance in your application
  • Set up balance alerts when balance falls below threshold
Balance Unit InformationThe unit of the balance value depends on system configuration:
  • USD - US Dollars
  • CNY - Chinese Yuan
  • Tokens - Token count
Unlimited Quota TokenWhen a token is set to unlimited quota:
  • unlimited_quota field returns true
  • remain_balance field returns -1
  • The token has no quota restrictions and can be used without limits

Common Errors

Error MessageCauseSolution
No Authorization headerAuthorization header not providedAdd Authorization: Bearer sk-xxxxx header
Failed to get token infoToken doesn’t exist or has been deletedCheck if the token key is correct
Security NoteYour API Key is like a password. Keep it secure and don’t share it with others. Always use HTTPS in production.