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

# Errors

> Error codes returned by the Tribal Habits API.

The Tribal Habits API uses the following error codes:

| Error code | Meaning |
| - | - |
| 400 | Bad Request - The request is missing a required parameter or has an invalid value. See the response body for more details |
| 401 | Unauthorized - The request does not include the API key, the API key is incorrect, or API access is not enabled on your plan. |
| 404 | Not Found - The specified resource or endpoint could not be found |
| 406 | Not Acceptable - A `POST` or `PUT` request had a `Content-Type` header other than `application/json` |
| 422 | Unprocessable entity - The record you are creating or updating is not valid (e.g. not an email address). See the response body for more details |
| 429 | Too Many Requests - You have exceeded the rate limit. See [Rate limits](/rate-limits) |
| 500 | Internal Server Error - We had a problem with our server. The body is `{"error":"Internal server error"}`. Please let us know about it |
| 503 | Service Unavailable - We're temporarily offline for maintenance. Please try again later |

Most `400` responses have a JSON string body starting with `Bad request:`. `404` responses have the body `"not found"`, or no body for an unknown endpoint. `422` responses have a JSON object with `reason` and `errors` describing the problem. Some endpoints return their own error bodies; these are described with each endpoint.

A `400` response body is a JSON string:

```json theme={null}
"Bad request: Illegal value 'maybe' for 'active'"
```

A `422` response body for a user looks like this:

```json theme={null}
{
  "user_name": "12345",
  "email": "not-an-email",
  "params": { "user_name": "12345", "email": "not-an-email" },
  "reason": "Email is invalid",
  "errors": ["Email is invalid"]
}
```

Batch endpoints work differently: [Batch create or update](/api-reference/users/batch-create-or-update) returns `200` and lists each failed user in `error_list`.

Please contact us if you encounter an error where the cause of the problem is not immediately clear from the response code and/or body!


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.