Skip to main content
GET
https://api.apimart.ai
/
v1
/
user
/
balance
curl --request GET \
  --url 'https://api.apimart.ai/v1/user/balance' \
  --header 'Authorization: Bearer <token>'
{
  "success": true,
  "remain_balance": 100.0,
  "used_balance": 25.5,
  "unlimited_quota": false
}
Get the remaining and used balance of the current user account. This endpoint returns user-level balance information, independent of specific tokens, for viewing the overall account balance.
curl --request GET \
  --url 'https://api.apimart.ai/v1/user/balance' \
  --header 'Authorization: Bearer <token>'
{
  "success": true,
  "remain_balance": 100.0,
  "used_balance": 25.5,
  "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/user/balance
GET /user/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
User remaining balance (returned on success). Returns -1 when unlimited_quota is true
used_balance
float
User used balance (returned on success)
unlimited_quota
boolean
Whether the user has unlimited quota. true means unlimited, false means limited

Token Balance vs User Balance

ComparisonToken Balance (/v1/balance)User Balance (/v1/user/balance)
ScopeSingle tokenEntire user account
Data SourceToken’s RemainQuota and UsedQuotaUser’s quota and used_quota
Use CaseMonitor single API Key usageView overall account balance
Limited ByToken-level quota limitsUser-level quota limits

Use Cases

  • View overall user account balance
  • Set up recharge reminders and balance alerts
  • Display account balance in user dashboard
Balance Unit InformationThe unit of the balance value depends on system configuration:
  • USD - US Dollars
  • CNY - Chinese Yuan
  • Tokens - Token count
Unlimited Quota UserWhen a user is set to unlimited quota:
  • unlimited_quota field returns true
  • remain_balance field returns -1
  • The user has no quota restrictions and can use the API without limits

Common Errors

Error MessageCauseSolution
No Authorization headerAuthorization header not providedAdd Authorization: Bearer sk-xxxxx header
Failed to get user quotaUser doesn’t existCheck if the user associated with the token exists
Failed to get used quotaDatabase query errorContact admin to check system status
Security NoteYour API Key is like a password. Keep it secure and don’t share it with others. Always use HTTPS in production.