> ## Documentation Index
> Fetch the complete documentation index at: https://api.globalwebindex.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Errors

> How Spark API v2 reports errors

Spark API v2 returns errors as problem details, as defined in [RFC 9457](https://www.rfc-editor.org/rfc/rfc9457), with `Content-Type: application/problem+json`. Use `type` to identify the error. `title` summarises the problem type, and `detail` describes this occurrence. The wording of `detail` can change, so do not match on it.

```json theme={null}
{
  "type": "https://api.globalwebindex.com/docs/spark-api/problems/invalid-params",
  "title": "Invalid parameters",
  "status": 422,
  "detail": "could not validate input: prompt should be a non empty string",
  "instance": "/v2/spark-api/global-filters"
}
```

## Problem types

Each `type` URI opens the page for that error.

| Type | Status | Meaning |
| :- | :- | :- |
| [`invalid-request`](https://api.globalwebindex.com/docs/spark-api/problems/invalid-request) | 400 | The request body is not valid JSON. |
| [`invalid-params`](https://api.globalwebindex.com/docs/spark-api/problems/invalid-params) | 422 | The request does not match the request schema, or a value is not accepted. |
| [`not-found`](https://api.globalwebindex.com/docs/spark-api/problems/not-found) | 404 | The requested insight, audience, dataset or skill does not exist. |
| [`access-denied`](https://api.globalwebindex.com/docs/spark-api/problems/access-denied) | 403 | Your account does not have access to the requested dataset or audience. |
| [`unprocessable`](https://api.globalwebindex.com/docs/spark-api/problems/unprocessable) | 422 | The request is valid but cannot be processed, for example because the datasets, audiences, locations or waves are not compatible. |
| [`timeout`](https://api.globalwebindex.com/docs/spark-api/problems/timeout) | 504 | The request took too long to complete. Retry later. |
| [`cancelled`](https://api.globalwebindex.com/docs/spark-api/problems/cancelled) | 499 | The client cancelled the request. |
| [`internal`](https://api.globalwebindex.com/docs/spark-api/problems/internal) | 500 | An unexpected error occurred. `detail` contains a generic message. |

The full `type` URI is `https://api.globalwebindex.com/docs/spark-api/problems/` followed by the slug in the table.

## Errors that are not problem details

A missing or invalid token (`401`), an unknown path (`404`) and a request body over 4 MiB (`413`) return a JSON object with a `message` field instead:

```json theme={null}
{
  "message": "Unauthorized"
}
```

## Partial failures

Some endpoints report a failure for part of the request inside a successful `200` response, not as an HTTP error:

| Endpoint | Where the failure appears |
| :- | :- |
| `POST /v2/spark-api/insights/generate` | `results[].error` and `results[].message` on the result for the prompt that failed. The other prompts still return their insights. |
| `POST /v2/spark-api/audiences/generate` | `failed_audiences`, keyed by the audience description that could not be created or matched. The other audiences are still returned. |
| `POST /v2/spark-api/datasets/explore` | `datasets[].summary_error` on the dataset that has no description. |
| `POST /v2/spark-api/global-filters` | `global_filters.inaccessible_location_names` lists requested locations your account cannot access. |
| `POST /v2/spark-api/taxonomy/explore` | `error` and `message` when no questions or attributes matched. |

Check these fields on every `200` response.
