Clarification about top-level document structure


Hello to everybody :slight_smile: I’m new here, nice to meet all of you…

I used JSON API for some time now and i appreciate all the good job done to made to write such a good and versatile specification :slight_smile:

From the beginning i had a question about what the documentation says on top-level structure:

A document MUST contain at least one of the following top-level members:

data: the document’s “primary data”
errors: an array of error objects
meta: a meta object that contains non-standard meta-information.

The members data and errors MUST NOT coexist in the same document.

Is it correct to say that at least data or error field must be present? or are they all optionals?

Thanks for your help.


As long as you have one of the three, the other two are optional.

I think in theory, it’s basically non-sensical to have a meta-only top-level response, but it is technically allowed by the spec.