Request negotiation · Request header
Accept
Which media types the client can process.
What is Accept?
Accept expresses what the client wants back. Content negotiation lets a server return HTML for browsers and JSON for API clients from the same URL.
Typical usage
Set explicitly on API calls to signal the desired response format.
Examples
Prefer JSON, fallback to XML
Accept: application/json, application/xml;q=0.9Any type
Accept: */*Specification
RFC 9110 §12.5.1
Frequently asked questions
What is the Accept HTTP header?
Accept expresses what the client wants back. Content negotiation lets a server return HTML for browsers and JSON for API clients from the same URL.
Is Accept a request or response header?
Accept is a request header — the client sends it to the server. Set explicitly on API calls to signal the desired response format.
What does a Accept header look like?
A typical Accept header looks like: Accept: application/json, application/xml;q=0.9 (Prefer JSON, fallback to XML).
Related headers
Content-Type
Declares the media type of the body.
Accept-Encoding
Which content encodings (compressions) the client accepts.
Accept-Language
Preferred human languages for the response.
Vary
Which request headers cause different cached variants of the response.
User-Agent
The client software identifying itself.
Host
The requested host name and port.