415

HTTP 415 Unsupported Media Type

4xx Client Error

4xx Client Error RFC 7231, Section 6.5.13

What is HTTP 415 Unsupported Media Type?

The 415 (Unsupported Media Type) status code indicates that the origin server is refusing to service the request because the payload is in a format not supported by the target resource. The client should check the Content-Type header it sent and ensure it matches one of the formats the server accepts.

Common Use Cases

  • Uploading a file format the server does not accept
  • API expecting JSON but receiving XML
  • Invalid Content-Type header

Usage Example

When your API only accepts JSON payloads, validate the Content-Type header on every request. If a client sends Content-Type: application/xml, return 415 Unsupported Media Type with a message indicating that only application/json is accepted.

// Laravel - validating Content-Type
if ($request->header('Content-Type') !== 'application/json') {
    return response()->json([
        'error' => 'Unsupported Media Type',
        'supported' => ['application/json'],
    ], 415);
}

Common Mistakes

⚠️

Mistake: Returning 400 instead of 415 for wrong Content-Type

Fix: Use 415 specifically when the Content-Type is not supported. It is more descriptive than the generic 400 and tells the client exactly what the issue is.

Last updated: 21 Jun 2026