# Unsupported Media Type

**Code:** `API-004` · **Category:** API

The API cannot process the request because the media type or Content-Type format is not supported by the endpoint.

## Common causes

- Incorrect Content-Type header
- Unsupported request format
- API expects JSON but received form data
- API expects XML but received JSON
- Incorrect request body encoding

## Quick fix

1. Set the correct Content-Type header
2. Send the request in a supported format
3. Verify the API documentation
4. Ensure the request body matches the declared media type

## Detailed fix by platform

### JavaScript

1. Set Content-Type to application/json when sending JSON
2. Use the correct request body format

### PHP

1. Set the appropriate Content-Type header
2. Encode request data according to the API requirements

### REST

1. Check the endpoint's supported media types
2. Use the correct Accept and Content-Type headers

## How to diagnose

1. **Inspect the Content-Type header** — 
2. **Check the request body format** — 
3. **Review supported media types in the API documentation** — 
4. **Compare Accept and Content-Type headers** — 

---
Source: [WhatIsMyError](https://whatismyerror.com/errors/api/api-004-unsupported-media-type)
