Content-Type for JSON:API Specification

Set the Content-Type header for JSON:API (jsonapi.org) compliant requests. Covers the application/vnd.api+json media type and its requirements.

JSON APIs

Detailed Explanation

JSON:API Media Type

The JSON:API specification (jsonapi.org) defines its own media type to distinguish JSON:API payloads from generic JSON.

The Header Value

Content-Type: application/vnd.api+json

Important Rules

The JSON:API specification has strict requirements around the Content-Type header:

  1. No charset parameter: Clients and servers must not include any media type parameters (like charset) in the Content-Type header when using application/vnd.api+json. Any request with parameters must be rejected with a 415 Unsupported Media Type response.

  2. Accept header: Clients should also set Accept: application/vnd.api+json to indicate they expect a JSON:API response.

  3. Extension negotiation: JSON:API 1.1 introduced extension negotiation via the ext and profile parameters, but these are the only allowed parameters.

Request Example

{
  "data": {
    "type": "articles",
    "attributes": {
      "title": "New Article",
      "body": "Article content..."
    },
    "relationships": {
      "author": {
        "data": { "type": "people", "id": "9" }
      }
    }
  }
}

curl Example

curl -X POST \
  -H "Content-Type: application/vnd.api+json" \
  -H "Accept: application/vnd.api+json" \
  -d '{"data":{"type":"articles","attributes":{"title":"Hello"}}}' \
  https://api.example.com/articles

Use Case

Use this when building or consuming APIs that follow the JSON:API specification, such as those built with Ember Data, JSONAPI::Resources (Ruby), or Laravel JSON:API.

Try It — Content-Type Header Builder

Open full tool