Common HTTP Response Headers
You'll learn which response headers APIs send back and how they guide your frontend's behavior.
What Are HTTP Response Headers?
When a server responds to your API request, it doesn't just send data—it sends metadata about that data in the form of headers. Think of response headers as the shipping label and handling instructions on a package: they tell you what's inside, how to store it, and where to find more.
Critical Response Headers
Content-Type
Tells you what format the response body is in:
Content-Type: application/json
Content-Type: text/html; charset=UTF-8
Your frontend uses this to parse the response correctly—JSON needs JSON.parse(), while HTML can be inserted directly into the DOM.
Cache-Control
Instructs browsers and proxies how long to cache the response:
Cache-Control: max-age=3600, public
Cache-Control: no-cache, no-store, must-revalidate
This determines whether your app can reuse a previous response or must fetch fresh data.
ETag
A unique identifier (like a fingerprint) for a specific version of a resource:
ETag: "abc123xyz"
Your frontend can send this back in future requests to ask "has this changed?" The server returns 304 Not Modified if it hasn't, saving bandwidth.
Location
Tells you where to find a newly created resource or where to redirect:
Location: https://api.example.com/users/42
After a POST creates a user, the Location header points to that user's URL. Your frontend can follow it to fetch the full resource.
Why They Matter
These headers enable smart caching, efficient updates, proper parsing, and resource discovery—all essential for building fast, correct frontends.
Key Takeaway: Response headers like Content-Type, Cache-Control, ETag, and Location provide critical instructions that help your frontend handle, cache, and navigate API responses effectively.