Errors

Hygraph uses conventional HTTP responses codes when returning API requests.

Codes in the 2xx range refer to a successful request, whereas responses in the 4xx range indicate there was an error due to the information you provided, such as invalid query arguments, or auth token.

CodeDescription
200OK - Successful response
400Bad request - Typically due to invalid query arguments
401Unauthorized - Usually no valid Permanent Auth Token was provided
404Not Found - Typically invalid endpoint or environment requested
429Too Many Requests - You're making too many requests, slow down
500Internal Server Error - Something went wrong our side

A typical GraphQL error will look like the below. The format of the error is typical for any 400 query or mutation request.

{
"errors": [
{
"message": "input:1: Field \"idd\" is not defined by type PostWhereInput. Did you mean id?\n"
}
],
"data": null,
"extensions": {
"requestId": "ckff8k1tc0nsg0150cssdkzxm"
}
}

It's clear from the error above that the field idd is not part of the Input Type.

Hygraph will also return the requestId which can be used when requesting support.

400: Bad requestAnchor

Hygraph will return a 400 if there is an error with the request. 400 errors are typically thrown when there is a client-side validation error, such as a missing required argument in your GraphQL query, or a malformed Permanent Auth Token.

If your Permanent Auth Token is not a valid JWT, you will receive a 400 error.

401: UnauthorizedAnchor

The endpoint you requested requires a valid Permanent Auth Token, or a environment may not exist for this project.

429: Too many requestsAnchor

To ensure delivery of optimal experiences to all customers, a rate limit is enforced on all GraphQL queries for the shared regions.

The rate limiting depends on the current load of the shared region and the subscription plan. These limits can be lifted on dedicated clusters and enterprise plans. Please contact sales for further information.

You'll get a 429 when you exceed the rate limit, and you will get a response with the following payload:

{
"errors": [
{
"message": "Too Many Requests"
}
],
"data": null
}

Click here for information on how to handle API rate limits.