HTTP 415 Unsupported Media Type — What It Means and How to Fix It

The HTTP 415 (Unsupported Media Type) status code indicates that the server refuses to accept the request because the payload format is in an unsupported format. This typically occurs when the client sends data with a `Content-Type` header that the server does not understand or is not configured to process for the requested resource.

Last updated: 2026-06-11

RECOMMENDED

Essential Reading: Designing Data-Intensive Applications

The system design bible for software engineers. Learn to build reliable, scalable, and maintainable systems.

View on Amazon →
Status Code 415
Name Unsupported Media Type

Common Causes

  • Incorrect `Content-Type` header in the request (e.g., sending JSON with `Content-Type: text/plain`).
  • Missing `Content-Type` header when one is expected by the server.
  • The server's API or endpoint only accepts specific media types, and the client sent a different one.
  • The server is configured to reject certain media types for security or processing reasons.

Code Examples to Handle HTTP 415

curl -I https://httpbin.org/status/415

How to Fix It

  1. **Client-side:** Verify the `Content-Type` header in your request. Ensure it accurately reflects the format of the data being sent (e.g., `application/json`, `application/xml`, `multipart/form-data`).
  2. **Client-side:** Consult the API documentation for the specific endpoint you are calling to determine the expected media types. Adjust your request accordingly.
  3. **Server-side:** Check the server-side code or configuration for the endpoint. Ensure it is set up to correctly parse and accept the `Content-Type` you are sending. This might involve adding parsers or updating middleware.
  4. **Server-side:** If using a framework, review its body parser configurations. For example, in Node.js with Express, ensure `express.json()` or `express.urlencoded()` are correctly applied if expecting JSON or URL-encoded data.
💡 Example: A client attempts to create a new user by sending a POST request to `/api/users` with a JSON payload, but mistakenly sets the `Content-Type` header to `text/plain`. The server, expecting `application/json`, rejects the request with a 415 status code.
🛠️ Developer Tip: Always explicitly set the `Content-Type` header in your requests when sending a body, and ensure it matches the actual data format. On the server, validate incoming `Content-Type` headers and provide clear error messages.

Related Status Codes

Frequently Asked Questions

What causes HTTP 415?

HTTP 415 is caused when the server receives a request with a payload in a format it doesn't support or isn't configured to process, as indicated by the `Content-Type` header.

How do I fix HTTP 415?

To fix HTTP 415, ensure the `Content-Type` header in your request accurately reflects the data format you're sending (e.g., `application/json` for JSON). If you're the server owner, verify your server-side code or configuration supports the expected media types.