What Is Status Code: 415 Unsupported Media Type? The Format Mismatch

What is HTTP 415 Unsupported Media Type? This guide explains this client error for incompatible data formats, how to fix it, and Content-Type header best practices.

INEZA Felin-Michel

INEZA Felin-Michel

14 October 2025

What Is Status Code: 415 Unsupported Media Type? The Format Mismatch

You're integrating with a new API. You carefully craft a JSON request with all the right data, send it off, and instead of the success response you expected, you get back a frustrating error: 415 Unsupported Media Type. You double-check your authentication, your endpoint URL, your data payload everything seems correct. So what went wrong?

The problem likely isn't with what you sent, but with how you told the server what you were sending. This common but often confusing status code is all about communication breakdowns in data format.

The 415 error is the server's way of saying, "I understand you're trying to send me data, but I don't speak this language. I was expecting you to send it in a different format that I can actually process."

If you're a developer working with APIs whether building them or consuming them understanding the 415 status code is crucial for smooth integrations and avoiding frustrating debugging sessions.

In this detailed guide, we’ll explore what the 415 Unsupported Media Type status code means, why it happens, typical scenarios, and practical ways to fix or avoid it. Whether you’re a developer dealing with API integrations or curious about how web communication works, this post will help you master 415 errors.

💡
If you want to make sure your API requests never fail due to incorrect media types, try Apidog today. It’s free to download, simple to use, and helps developers catch content-type mismatches instantly. With Apidog, you can simulate different headers, run automated tests, and collaborate with your team all in one place.
button

Alright, let’s jump in and clear the confusion around HTTP 415 once and for all.

The Problem: Speaking the Server's Language

Imagine you're mailing a letter to someone who only reads French. You could write the most eloquent, perfectly structured English letter, but if the recipient doesn't understand English, your message will be useless. The 415 error is the digital equivalent of this scenario.

Web servers are often built to understand specific data formats. They need to know what "language" the incoming data is written in so they can properly parse and process it. The Content-Type header is how the client tells the server what format the data is in.

What Does HTTP 415 Unsupported Media Type Actually Mean?

The 415 Unsupported Media Type status code indicates that the server understands the request, but it refuses to accept it because the payload format (media type) is in a format not supported by the server for the requested resource.

In simpler terms, your client (like Postman, Apidog, or your browser) is sending data in a format that the server doesn’t understand or is not configured to process.

The server is essentially saying: "I received your data, but I cannot process it because it's in a format I don't understand or support for this particular endpoint."

A typical 415 response looks like this:

HTTP/1.1 415 Unsupported Media TypeContent-Type: application/json
{
  "error": "Unsupported Media Type",
  "message": "The request payload format is not supported.",
  "supported_types": ["application/json", "application/xml"]
}

This tells you, “Hey! I got your request, but I can’t process this content type.”

This most commonly relates to the value of the Content-Type header in the HTTP request specifying the format of the data being sent (like JSON, XML, or multipart form data). Some servers might provide more helpful information about what formats they do support, while others might return a more generic error message.

Deep Dive: The Technical Definition (for the Curious)

According to the HTTP/1.1 specification (RFC 7231), Section 6.5.13 defines the 415 status code as:

“The 415 (Unsupported Media Type) status code indicates that the origin server is refusing to service the request because the payload is in a format not supported by this method on the target resource.”

The key point here:

The Heart of the Matter: The Content-Type Header

The Content-Type header is the crucial piece of information that determines whether you'll get a 415 error or a successful response. This header tells the server what kind of data you're sending in the request body.

Here are the most common content types you'll encounter:

Common Content-Type Values:

For JSON APIs:

For Form Data:

For XML:

For Plain Text:

How the 415 Error Occurs: A Step-by-Step Breakdown

Let's walk through exactly what happens when a 415 error occurs.

Step 1: The Client Sends a Request

A client application sends a request to a server API endpoint. For example, let's say we're trying to create a new user:

POST /api/users HTTP/1.1Host: api.example.comContent-Type: application/xmlContent-Length: 125
<user><name>John Doe</name><email>john@example.com</email></user>

Step 2: The Server Checks the Content-Type

The server receives the request and examines the Content-Type header. It sees application/xml and checks its configuration for the /api/users endpoint.

Step 3: The Server Realizes the Problem

The server's /api/users endpoint is configured to only accept application/json. It doesn't have an XML parser set up for this endpoint, and it doesn't know how to handle the incoming data.

Step 4: The 415 Response

Instead of trying to process the malformed data (which could lead to errors or security issues), the server responds with a 415 Unsupported Media Type status code.

Step 5: The Client Receives the Error

The client application receives the 415 response and needs to handle it appropriately usually by correcting the Content-Type header and resending the request.

Common Scenarios Where You Might Encounter 415

1. Uploading Files in APIs

If you try to upload an image using application/json instead of multipart/form-data, the server won’t understand the file content.

2. Custom APIs With Strict Validation

APIs with strict schema validation reject any request that doesn’t match their rules.

3. Mobile Apps Using Outdated SDKs

Sometimes older SDKs send requests with outdated headers, which modern APIs no longer support.

4. Cross-Origin Requests (CORS Issues)

Certain CORS configurations may restrict accepted content types, indirectly causing a 415 response.

The Role of Content-Type Header

The Content-Type header in HTTP requests tells the server what type of data the client is sending.

For example:

If this header is missing or says something the server can’t handle, you’ll likely see a 415 response.

Real-World Scenarios That Cause 415 Errors

Scenario 1: Missing Content-Type Header

POST /api/users HTTP/1.1Host: api.example.com

{"name": "John Doe", "email": "john@example.com"}

Many servers will reject this because there's no Content-Type header telling them how to interpret the data.

Scenario 2: Wrong Content-Type for the Data

POST /api/users HTTP/1.1Host: api.example.comContent-Type: application/x-www-form-urlencoded

{"name": "John Doe", "email": "john@example.com"}

The header says it's form data, but the body is JSON. This mismatch confuses the server.

Scenario 3: Server Doesn't Support the Format

POST /api/users HTTP/1.1Host: api.example.comContent-Type: application/xml
<user><name>John</name></user>

The server might only support JSON for this endpoint, even though the XML is well-formed.

Testing Content-Type Handling with Apidog

Let’s talk about how Apidog can make your life easier when dealing with these errors. Testing different content types and ensuring your API handles them correctly is where Apidog shines. It makes it incredibly easy to test these scenarios without writing complex code.

With Apidog, you can:

  1. Easily Set Content-Type Headers: Use Apidog's intuitive interface to select from common content types or specify custom ones.
  2. Test Multiple Formats: Quickly test the same endpoint with different content types (JSON, XML, form data) to see how your server responds.
  3. Validate Error Responses: Ensure your API returns proper 415 responses with helpful error messages when receiving unsupported formats.
  4. Test Edge Cases: Experiment with malformed content types, missing headers, or mismatched data to ensure your API handles them gracefully.
  5. Automate Content-Type Testing: Create test suites that automatically verify your API correctly accepts supported formats and properly rejects unsupported ones.
button

For example, when you set up a POST request in Apidog, it automatically applies the correct Content-Type based on your request body type (JSON, XML, form-data, etc.).

That means fewer surprises and no more 415 errors ruining your test sessions. This proactive testing can save hours of debugging and ensure your API behaves predictably.

415 vs. Other 4xx Errors: Knowing the Difference

It's important to distinguish 415 from other client errors:

Best Practices for Handling 415 Errors

For API Consumers (Client Developers):

For API Providers (Server Developers):

Example of a Well-Designed 415 Response:

HTTP/1.1 415 Unsupported Media TypeContent-Type: application/json
{
  "error": "unsupported_media_type",
  "message": "This endpoint only accepts application/json payloads.",
  "supported_types": ["application/json"],
  "documentation": "<https://api.example.com/docs/content-types>"
}

Common Content-Type Mistakes That Cause 415

Here are some pitfalls developers frequently fall into:

Mistake Description Example
Using wrong header name Typo or casing issue contenttype instead of Content-Type
Sending form data instead of JSON Server expects JSON only application/x-www-form-urlencoded
Forgetting charset Missing encoding info application/json; charset=utf-8
Sending empty body Missing required payload POST /api with no data
Using unsupported file types Wrong upload format Uploading .exe instead of .png

These seem small but can cause major request failures.

Common Fixes for 415 Errors

If you're encountering a 415 error, here are the most common solutions:

Add the Missing Content-Type Header:

POST /api/users HTTP/1.1Content-Type: application/json

Correct the Content-Type Header:

# Before (wrong):
Content-Type: text/plain
# After (correct):
Content-Type: application/json

Convert Your Data to a Supported Format:

If the server only accepts JSON, make sure you're sending proper JSON, not XML or form data.

Check for Typos:

# Wrong:
Content-Type: application/jason

# Correct:
Content-Type: application/json

Advanced Considerations

Content Negotiation

Some sophisticated APIs support content negotiation, where the client can specify what formats it can accept using the Accept header:

GET /api/users/123 HTTP/1.1Accept: application/json, application/xml;q=0.9

This tells the server "I prefer JSON, but I can accept XML if necessary."

Charset Parameter

For text-based formats, you might need to specify the character encoding:

Content-Type: application/json; charset=utf-8

Conclusion: The Importance of Clear Communication

The HTTP 415 Unsupported Media Type status code highlights a fundamental aspect of web communication: both parties need to agree on the "language" they're using to exchange data. It's not enough to send the right data you have to send it in the right format and properly announce what that format is.

HTTP 415 Unsupported Media Type is a key part of ensuring that servers only process expected and compatible data formats. Correctly handling Content-Type headers, following API specs, and testing with tools like Apidog can drastically reduce these errors.

Understanding and properly handling 415 errors will make you a more effective API consumer and a better API designer. By paying attention to content types and providing clear communication between clients and servers, you can avoid these frustrating errors and build more robust integrations. Remember APIs thrive on clear communication between the client and the server. If they speak the same “language” (in this case, media type), everything runs smoothly.

So the next time you encounter a 415 error, remember it's not a complex server failure it's a simple communication issue that's usually easy to fix. And when you're building or testing APIs, using a tool like Apidog will help you ensure that your content types are always correct, preventing these errors before they happen.

button

Explore more

How to Use GLM 4.5 with Claude Code

How to Use GLM 4.5 with Claude Code

Discover how to use GLM 4.5 with Claude Code for superior development. Follow our guide: Check models, create Zhipu AI account, generate API key, configure via script, verify with /status, and explore $3/month pricing. Ideal for efficient code generation and debugging.

14 October 2025

What Is Status Code: 414 URI Too Long? When URLs Overstay Their Welcome

What Is Status Code: 414 URI Too Long? When URLs Overstay Their Welcome

Learn what HTTP Status Code 414 URI Too Long means. Discover real-world examples, and how Apidog helps developers test and prevent 414 errors efficiently.

14 October 2025

How to Connect Claude Code to the Chrome DevTools MCP Server for Better Debugging

How to Connect Claude Code to the Chrome DevTools MCP Server for Better Debugging

Discover how to integrate Claude Code with the Chrome DevTools MCP Server for superior web debugging. Install via CLI, verify with /mcp, test performance prompts, and troubleshoot remote mode. Unlock console traces, audits, and more for efficient workflows.

14 October 2025

Practice API Design-first in Apidog

Discover an easier way to build and use APIs