Postman Unsupported Media Type status 415 error [Solved]

avatar
Borislav Hadzhiev

Last updated: Apr 5, 2024
4 min

banner

# Postman Unsupported Media Type status 415 error [Solved]

The Postman error "Unsupported Media Type" status 415 most often occurs for 3 reasons:

  1. Not setting the Content-Type request header to application/json for the specific request.
  2. Not setting the body to raw.
  3. Having syntactical errors in the JSON you are sending to the server in the HTTP request.

# Make sure the Content-Type header is set to application/json

The first thing you need to check is that the Content-Type request header is set to application/json.

  1. Click on the Headers button for the specific request.

click headers

  1. Set a key of Content-Type and a value of application/json.

  2. Make sure the checkbox for the particular row is checked, otherwise, the request header won't be set.

  3. Try to rerun your HTTP request.

The Content-Type request header is used to set the media type of the resource.

The Unsupported Media Type status 415 error indicates that your server doesn't know how to parse the received data because the Content-Type is not specified or is specified incorrectly.

When you set the Content-Type header in an HTTP request, you basically tell the server what type of data you are sending over.

The most common value for the Content-Type header is application/json.

shell
Content-Type: application/json

It means that you are sending a JSON string over the network.

The application/json part is known as the Media Type (formerly called MIME type).

The phrases Content Type, Media Type and Mime Type refer to the same thing - a string sent along with a file that indicates the type of the file.

For example, if sending over a PNG image, your Media Type would be image/png and if sending over an HTML string, your Media Type would be text/html.

In other words, the Media type serves the same purpose as a file extension on Windows.

It indicates to the server what type of data is being sent over the network so that the server knows how to parse the data.

Make sure to specify the Content-Type key and the value of application/json correctly as it sometimes glitches when the key or value has leading or trailing whitespace or newlines.

# Make sure the Body is set to raw JSON

Click on Body for the specific request and make sure it is set to raw -> JSON.

set request body to raw json

When sending a JSON string over the network, make sure raw is selected and then select JSON from the dropdown menu as shown in the screenshot.

You will only see the dropdown menu once raw is selected.

When you select raw, by default the value will get set to Text (plain text) which is not what you want.

Make sure the value is set to JSON instead.

set to json

# Verify you don't have any syntactical errors in the JSON

Another common cause of the error is having syntactical errors in your JSON.

  1. Make sure that all keys and all string values are double-quoted.
example.json
{ "username": "bobbyhadz", "password": "abc123" }
  1. Make sure you don't have a trailing comma after the last key-value pair.

  2. If you need to send an empty JSON object, set it to an empty set of curly braces.

example.json
{}

postman sending empty json object body

You are less likely to get the error when you set the JSON value to an empty object {}.

If you try to send an empty JSON string over the network, you might run into issues.

# Make sure your server is configured correctly

The error also occurs if your server is misconfigured or simply does not accept HTTP requests with the specified Content-Type.

For example, if you make an HTTP POST request with content-type set to application/x-www-form-urlencoded but your server only supports requests with Content-Type set to application/json, it would respond with status 415 Unsupported Media Type.

In this case, you have 2 options:

  1. To configure your server to accept requests made with the given Content-Type.
  2. To set your Content-Type header to the expected value and send over data of the correct type.

# Verify that the issue isn't caused by Postman

You can try to run the same request using a different application, e.g. cURL or any other service that allows you to send API requests.

If the request succeeds, your issue might be specific to your currently installed version of Postman.

You can download the latest version from the official postman.com website.

# Conclusion

To solve the Postman error "Unsupported Media Type" status 415, make sure:

  1. You have set the Content-Type request header to application/json.
  2. You have set the Body type to raw JSON.
  3. You don't have any syntactical errors in the JSON you are sending to your server.
  4. Your server accepts and is able to parse requests with the specified Content-Type.
  5. Your Postman version is up to date.
I wrote a book in which I share everything I know about how to become a better, more efficient programmer.
book cover
You can use the search field on my Home Page to filter through all of my articles.