Errors
The shape of an error response from the Prescient GraphQL API, the errors that you can get, and what to do for each one.
The API reports an error in the errors field of the response body. An authentication error has the HTTP status 200, so check the body of each response and not only the status.
What does an error look like?
Section titled “What does an error look like?”The errors field is a list. Each entry has a message. An error that comes from one field of your query also has locations and path.
{ "errors": [ { "message": "Authentication failed. Check your token.", "locations": [{ "line": 1, "column": 9 }], "path": ["modeledMetrics"] } ], "data": null}messageis the text of the error.locationsis the line and the column of the field in your query.pathis the name of the field that failed.
An authentication error has no error code and no extensions field. To find one in code, compare message to the text in the example.
Which errors can you get?
Section titled “Which errors can you get?”Authentication failed
Section titled “Authentication failed”The message is Authentication failed. Check your token. The status is 200 and data is null.
You get this error when the Authorization header is missing or is not in the apikey form, when the key does not exist, and when the key is revoked or expired. You also get it while your IP address has a temporary block after repeated failures. See Limits.
Check the header and the key. See Authentication. If the key is correct and the error continues, wait 10 minutes, then send one request.
The query does not match the schema
Section titled “The query does not match the schema”The GraphQL server checks each query before it runs. A field or an argument that is not in the schema, or a value of the wrong type, returns an errors list that names the problem. The query does not run.
The custom scalars have these rules.
- An
ISO8601Datevalue must be a string in theYYYY-MM-DDformat, for example2026-01-31. - A
BigIntvalue must be a whole number, written as a number or as a string of digits. - An enum value must be one of the values on the Types page.
Compare your query to the reference page of the query, then send it again.
An error inside the API
Section titled “An error inside the API”If the API fails while it runs your query, the errors entry has a general message that does not give the cause. Send the request again after a short wait. If the error continues, contact Prescient support with the time of the request and the name of the query. Do not send your API key.
How do you handle errors in code?
Section titled “How do you handle errors in code?”- Parse the body as JSON.
- If the body has an
errorsfield, stop and report the firstmessage. - If it does not, read
data.
The examples in Make your first request use this order.