# Grok API Error Codes

{% embed url="<https://docs.x.ai/docs/key-information/debugging>" %}

<table><thead><tr><th width="130.06669108072919" valign="top">Error Codes</th><th width="275.199951171875" valign="top"></th><th valign="top"></th></tr></thead><tbody><tr><td valign="top"><strong>400</strong></td><td valign="top">Bad Request</td><td valign="top"><ul><li>A <code>POST</code> method request body specified an invalid argument, or a <code>GET</code> method with dynamic route has an invalid param in the URL.</li><li>An incorrect API key is supplied.</li><li>Please check your request body or request URL.</li></ul></td></tr><tr><td valign="top"><strong>401</strong></td><td valign="top">Unauthorized</td><td valign="top"><ul><li>No authorization header or an invalid authorization token is provided.</li><li>Supply an <code>Authorization: Bearer Token &#x3C;XAI_API_KEY></code> in the request header. You can get a new API key on <a href="https://console.x.ai/">xAI Console</a>.</li></ul></td></tr><tr><td valign="top"><strong>403</strong></td><td valign="top">Forbidden</td><td valign="top"><ul><li>Your API key/team doesn't have permission to perform the action.</li><li>Your API key/team is blocked.</li><li>Ask your team admin for permission.</li></ul></td></tr><tr><td valign="top"><strong>404</strong></td><td valign="top">Not Found</td><td valign="top"><ul><li>A model specified in a <code>POST</code> method request body is not found.</li><li>Trying to reach an invalid endpoint URL. (Misspelled URL).</li><li>Check your request body and endpoint URL with our <a href="https://docs.x.ai/docs/key-information/api-reference">API Reference</a>.</li></ul></td></tr><tr><td valign="top"><strong>405</strong></td><td valign="top">Method Not Allowed</td><td valign="top"><ul><li>The request method is not allowed. For example, sending a <code>POST</code> request to an endpoint supporting only <code>GET</code>.</li><li>Check your request method with our <a href="https://docs.x.ai/docs/key-information/api-reference">API Reference</a>.</li></ul></td></tr><tr><td valign="top"><strong>415</strong></td><td valign="top">Unsupported Media Type</td><td valign="top"><ul><li>An empty request body in <code>POST</code> requests.</li><li>Not specifying <code>Content-Type: application/json</code> header.</li><li>Add a valid request body.</li><li>Ensure <code>Content-Type: application/json</code> header is present in the request header.</li></ul></td></tr><tr><td valign="top"><strong>422</strong></td><td valign="top">Unprocessable Entity</td><td valign="top"><ul><li>An invalid format for a field in the <code>POST</code> request body.</li><li>Check your request body is valid. You can find more information from <a href="https://docs.x.ai/docs/key-information/api-reference">API Reference</a>.</li></ul></td></tr><tr><td valign="top"><strong>429</strong></td><td valign="top">Too Many Requests</td><td valign="top"><ul><li>You are sending requests too frequently and reaching rate limit</li><li>Reduce your request rate or increase your rate limit. You can find your current rate limit on <a href="https://console.x.ai/">xAI Console</a>.</li></ul></td></tr><tr><td valign="top"><strong>202</strong></td><td valign="top">Accepted</td><td valign="top"><ul><li>Your deferred chat completion request is queued for processing, but the response is not available yet.</li><li>Wait for request processing.</li></ul></td></tr></tbody></table>
