0
0
Postmantesting~5 mins

Request headers in Postman

Choose your learning style9 modes available
Introduction

Request headers send extra information with your API call. They help the server understand your request better.

When you need to tell the server what type of data you accept, like JSON or XML.
When you want to send authentication details like tokens or API keys.
When you want to specify language or encoding preferences.
When you want to control caching or session information.
When you want to send custom information the server expects.
Syntax
Postman
Key: Value

Headers are key-value pairs.

Keys are case-insensitive; values may be case-sensitive depending on the header.

Examples
This header tells the server you are sending JSON data.
Postman
Content-Type: application/json
This header sends a token to prove who you are.
Postman
Authorization: Bearer your_token_here
This header tells the server you prefer English (US) responses.
Postman
Accept-Language: en-US
Sample Program

This example shows a GET request with headers to accept JSON data and send an authorization token.

Postman
GET https://api.example.com/data
Headers:
  Accept: application/json
  Authorization: Bearer abc123token

// In Postman, set these headers in the Headers tab before sending the request.
OutputSuccess
Important Notes

Always check the API documentation to know which headers are required.

Headers can affect how the server processes your request and what it returns.

In Postman, headers are easy to add and edit in the Headers tab for each request.

Summary

Request headers send extra info with your API call.

They are key-value pairs like Content-Type or Authorization.

Use headers to control data format, authentication, and preferences.