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

# Errors

The API uses the following HTTP status codes:

* `200` - Success.
* `400` - Validation error (invalid query/body values). See Validation Error Shape below.
* `401` - Unauthorized (invalid or missing API key)
* `404` - Resource not found
* `429` - Rate limit exceeded
* `500` - Internal server error

#### Validation Error Shape

For invalid query/body values, the response returns HTTP `400` with this structure:

```json
{
  "errors": [],
  "properties": {
    "fieldName": {
      "errors": ["Validation message"]
    }
  }
}
```

The top-level `errors` array is reserved for request-level errors not attributable to a specific field and is empty for typical field-validation failures; per-field messages live under `properties.<fieldName>.errors`.

**Nested objects nest `properties`.** A failure inside `filters` (or any other object-valued field) is reported one level down, not on a flat `properties.<fieldName>`. Walk the tree rather than reading a single level:

```json
{
  "errors": [],
  "properties": {
    "filters": {
      "errors": [],
      "properties": {
        "deviceType": {
          "errors": [
            "Invalid option: expected one of \"any\"|\"mobile\"|\"desktop\""
          ]
        }
      }
    }
  }
}
```

Array-valued fields add an `items` array keyed by position (for example `properties.metrics.items[0].errors`, or `properties.filters.properties.landingPageFilters.items[0].properties.values.errors`).

**Two other `400` shapes exist.** Not every `400` uses the structure above, so treat the body as one of three forms:

1. The field-keyed shape above — the common case for query and body validation.
2. A bare top-level `errors` array, used by some query-parameter coercion failures even though the error is attributable to a field. Passing `?includeChangeLog=bogus` to `GET /experiences/{experienceId}` returns `{ "errors": ["Invalid boolean value: bogus"] }` with no `properties` key at all.
3. A single `error` string, used by the date-range checks on the experience analytics and export endpoints — for example `{ "error": "Start time must be before end time" }` and `{ "error": "Requested time range falls outside the experience lifetime" }`.

#### Not Found Error Shape

A `404` for a known route with an unresolvable resource returns an `error` string naming the resource:

```json
{ "error": "experience with 00000000-0000-4000-8000-000000000000 not found" }
```

A request to a path that is not a registered route is rejected by the API gateway before it reaches the service, and uses `message` rather than `error`:

```json
{ "message": "Not Found" }
```

#### Unauthorized Error Messages

Unauthorized responses use an `error` string. For a missing header, an empty header, or an invalid key, the value is `"Unauthorized"`:

```json
{ "error": "Unauthorized" }
```

**Send only `intelligems-access-token`.** If the request carries an `Authorization` header, that header takes precedence and `intelligems-access-token` is ignored. Unless the `Authorization` value is itself a valid Intelligems credential, the request is rejected with `401` and the distinct body `{ "error": "Unauthorized!" }` (note the exclamation mark) — *even when a valid `intelligems-access-token` is also present*. Clients that attach a default `Authorization` header (SDK defaults, proxies, workflow tools) must be configured not to send one to this API.

```json
{ "error": "Unauthorized!" }
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.intelligems.io/developer-resources/external-api/intelligems-external-api/errors.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
