意味
ボディのメディアタイプ(Content-Type)またはエンコーディングに対応していないため、サーバーがリクエストを拒否しました。
よくある原因
- Content-Type: application/json なしで JSON を送った
- JSON 専用 API にフォーム形式のボディを送った
- アップロードで brotli など未対応の Content-Encoding を使った
対処法
クライアント・閲覧者の場合
送るボディに合った正しい Content-Type ヘッダーを設定し、API ドキュメントの形式に合わせます。
サイトや API の運営者の場合
受け付ける型を Accept-Post や Accept-Patch に列挙し、わかりやすいメッセージを返します。
レスポンス例
HTTP/1.1
HTTP/1.1 415 Unsupported Media Type
Date: Tue, 07 Oct 2025 09:30:00 GMT
Server: nginx
Accept-Post: application/json
Content-Type: application/problem+json
{
"type": "about:blank",
"title": "Unsupported Media Type",
"status": 415,
"detail": "Send the body as application/json."
} 仕様
よくある質問
› fetch() で JSON を送ると 415 になるのはなぜ?
headers: {'Content-Type': 'application/json'} を指定しないと、fetch は文字列ボディを text/plain として送るからです。
› 415 と 400 の違いは?
415 は特にボディの型の誤り、400 は一般的な不正リクエストです。