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
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.