4xx Client ErrorCommonly usedRFC 9110

415Unsupported Media Type

Content-Type is not supported by the server.

What it means

The server refuses to accept the request because the payload format (Content-Type) is not supported. For example, the server expects application/json but the client sent text/plain.

When to use it

  • Client sent wrong Content-Type
  • Server only accepts JSON but received form data

Common causes

  • Missing Content-Type: application/json header
  • Sending form data to a JSON-only endpoint
  • Uploading wrong file format

Code Examples

Fix: set correct Content-Type
javascript
// Wrong — missing Content-Type
fetch('/api/users', { method: 'POST', body: JSON.stringify(data) });

// Correct
fetch('/api/users', {
  method: 'POST',
  headers: { 'Content-Type': 'application/json' },
  body: JSON.stringify(data),
});

Quick Facts

Code415
CategoryClient Error
SpecRFC 9110
CommonYes

Relevant Headers

Content-Type

Must match a type the server accepts

Related Codes

← Back to all status codes