Skip to main content
To check your balance from code, call the balance endpoint with a system AccessToken. The AccessToken comes from account settings, not from Token management.
Replace the placeholder with your AccessToken before you run the command.

Why is the output garbled?

The response is compressed and cURL has not decoded it. Add --compressed, as in the command above. The same fix applies when jq reports Invalid numeric literal. Python requests and Node.js fetch decompress responses automatically.

Why do I get 401 Unauthorized?

The endpoint did not accept the credential. Check that:
  • The Authorization header is present and holds the complete AccessToken, with no extra spaces or line breaks.
  • You are sending the system AccessToken, not a model API key.
  • The AccessToken is still current. Generating a new AccessToken may invalidate the old one, so every service must use the latest one.
If the header looks correct, generate a new AccessToken in account settings under System Token, update your environment variable, and try again.

Does the console send balance alerts?

Build alerts on the balance endpoint: check the remaining quota on a schedule and let your own monitoring send the alert; see the script and cron example in Balance API monitoring recommendations.

How is an AccessToken different from an API key?

The two credentials are not interchangeable. Keep both on your server and out of source code, browser apps, and logs. To create, rotate, or revoke API keys, see API key management.