# Errors

> For AI agents: the index of these docs is at https://indrava.forumulate.com/docs/llms.txt (every page it lists has a Markdown version like this one).

The error format of the Indrava REST API and MCP server, the status codes, and which requests are safe to retry.

## REST

A failed request has a `4xx` or `5xx` status and a JSON body:

```json
{
  "defined": false,
  "code": "UNAUTHORIZED",
  "status": 401,
  "message": "Unauthorized"
}
```

`code` is stable and meant for programs. `message` is meant for people and may change. Some errors add a `data` field with detail, such as which input field was wrong.

| Status | `code` | Meaning | Retry? |
| --- | --- | --- | --- |
| `400` | `BAD_REQUEST` | The input did not match the operation's schema, or the request cannot be carried out as sent | No, fix the request |
| `401` | `UNAUTHORIZED` | No token, or the token is unknown, revoked or expired | No, fix the token |
| `402` | `PLAN_LIMIT_REACHED` | The workspace's plan is full for what the request adds (a scheduled post in that month, a channel, an automation); `message` names the plan and the limit | No, until the plan changes or the month ends |
| `403` | `FORBIDDEN` | The token lacks a scope (`Missing scope posts:write`), may only save drafts (`Missing scope posts:publish`), the person's role does not allow it, or the post needs approval: save a draft and submit it | No |
| `404` | `NOT_FOUND` | The post, channel or tag does not exist in this workspace, or is not visible to this caller | No |
| `409` | `CONFLICT` | The request is valid but does not fit the current state: a published post cannot be edited, there is nothing to retry, a tag with that name exists | No |
| `429` | `TOO_MANY_REQUESTS` | Over the [rate limit](https://indrava.forumulate.com/docs/rate-limits) | Yes, after `Retry-After` seconds |
| `5xx` |  | Something failed on the server | Yes, with backoff |

A path that is not part of the API answers `404` with a plain-text body.

The `429` body has only `code` and `message`.

An id from another workspace gives `404`, the same as an id that does not exist.

## MCP

A tool call that fails returns a result with `isError: true` and the error message as text, so the model can read it and correct the call. A request to `/mcp` without a valid token gets HTTP `401` with a `WWW-Authenticate` header; see [Authentication](https://indrava.forumulate.com/docs/authentication#oauth-for-mcp-clients).

## Command line

`indrava` prints the message to standard error and exits with a code: `1` the API refused or failed, `2` bad usage, `3` not signed in. With `--json` the error is JSON: `{"error": "...", "status": 403}`.

## What is safe to retry

- `GET` requests, always.
- `POST /posts` with an `id` (an update), `PUT /slots/{channelId}`, and the `DELETE` operations: sending them twice has the same result as once.
- `POST /posts` **without** an `id` creates a new post each time, unless you send an `Idempotency-Key` header (or `idempotencyKey` in the body): a retry with the same key returns the first post. Without a key, list recent posts before sending it again.
- `POST /posts/{id}/retry` only re-sends channels that failed. A part of a post that a platform already accepted, and Indrava recorded, is not sent again.

## A post that failed to publish

A publish failure is not an API error: the request that scheduled the post succeeded. The post's `status` becomes `failed`, and the reason is in the app, on the post, per channel. Subscribe to the `post.failed` and `target.failed` [webhook events](https://indrava.forumulate.com/docs/events) to be told when it happens.

---

## For AI agents

- This page for a human reader: https://indrava.forumulate.com/docs/errors
- The whole space as one Markdown file: https://indrava.forumulate.com/docs/llms-full.txt
- Live search + fetch over MCP: https://indrava.forumulate.com/docs/_api/public/orgs/e421ace4-3e78-4ed8-9818-7b4899cf3aa0/spaces/2bcc7f09-4489-40af-85d8-9fdd3f3da314/mcp
  - Install (Claude CLI): `claude mcp add forumulate-docs --transport http https://indrava.forumulate.com/docs/_api/public/orgs/e421ace4-3e78-4ed8-9818-7b4899cf3aa0/spaces/2bcc7f09-4489-40af-85d8-9fdd3f3da314/mcp`

This Markdown is the same content the page renders — safe to quote and to ground answers in.
