How to Set Content-Type Header in Postman Quickly
In Postman, set the
Content-Type header by going to the Headers tab and adding a key named Content-Type with the desired value like application/json. This tells the server what format your request body is in.Syntax
To set the Content-Type header in Postman, add a header with the key Content-Type and set its value to the media type of your request body.
Content-Type: The header key that specifies the data format.- Value: The MIME type like
application/json,application/x-www-form-urlencoded, ortext/plain.
http
Content-Type: application/json
Example
This example shows how to set the Content-Type header to application/json in Postman when sending a JSON request body.
http
POST /api/users HTTP/1.1 Host: example.com Content-Type: application/json { "name": "Alice", "email": "alice@example.com" }
Output
HTTP/1.1 201 Created
{
"id": 123,
"name": "Alice",
"email": "alice@example.com"
}
Common Pitfalls
Common mistakes when setting Content-Type in Postman include:
- Not setting the header at all, causing the server to misinterpret the data.
- Setting the wrong
Content-Typevalue that does not match the request body format. - Duplicating the header or having conflicting headers.
Always ensure the Content-Type matches your request body format exactly.
http
Wrong way:
Content-Type: text/plain
{"name":"Alice"}
Right way:
Content-Type: application/json
{"name":"Alice"}Quick Reference
| Content-Type Value | Description | When to Use |
|---|---|---|
| application/json | JSON format | Sending JSON data in request body |
| application/x-www-form-urlencoded | Form data | Submitting form data as key-value pairs |
| multipart/form-data | File upload | Uploading files with form data |
| text/plain | Plain text | Sending raw text data |
Key Takeaways
Always set the Content-Type header in Postman to match your request body format.
Use the Headers tab in Postman to add or edit the Content-Type key and value.
Common Content-Type values include application/json and application/x-www-form-urlencoded.
Incorrect or missing Content-Type headers can cause server errors or misinterpretation.
Check your request body format and set Content-Type accordingly for successful API calls.