- Class
- 4xx client error
- Defined in
- RFC 9110, section 15.5.16
- Retry
- After fixing Content-Type
- Key header
- Content-Type
- Cacheable by default
- No
When your API should return 415
Return 415 when the request’s Content-Type isn’t one the endpoint accepts, or when Content-Encoding names a compression it doesn’t support. Say which types it does accept, in the body and, for PATCH, in an Accept-Patch header.
If the type is right and the body doesn’t parse, that’s a 400. If the problem is the response format the client asked for in Accept, that’s a 406 Not Acceptable.
How public APIs declare 415 in their OpenAPI specs
One of the eleven public specs we score declares a 415, as they were on 4 December 2026, on a single Box operation.
Every OpenAPI 3 spec does list the media types each request body accepts, under requestBody.content, which tells a client what to send before a 415 can happen. That’s the part generators read.
| API | Operations | Declare 415 | How errors are described |
|---|---|---|---|
| Box | 297 | 1 | Per status code, plus a default |
| GitHub | 1,288 | 0 | Per status code |
| Stripe | 612 | 0 | One default error response |
| OpenAI | 406 | 0 | Per status code |
| Plaid | 351 | 0 | One default error response |
| Asana | 302 | 0 | Per status code |
| Twilio | 197 | 0 | No error responses |
| Slack | 174 | 0 | One default error response |
| Adyen Checkout | 28 | 0 | Per status code |
| Swagger Petstore | 19 | 0 | Per status code, plus a default |
| SendGrid Mail | 3 | 0 | Per status code |
Counted per operation from each vendor’s public OpenAPI document on 4 December 2026.
Declare 415 in your OpenAPI spec
Name each accepted type under requestBody.content, and declare the 415 for clients that send anything else.
paths:
/invoices:
post:
operationId: createInvoice
requestBody:
required: true
content:
application/json:
schema:
$ref: "#/components/schemas/InvoiceInput"
responses:
"201":
$ref: "#/components/responses/InvoiceCreated"
"415":
description: Send the body as application/json.What an Octri SDK does with a 415
An Octri SDK sets Content-Type from the media type your spec declares for the request body, so a generated client sends the right header on every call.
If a 415 arrives anyway, the caller gets an SdkHttpError with statusCode 415, which isn’t retried. It usually means a proxy or a piece of middleware changed the body or its headers on the way.
import { Acme, SdkHttpError } from "acme-sdk";
const acme = new Acme({ apiKey: process.env.ACME_API_KEY });
try {
await acme.invoices.create({ customerId: "cus_123", amount: 4200 });
} catch (err) {
if (err instanceof SdkHttpError && err.statusCode === 415) {
// Something between the SDK and your API rewrote Content-Type.
console.log(err.requestId);
}
throw err;
}More on retries and typed errors in SDK error handling.
HTTP 415 questions
Does a missing Content-Type cause a 415?
Often, yes. Some servers assume JSON when the header is missing and others refuse. A spec that declares the type lets clients send it every time.
Is the charset part of the media type check?
Partly. application/json; charset=utf-8 and application/json name the same type, so a server should accept both. RFC 8259 defines JSON as UTF-8.
Should a 415 list the accepted types?
Yes. Put them in the error body. For PATCH, RFC 5789 defines Accept-Patch for exactly this.