> For the complete documentation index, see [llms.txt](https://docs.elevateab.com/elevate-helpcenter/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.elevateab.com/elevate-helpcenter/developer-reference/external-api/errors.md).

# Errors

Elevate A/B Testing External API error format and codes, from 400 invalid parameters to 422 results unavailable, and how to handle each one.

Successful responses wrap the result in `data`. Failed ones carry a message and a stable `code`:

```json
{ "success": true, "data": { } }
{ "success": false, "error": "Experiment not found", "code": "NOT_FOUND" }
```

Handle errors by `code`. The `error` text is for people and can change.

| Status | `code`                | When                                                                                                              |
| ------ | --------------------- | ----------------------------------------------------------------------------------------------------------------- |
| `400`  | `BAD_REQUEST`         | A query parameter is invalid or unknown                                                                           |
| `401`  | `UNAUTHORIZED`        | The key is missing or invalid                                                                                     |
| `404`  | `NOT_FOUND`           | The experiment isn't in your store or isn't published by the API, or the path doesn't exist                       |
| `405`  | `METHOD_NOT_ALLOWED`  | The request isn't a `GET`                                                                                         |
| `422`  | `RESULTS_UNAVAILABLE` | The experiment has no results the API can return                                                                  |
| `429`  | `TOO_MANY_REQUESTS`   | The rate limit is used up, see [Rate limits](/elevate-helpcenter/developer-reference/external-api/rate-limits.md) |
| `500`  | `INTERNAL_ERROR`      | Something went wrong on our side. Retry after a short wait                                                        |

## 400: invalid parameters

`errors.fieldErrors` says what is wrong with each parameter:

```json
{
  "success": false,
  "error": "Invalid query parameters",
  "code": "BAD_REQUEST",
  "errors": {
    "fieldErrors": {
      "country": ["country must be ISO 3166-1 alpha-2 country codes, e.g. US"]
    }
  }
}
```

Results endpoints reject unknown parameters, so a typo like `contry=US` fails instead of silently returning unfiltered numbers.

## 422: no results

`reason` says why: `unsupported_experiment` means the experiment predates our current analytics, so its results are only available in the Elevate A/B Testing app.
