Grok API Error Codes
400
Bad Request
A
POSTmethod request body specified an invalid argument, or aGETmethod with dynamic route has an invalid param in the URL.An incorrect API key is supplied.
Please check your request body or request URL.
401
Unauthorized
No authorization header or an invalid authorization token is provided.
Supply an
Authorization: Bearer Token <XAI_API_KEY>in the request header. You can get a new API key on xAI Console.
403
Forbidden
Your API key/team doesn't have permission to perform the action.
Your API key/team is blocked.
Ask your team admin for permission.
404
Not Found
A model specified in a
POSTmethod request body is not found.Trying to reach an invalid endpoint URL. (Misspelled URL).
Check your request body and endpoint URL with our API Reference.
405
Method Not Allowed
The request method is not allowed. For example, sending a
POSTrequest to an endpoint supporting onlyGET.Check your request method with our API Reference.
415
Unsupported Media Type
An empty request body in
POSTrequests.Not specifying
Content-Type: application/jsonheader.Add a valid request body.
Ensure
Content-Type: application/jsonheader is present in the request header.
422
Unprocessable Entity
An invalid format for a field in the
POSTrequest body.Check your request body is valid. You can find more information from API Reference.
429
Too Many Requests
You are sending requests too frequently and reaching rate limit
Reduce your request rate or increase your rate limit. You can find your current rate limit on xAI Console.
202
Accepted
Your deferred chat completion request is queued for processing, but the response is not available yet.
Wait for request processing.