Error handling with new GraphQL Over HTTP

Hey folks,
I’m upgrading my app to use GraphQL Over HTTP and I noticed that calling admin/api/2025-01/graphql instead admin/api/2025-01/graphql.json endpoint returns non-200 errors in raw text format instead of JSON, is this expected behaviour? Cannot see it being documented anywhere.

Example:

Calling admin/api/2025-01/graphql.json responds with:

{
	"errors": "[API] Invalid API key or access token (unrecognized login or wrong password)"
}

Calling admin/api/2025-01/graphql responds with:

[API] Invalid API key or access token (unrecognized login or wrong password)

The API documentation here still recommends using graphql.json endpoint and doesn’t mention the GraphQL Over HTTP changes.

1 Like

Hey Patrick.

I get the same when I test as well. I tested a few other queries that would lead to errors and they all return expected JSON, so it does seem specific to the 401 unauthenticated status. Is that what you are seeing as well?

Hey Kyle,
I think this only happens for this type of responses. It tested 404 Not Found and 401 Forbidden - all respond with plain text instead JSON.