Skip to content

415 Unsupported Media Type

The body is in a format the server does not support for this resource and method.

Status

HTTP/1.1 415 Unsupported Media Type

Details

  • Category: 4xx
  • Status: Standard. Registered with IANA and defined by a current standards-track RFC.
  • Specification: RFC 9110 §15.5.16
  • Cacheable: Only with explicit cache headers
  • Response body: Allowed
  • Retry: Retry only after changing the request

415 rejects the Content-Type of the request, not its contents. An endpoint that consumes application/json refuses a body sent as text/plain or as a form encoding, and an image endpoint refuses a format it cannot decode.

A frequent variant is the missing header: some frameworks default to application/x-www-form-urlencoded when Content-Type is absent, which then fails against a JSON-only endpoint even though the body itself is perfectly valid JSON.

Headers

  • Accept-Post: Optional. Lists media types the resource accepts for POST.
  • Accept-Patch: Required on a 415 that rejects a PATCH, listing the patch formats supported.

Common causes

  • A missing or wrong Content-Type on the request.
  • A charset or media type parameter the server rejects.
  • An unsupported PATCH format, such as sending merge-patch to an endpoint expecting json-patch.
  • An upload whose declared type does not match the file's actual format.

How to fix it

As the client

  • Set Content-Type explicitly to what the endpoint documents.
  • For PATCH, read Accept-Patch on the response and use one of the listed formats.
  • Make sure the body and the declared type agree. Declaring JSON and sending form data fails either way.

As the server

  • List supported types in the error body, and send Accept-Post or Accept-Patch where they apply.
  • Be tolerant of harmless parameters such as an explicit charset on a JSON body.

Examples

Sending the wrong Content-Type

HTTP request

POST /api/v2/order HTTP/1.1
Host: api.example.com
Content-Type: text/plain

product_id=isp-us

HTTP response

HTTP/1.1 415 Unsupported Media Type
Accept-Post: application/json
Content-Type: application/json; charset=utf-8

{"error":"unsupported_media_type","supported":["application/json"]}

Specifications

See also