Debug Grok API errors
Debug Grok API errors
A failed request returns a status code plus an error message. Check https://status.x.ai (RSS: https://status.x.ai/feed.xml) when the failure looks like an outage. Typical per-endpoint codes live in the API Reference.
4XX
| Status | Endpoints | Cause | Solution |
|---|---|---|---|
| 400 Bad Request | All | Check the request body or URL. | |
| 401 Unauthorized | All | Missing or invalid authorization token. | Send Authorization: Bearer <key>. Mint a key in the xAI Console. |
| 403 Forbidden | All | Ask the team admin for permission. | |
| 404 Not Found | All | Check the body and endpoint URL against the API Reference. | |
| 405 Method Not Allowed | All | Wrong HTTP method (for example POST to a GET-only route). |
Match the method in the API Reference. |
| 415 Unsupported Media Type | POST endpoints | ||
| 422 Unprocessable Entity | POST endpoints | A field in the POST body has an invalid format. | Check the body against the API Reference. |
| 429 Too Many Requests | Inference | Request rate hit the limit. | Slow down, or raise the limit in the xAI Console. |
2XX that still means wait
| Status | Endpoints | Cause | Solution |
|---|---|---|---|
| 202 Accepted | /v1/chat/deferred-completion/{request_id} |
Deferred chat completion is queued; the response is not ready. | Poll until processing finishes. |
Most error bodies explain themselves. For 429, pair this with send-async-concurrent-requests (semaphore) or the Batch API. For 202, see run-deferred-chat-completion.
Bug report
Email the API request, response, and relevant logs to support@x.ai. You can also ask in the #help channel of the xAI API Developer Discord.
Pitfalls
- 202 on the deferred-completion GET is success-but-not-ready, not a failure.
- 401 is almost always a missing
Authorization: Bearerheader or a bad key. - 429 is a rate limit. The async docs say you cannot exceed the console cap with concurrency.
- Service status is also shown in the docs site navigation bar.
- Console API credits are separate from SuperGrok's weekly pool on grok.com.