Essential HTTP Headers
Headers are one of the most important parts of a production API. Important request headers include Accept, Content-Type, Authorization, If-Match, If-None-Match, If-Modified-Since, Idempotency-Key, Origin, and tracing headers such as traceparent.
Important response headers include Content-Type, Location, Cache-Control, ETag, Last-Modified, Retry-After, WWW-Authenticate, Allow, Access-Control-Allow-Origin, and rate-limit metadata.
Headers should not be treated as arbitrary strings. Many have defined HTTP semantics that clients, proxies, browsers, and caches understand automatically.
Frequently Used Headers
Accept:
application/jsonIndicates representations the client can process.
Content-Type:
application/jsonDescribes the media type of the message body.
Authorization:
Bearer TOKENCarries authentication credentials.
Location:
/users/42Often identifies a newly created resource.
ETag:
"user-42-v7"Identifies a specific representation version.