How to Use API Key in Postman: Step-by-Step Guide
To use an
API key in Postman, add it to your request by selecting the Authorization tab and choosing API Key as the type. Then enter the key name and value, and specify if it should be sent in the Header or Query Params. This lets Postman include your API key automatically when sending requests.Syntax
In Postman, you add an API key by configuring these parts:
- Key: The name of the API key as expected by the server (e.g.,
api_key). - Value: Your actual API key string (e.g.,
12345abcde). - Location: Where to send the key โ either in the
Headeror as aQuery Param.
This setup is done in the Authorization tab by selecting API Key as the type.
postman
Authorization Type: API Key
Key: api_key
Value: 12345abcde
Add To: Header or Query ParamsExample
This example shows how to add an API key named api_key with value 12345abcde in the request header using Postman.
text
1. Open Postman and create a new request. 2. Go to the Authorization tab. 3. Select 'API Key' from the Type dropdown. 4. Enter 'api_key' in the Key field. 5. Enter '12345abcde' in the Value field. 6. Choose 'Header' for the Add To option. 7. Send the request to your API endpoint. Postman will add the header: api_key: 12345abcde
Output
Request Headers:
api_key: 12345abcde
Response: 200 OK (if API key is valid)
Common Pitfalls
Common mistakes when using API keys in Postman include:
- Entering the wrong key name or value, causing authentication failure.
- Choosing the wrong location (Header vs Query Params) that the API does not accept.
- Not saving the request after adding the API key, so it is not sent.
- Using environment variables incorrectly or forgetting to set them.
Always check the API documentation for the exact key name and location required.
text
Wrong way: Authorization Type: API Key Key: wrong_key Value: 12345abcde Add To: Header Right way: Authorization Type: API Key Key: api_key Value: 12345abcde Add To: Header
Quick Reference
| Step | Action | Details |
|---|---|---|
| 1 | Select Authorization tab | In your Postman request |
| 2 | Choose API Key | From the Type dropdown |
| 3 | Enter Key | Name of the API key (e.g., api_key) |
| 4 | Enter Value | Your actual API key string |
| 5 | Select Add To | Choose Header or Query Params |
| 6 | Send Request | Postman adds the key automatically |
Key Takeaways
Add your API key in Postman's Authorization tab by selecting API Key type.
Use the exact key name and location (header or query) as required by the API.
Double-check your API key value to avoid authentication errors.
Save your request after adding the API key to ensure it is sent.
Refer to API docs for correct key usage and placement.