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

# Errors

> The status codes the API returns and the shape of each error body.

The API reports errors with the HTTP status code and a JSON body.

## Status codes

| Status | Meaning | What to do |
| - | - | - |
| `400` | The input is invalid | Fix the fields named in the body |
| `401` | You are not logged in, or the token expired or was revoked | [Log in again](/guides/authentication) |
| `403` | Your account may not use this endpoint | Check that your organization has access |
| `404` | The resource does not exist, or the URL is wrong | Check the identifiers and the path in the request |
| `429` | Too many login attempts | Wait, then reuse one token instead of logging in per request |
| `5xx` | The API failed | Retry the same request after a short delay |

## Invalid input

Most `400` bodies name the problem per field:

```json theme={null}
{
  "interval": ["This field is required."]
}
```

A wrong email or password at login comes back under `non_field_errors`:

```json theme={null}
{
  "non_field_errors": ["Unable to log in with provided credentials."]
}
```

A reported-metrics push that is not a non-empty list returns a `message`:

```json theme={null}
{
  "message": "Request body must be a list of metric objects"
}
```

A push with an invalid organization, asset, metric or interval in any item
fails the whole request, and nothing is written. The body is a list with one
object per item, empty for the valid ones:

```json theme={null}
[
  {},
  {
    "metric": ["depth/bid_7bps is not valid. Must be one of volume/volume, ..."]
  }
]
```

## Two-factor login

A wrong code at `POST /v1/totp/login/` returns `400` with a `message` field; a
missing `code` returns `400` under the `code` field. After too many wrong codes
the account is locked, and the next `POST /v1/login/` returns `429` with a
`message` field.

```json theme={null}
{
  "message": "The authentication code is incorrect."
}
```

## Other errors

`401`, `403` and `404` return a `detail` message, as does a `429` from the
login rate limit:

```json theme={null}
{
  "detail": "Invalid token."
}
```

A wrong URL returns `404` with an HTML page instead of JSON.
