Header Troubleshooting For API Requests
Troubleshoot request headers for content type, authorization, caching, accept headers, and copied cURL examples.
Check required headers first
Many request failures come from missing or mismatched headers rather than endpoint logic.
- Confirm Content-Type when a body is sent.
- Confirm Accept when the response format matters.
- Check Authorization scheme, token prefix, and whitespace.
Remove unrelated copied headers
Headers copied from a browser or proxy can include noise that makes a reproduction harder to review.
- Keep headers required by endpoint documentation.
- Remove cookies unless the API actually uses cookie auth.
- Do not copy private session values into shared examples.
Reference Blocks
Use these short blocks as starting notes before opening the calculator.
Header table
Header | First check Content-Type | application/json for JSON body Accept | expected response format Authorization | Bearer, Basic, or provider scheme Idempotency-Key | required for some payment or retry flows
Troubleshooting note
Status: 415 Likely header: Content-Type Request body: JSON text Fix: add Content-Type: application/json and retry with the same body
Worked Examples
415 response
The body is JSON but Content-Type is missing.
Add Content-Type: application/json before retrying.
The server may reject the body before reading fields.
401 response
The token value is present but the Bearer prefix is missing.
Use the authorization format required by the API.
Whitespace and casing can matter for some services.
Unexpected response format
The API returns HTML instead of JSON.
Check Accept header, endpoint URL, and authentication state.
An auth redirect can look like a response-format problem.
Common Mistakes
- Sending JSON without a matching Content-Type header.
- Copying browser cookies or private session headers into examples.
- Assuming every API uses Bearer token authorization.
When This Is Not Enough
- Endpoint documentation decides which headers are required.
- Some signature systems require exact header ordering or canonicalization.
- Server logs are needed when headers look correct but behavior still differs.