application/yaml application/yaml means: application/yaml is the registered media type for YAML, a human-friendly data serialization language that uses indentation, lists and maps. YAML is a superset of JSON and is favored for configuration because it supports comments, anchors and a readable block style. Application media types carry structured or binary data that a program consumes rather than a human reading raw bytes. The subtype tells the receiver exactly which parser, decoder or handler to invoke, so sending the correct Content-Type is part of the API contract: a mismatch makes servers reject the body with 415 Unsupported Media Type or clients mis-parse the payload. You will encounter application/yaml in contexts such as configuration files for ci/cd, kubernetes and cloud tooling; infrastructure-as-code and application settings; data serialization where human editing and comments matter. It is commonly associated with the file extension(s) .yaml, .yml. YAML's flexibility is also its risk: implicit typing can turn no into a boolean, and version strings like 1.0 into floats. Quote ambiguous scalars, and be aware that YAML parsers differ on advanced features and on duplicate-key handling.
When you'll see application/yaml
- Configuration files for CI/CD, Kubernetes and cloud tooling
- Infrastructure-as-code and application settings
- Data serialization where human editing and comments matter
How to handle it
When handling an application type, set the Content-Type header explicitly on every request and response that carries a body, and advertise what you accept with the Accept header. Parse the payload with a library that matches the subtype rather than sniffing bytes, and validate the structure before trusting it. If a server returns 415, the declared type does not match what it expects — compare your header against the API documentation character for character, including parameters such as charset or boundary. As a final checklist for application types: register the exact subtype in your API documentation, validate incoming bodies against a schema before use, set X-Content-Type-Options: nosniff to stop MIME sniffing, and version your media types when the payload contract changes so old clients keep working.
Notes & gotchas
YAML's flexibility is also its risk: implicit typing can turn no into a boolean, and version strings like 1.0 into floats. Quote ambiguous scalars, and be aware that YAML parsers differ on advanced features and on duplicate-key handling.
Examples
POST /v1/resource HTTP/1.1
Host: api.example.com
Content-Type: application/yaml
Content-Length: 33
<root><item>example</item></root> curl -i -X POST -H "Content-Type: application/yaml" --data-binary @payload https://api.example.com/v1/resource const res = await fetch("/v1/resource", { headers: { Accept: "application/yaml" } });
// verify res.headers.get("Content-Type") starts with "application/yaml"
const text = await res.text(); // handle according to the declared type import requests
with open("payload", "rb") as fh:
res = requests.post("https://api.example.com/v1/resource", data=fh,
headers={"Content-Type": "application/yaml"}, timeout=30) Frequently asked questions
Is application/yaml the same as text/yaml?
text/yaml and application/x-yaml are older aliases; application/yaml is the registered type. All describe YAML, but prefer the registered form for new APIs.
Can YAML represent everything JSON can?
Yes — YAML 1.2 is a superset of JSON, so any valid JSON is valid YAML. YAML adds comments, anchors, aliases and multiple documents per stream.
What happens if I send the wrong application Content-Type?
Servers that validate media types answer 415 Unsupported Media Type, and clients may parse the body with the wrong decoder. Always set Content-Type to the registered type that matches your payload, and set Accept to the types you can handle.
Is application/octet-stream a safe default?
It means 'arbitrary binary bytes' and forces a download rather than inline handling. Use it only when the real type is unknown or you deliberately want a save-as dialog; otherwise declare the specific registered type.
How do I debug a 415 Unsupported Media Type response?
Compare the Content-Type you actually sent against what the endpoint documents, including parameters like charset and boundary. A 415 means the server refuses that media type; send the exact registered type it accepts and retry.
Try the YAML to JSON
Parse YAML into JSON, including anchors and multi-doc files.