xAI API error
xAI API 415 Unsupported Media Type: what it means and how to fix it
Error message
415 Unsupported Media TypeRetry? Not statedLast verified 2 documented fixes1 source
What it means
Returned on endpoints supporting POST when the POST body is empty or the JSON content-type header is missing.
Causes
- The POST request has an empty body
- The Content-Type: application/json header is missing
How to fix it
- Fix 1.
Add a valid request body.
- Fix 2.
Set the JSON content-type header.
YAMLContent-Type: application/json
More xAI API errors
All 18 xAI API errorsFAQ
What does the xAI API error "415 Unsupported Media Type" mean?
Returned on endpoints supporting POST when the POST body is empty or the JSON content-type header is missing.
How do I fix xAI API "415 Unsupported Media Type"?
There are 2 documented fixes. Start with the first: Add a valid request body.
Should I retry xAI API "415 Unsupported Media Type"?
Not stated. The official docs do not say whether this error is retryable.
Sources
Last verified against 1 source: xAI API's official docs and official SDK repositories.
Newsletter
Know when the APIs change
One email per week. New model releases, API changes, what broke, and how developers are working around it.