Core APIs/Account

Get Account Balances

GET

Overview

Read the current API credit balance for the authenticated account. Use this endpoint before large batch jobs or after task completion if you need to show remaining credits in your own dashboard.

Authentication

All API requests require a Bearer token in the request header.

Authorization: Bearer YOUR_API_KEY

Create and manage API keys from API Keys or use https://www.apimall.ai/api-keys.

Request

API Information

  • URL: GET https://gateway.apimall.ai/api/v1/account/balances

Response Example

{
  "success": true,
  "data": {
    "credits": 120,
    "api_credits": 120
  },
  "request_id": "req_01HQ9M7J7X9P7Y8T6W5V4U3S2R"
}

cURL Example

curl --request GET 'https://gateway.apimall.ai/api/v1/account/balances' \
  --header 'Authorization: Bearer YOUR_API_KEY'

JavaScript Example

const API_KEY = process.env.APIMALL_API_KEY;

const response = await fetch('https://gateway.apimall.ai/api/v1/account/balances', {
  headers: {
    Authorization: `Bearer ${API_KEY}`,
  },
});

if (!response.ok) {
  throw new Error(`Request failed: ${response.status} ${response.statusText}`);
}

const data = await response.json();
console.log(data);

Response Parameters

ParameterTypeDescription
success
boolean

Whether the request completed successfully.

data.credits
integer

credits field returned by the API.

data.api_credits
integer

Current API credits available to the authenticated account.

request_id
string

Request identifier for debugging and support.

Error Response Example

{
  "success": false,
  "error": {
    "code": "unauthorized",
    "message": "Unauthorized"
  },
  "request_id": "req_01HQ9M7J7X9P7Y8T6W5V4U3S2R"
}

Integration Notes

  • Store your API key on the server side only.

Error Codes

Common Error Codes

Status CodeDescription
200Request successful
401API key required or invalid API key
403API access not approved or request made on a non-gateway host
404Resource not found
429Rate limit exceeded
500Internal server error
Get Account Balances - API Reference | API Mall | API Mall