Jira REST "415 Unsupported Media Type" (Content-Type) in CI
Jira returns 415 when it receives a body it will not parse as the declared type. For JSON endpoints, the request must send Content-Type: application/json; omitting it (curl defaults to form-encoding on -d) triggers a 415.
What this error means
A create, transition, or comment POST fails with HTTP 415 "Unsupported Media Type," even though the JSON body itself is valid.
HTTP/1.1 415 Unsupported Media Type
{"message":"Unsupported Media Type","status-code":415}Common causes
Missing Content-Type header on a JSON POST
curl -d without an explicit header sends application/x-www-form-urlencoded, which Jira JSON endpoints reject with 415.
A wrong or duplicated Content-Type
A client library or proxy overrode the header to text/plain or set it twice, so Jira does not treat the body as JSON.
How to fix it
Set Content-Type: application/json explicitly
- Add
-H "Content-Type: application/json"to every JSON POST. - Add
-H "Accept: application/json"so responses parse cleanly too. - Re-run the request to confirm the 415 clears.
curl -sf -u "$JIRA_EMAIL:$JIRA_API_TOKEN" -X POST \
-H "Content-Type: application/json" -H "Accept: application/json" \
-d '{"transition":{"id":"31"}}' \
"https://your-domain.atlassian.net/rest/api/3/issue/ABC-123/transitions"Confirm no proxy rewrites the header
If a corporate proxy strips or alters Content-Type, route Jira calls around it or configure it to preserve the header.
How to prevent it
- Always send Content-Type: application/json on Jira JSON POSTs.
- Set Accept: application/json so responses are JSON too.
- Prefer a client that sets JSON headers by default over raw curl -d.