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
Authorizationheader 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.
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.