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/json

Indicates representations the client can process.

Content-Type

application/json

Describes the media type of the message body.

Authorization

Bearer TOKEN

Carries authentication credentials.

Location

/users/42

Often identifies a newly created resource.

ETag

"user-42-v7"

Identifies a specific representation version.