The server refuses the request because the Content-Type is not supported.
The server is refusing to accept the request because the payload format (indicated by the Content-Type header) is not supported for the target resource. For example, sending XML to an endpoint that only accepts JSON, or posting form data when the API expects application/json.
A 415 error occurs when the Content-Type header in your request doesn't match what the server expects. This is extremely common in API development, especially when switching between tools (Postman, curl, fetch) that set Content-Type differently by default.
The server understands the request, and the body might even be valid data, but it refuses to process it because the declared media type is not one it can handle for that endpoint.
application/x-www-form-urlencoded when the API expects application/jsonapplication/json instead of multipart/form-data for file uploadsapplicaiton/json)Platform-Specific Notes:
Node.js Express requires explicit body parser middleware for each content type. Missing express.json() middleware causes 415 for JSON requests.
Nginx Does not generate 415 natively. Usually passed through from the application backend. Nginx doesn't parse request bodies by default.
Apache Can restrict accepted content types using mod_mime or application-level validation. PHP will attempt to parse most content types.
Cloudflare Passes Content-Type through to the origin. Workers can validate and reject unsupported media types before they reach your server.
application/json for JSON, multipart/form-data for file uploads; charset=utf-8 to the Content-Typecurl -H "Content-Type: application/json" -d '{"key":"value"}' to isolate the issue# Client sends form-urlencoded data to a JSON-only API POST /api/users HTTP/1.1 Host: api.example.com Content-Type: application/x-www-form-urlencoded name=John&email=john@example.com # Server Response (only accepts application/json) HTTP/1.1 415 Unsupported Media Type Content-Type: application/json Accept: application/json { "error": "Unsupported Media Type", "message": "Content-Type 'application/x-www-form-urlencoded' is not supported. Use 'application/json'.", "accepted_types": ["application/json"], "statusCode": 415 }
Content-Type: application/json for JSON request bodies. This is the standard for REST APIs. Make sure the request body is valid JSON and the header is spelled correctly. Some APIs also accept application/json; charset=utf-8 which explicitly specifies UTF-8 encoding. When using JavaScript's fetch(), set it explicitly: headers: { 'Content-Type': 'application/json' }.Content-Type: multipart/form-data with a boundary parameter. If you're using a library like Axios or fetch with FormData, let the browser set the Content-Type automatically - don't set it manually, as it needs to include the boundary string. If the API expects raw binary upload, use the file's actual MIME type (e.g., image/png, application/pdf).Content-Type header value is not accepted by the server - the format is wrong. 400 Bad Request is more general and usually means the request body itself is malformed, missing required fields, or has invalid data. If the Content-Type is correct but the body is invalid, you'll get 400. If the Content-Type header itself is wrong, you'll get 415.Detect content-type mismatches, broken endpoints, and misconfigured APIs across your website.
Start Free Scan