Skip to main content

Content-Type

BothActive

The Content-Type header describes the media type and encoding of the message body. It tells the receiver how to parse the body – as JSON, HTML, form data, binary, etc. Including the charset parameter prevents encoding mismatches.

Content-Type: <media-type>[; charset=<charset>][; boundary=<boundary>]

Description

The Content-Type representation header is used to indicate the original media type of the resource before any content encoding applied for sending. In responses, it tells the client what the content type of the returned content actually is.

Directives

DirectiveDescription
application/jsonJSON-encoded data. Most common for REST APIs.
text/html; charset=utf-8HTML document, UTF-8 encoded.
application/x-www-form-urlencodedHTML form submission (default form enctype).
multipart/form-dataFile uploads and binary form data.
application/octet-streamArbitrary binary data / file download.

Examples

JSON response
http
Content-Type: application/json; charset=utf-8
HTML document
http
Content-Type: text/html; charset=utf-8
Form submission
http
Content-Type: application/x-www-form-urlencoded

Related

Specification

RFC 9110Content-Type specification →