> ## Documentation index
> Fetch the complete documentation index at: https://docs.prescientai.com/llms.txt
> Use this file to discover all available pages before exploring further. Add `.md` to any page URL to get that page as Markdown.

# 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?

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`.

```json title="Response"
{
  "errors": [
    {
      "message": "Authentication failed. Check your token.",
      "locations": [{ "line": 1, "column": 9 }],
      "path": ["modeledMetrics"]
    }
  ],
  "data": null
}
```

- `message` is the text of the error.
- `locations` is the line and the column of the field in your query.
- `path` is 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?

### 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](https://docs.prescientai.com/api/limits).

Check the header and the key. See [Authentication](https://docs.prescientai.com/api/authentication). If the key is correct and the error continues, wait 10 minutes, then send one request.

### 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 `ISO8601Date` value must be a string in the `YYYY-MM-DD` format, for example `2026-01-31`.
- A `BigInt` value 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](https://docs.prescientai.com/api/types) page.

Compare your query to the reference page of the query, then send it again.

### 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?

1. Parse the body as JSON.
2. If the body has an `errors` field, stop and report the first `message`.
3. If it does not, read `data`.

The examples in [Make your first request](https://docs.prescientai.com/api/make-your-first-request) use this order.
