Beginner Q&A: API returned 415? Your Content-Type is almost certainly wrong
HTTP 415 means the server does not support the request content format. The usual cause is a missing or wrong Content-Type, such as JSON without application/json, a hand-written multipart header without a boundary, or JSON sent as a form. Check headers against the endpoint type, then verify with a minimal request.
Short answer
415 Unsupported Media Type means the server refused the request because the content format is not supported. The cause may be the declared Content-Type or Content-Encoding, or a problem found while processing the content itself. Some servers are strict about Content-Type; for example, writing the charset as UTF8 instead of UTF-8 may make the media type invalid.1
For API users, 415 nearly always points to one thing: the content type you declared does not match what the endpoint expects, or what you actually sent.
Q1: The three most common mistakes
1. JSON without Content-Type
With curl -d '{...}', if you omit -H "Content-Type: application/json", curl sends it as a form by default. In MDN's examples, a missing Content-Type, or a JSON body labeled as URL-encoded form data, can both produce 415.1
curl https://www.salpx.com/v1/chat/completions \
-H "Authorization: Bearer $KEY" \
-H "Content-Type: application/json" \
-d '{"model":"<model name>","messages":[{"role":"user","content":"hi"}]}'
2. Hand-written multipart without a boundary
File upload endpoints such as image edits require multipart/form-data. A multipart Content-Type must carry a boundary parameter, and the delimiters in the body must match it.2 Setting Content-Type: multipart/form-data by hand without a boundary leaves the server unable to split the fields.
The safest approach is not to set the multipart Content-Type yourself; let the HTTP library generate it from the form, with the correct boundary.
3. The endpoint wants multipart and you sent JSON, or the reverse
Different endpoints of the same service can use different formats. On SalpX, text-to-image POST /v1/images/generations takes JSON, while image edits POST /v1/images/edits take multipart file uploads with fields image[], prompt, model and size.3 Sending the edit endpoint JSON, or the generation endpoint a form, can produce 415 or another 4xx.
Q2: How to investigate
- Print the
Content-Typeactually sent: many HTTP libraries set or override it, so what you wrote is not necessarily what goes out.
- Check the endpoint docs: does this endpoint want JSON or multipart?
- Check the charset spelling: if you need one, use the standard
charset=utf-8.
- Check compression: if you gzip the body and add
Content-Encoding, confirm the server supports it; if unsure, remove it.1
- Use curl as a minimal baseline: send the documented example as is, then swap your code back in step by step once it works.
Q3: Should 415 be retried?
No. A format problem does not change on retry. 415 can only be fixed by changing the request, so the program should fail with an error and print the request headers, with Authorization redacted.
How it differs from 400
415: the server does not accept this format, usually rejecting before parsing the body.400: the format is readable but the content is invalid, such as a JSON syntax error, a missing required field or an out-of-range value.
If fixing Content-Type turns a 415 into a 400, you have made progress: next, check the body content.
In one line
For 415, check Content-Type first. Declare application/json for JSON, let the library generate the multipart boundary, and match the format to the endpoint's docs.
Sources & attribution
This article references the public materials listed below. Analysis and wording are SalpX's own; quoted material remains the property of its original authors and publishers.
- 415 Unsupported Media Type - HTTP — MDN Web Docs · accessed 2026-11-28Note:MDN: 415 means the content format is unsupported, caused by Content-Type, Content-Encoding or the content itself; a missing or wrong Content-Type is the classic case.
- RFC 2046 Section 5.1.1: Common Syntax (multipart) — IETF / RFC Editor · accessed 2026-11-28Note:Multipart common syntax: a delimiter must start a line (after CRLF), that CRLF belongs to the delimiter, and the close delimiter appends --.
- SalpX API Reference — SalpX · accessed 2026-11-28Note:SalpX official docs: Base URL, Bearer auth, image size tiers, 4K model names, the clamp response header, and integration notes such as a 300s+ timeout, a 10 MB response budget and publicly downloadable reference images.
One key for Claude, GPT and 50+ models
The SalpX gateway is OpenAI-SDK compatible. Point base_url at https://www.salpx.com/v1 and you are done.