Skip to main content

unsupported_media_type

The request carried a body the API refused to read, so it was rejected before parsing. Nothing was created, sent or charged.

Status: 415

{
"status": 415,
"type": "unsupported_media_type",
"message": "Content-Type must be application/json",
"request_id": "req_01J8K2P...",
"doc_url": "https://docs.epostix.com/errors/unsupported_media_type"
}

Why you got this

  • The header is absent on a POST, PUT or PATCH that carries a body.
  • Your HTTP client defaulted to application/x-www-form-urlencoded, which most clients do when you hand them a form or a map rather than a serialised string.
  • You sent multipart/form-data, text/plain or application/xml.
  • A proxy or wrapper between you and the API rewrote the header.

How to fix it

Set Content-Type: application/json and serialise the body yourself. Most HTTP libraries have a JSON helper that does both in one call, and using it removes the whole class of problem.

The check applies only to POST, PUT and PATCH requests with a body. If the header is right and the body still will not parse, you get invalid_request instead.

Is it safe to retry

Yes, once the header is correct. The body was never read, so the corrected request cannot duplicate anything, and reusing the same Idempotency-Key is safe.