Getting Started
Debugging Errors
When you send a request, you would normally get a 200 OK response from the server with the expected response body.
If there has been an error with your request, or error with our service, the API endpoint will typically return an error code with error message.
If there is an ongoing service disruption, you can visit https://status.x.ai for the latest updates. The status is also available via RSS at https://status.x.ai/feed.xml.
The service status is also indicated in the navigation bar of this site.
Most of the errors will be accompanied by an error message that is self-explanatory. For typical status codes of each endpoint, visit API Reference.
Status Codes
Here is a list of potential errors and statuses arranged by status codes.
4XX Status Codes
| Status | Endpoints | Cause | Solution |
|---|---|---|---|
400 Bad Request | All endpoints |
| Check your request body or request URL. |
401 Unauthorized | All endpoints | No authorization header or an invalid authorization token was provided. | Supply an Authorization: Bearer <XAI_API_KEY> header. You can get a new API key on xAI Console. |
403 Forbidden | All endpoints |
| Ask your team admin for permission. |
404 Not Found | All endpoints |
| Check your request body and endpoint URL against the API Reference. |
405 Method Not Allowed | All endpoints | The request method is not allowed. For example, sending a POST to an endpoint that only supports GET. | Check your request method against the API Reference. |
415 Unsupported Media Type | Endpoints supporting POST |
|
|
422 Unprocessable Entity | Endpoints supporting POST | A field in the POST request body has an invalid format. | Check your request body against the API Reference. |
429 Too Many Requests | Inference endpoints | You are sending requests too frequently and have reached the rate limit. | Reduce your request rate or increase your rate limit on xAI Console. |
2XX Status Codes
| Status | Endpoints | Cause | Solution |
|---|---|---|---|
202 Accepted | /v1/chat/deferred-completion/{request_id} | Your deferred chat completion request is queued for processing, but the response is not yet available. | Wait for the request to finish processing. |
Bug Report
If you believe you have encountered a bug and would like to contribute to our development process, email API Bug Report to support@x.ai with your API request and response and relevant logs.
You can also chat in the #help channel of our xAI API Developer Discord.
Last updated: May 13, 2026