DevKits

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

Any 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

Work with this header