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

# Errors and rate limits

> The error format, every error code, request limits, idempotent retries and dry runs.

## Error format

Every error has the same shape: `"ok": false` and an `error` object with a stable `code`, a
human-readable `message` and, for some codes, `details`.

```json theme={null}
{
  "ok": false,
  "error": {
    "code": "VALIDATION_ERROR",
    "message": "The request is not valid",
    "details": { "fieldErrors": { "limit": ["At most 100"] } }
  }
}
```

Branch on `code`, not on `message`: messages can change.

## Error codes

| HTTP | `code` | Meaning |
| - | - | - |
| 401 | `UNAUTHENTICATED` | Missing, malformed, unknown or revoked key. |
| 403 | `FORBIDDEN` | The key lacks the operation's permission; it is named in `details.requiredScope`. |
| 403 | `PLAN_READ_ONLY` | The organization's plan does not allow writes. |
| 403 | `PLAN_LIMIT_REACHED` | The write would exceed a limit of the organization's plan. |
| 404 | `NOT_FOUND` | The resource does not exist in the key's organization. |
| 409 | `CONFLICT` | The write conflicts with the current state of the resource. |
| 409 | `IDEMPOTENCY_KEY_IN_PROGRESS` | A request with the same `Idempotency-Key` is still running. |
| 413 | `PAYLOAD_TOO_LARGE` | The body is larger than 1,048,576 bytes. |
| 422 | `VALIDATION_ERROR` | The request is not valid; `details.fieldErrors` lists the problems by field. |
| 422 | `IDEMPOTENCY_KEY_REUSED` | The `Idempotency-Key` was already used for a different request. |
| 429 | `RATE_LIMITED` | Too many requests. See [Rate limits](#rate-limits). |
| 500 | `INTERNAL_ERROR` | Unexpected failure. A write may or may not have happened; see [Retrying writes](#retrying-writes). |

Each endpoint in the [API reference](https://docs.eloout.com/api-reference/introduction.md) lists the statuses it can
return.

## Rate limits

| Limit | Window |
| - | - |
| 120 requests per key | 60 seconds |
| 300 requests per organization, across all its keys | 60 seconds |
| 20 failed authentications per client IP | 10 minutes |

Every answer to a valid key, errors included, carries the state of its window. When the key's
window and the organization's differ, the headers describe the one with fewer requests left.

| Header | Value |
| - | - |
| `X-RateLimit-Limit` | Requests allowed in the window |
| `X-RateLimit-Remaining` | Requests left in the window |
| `X-RateLimit-Reset` | Seconds until the window resets (at least 1). It is a duration, not a Unix time. |

Over a limit, the API answers `429 RATE_LIMITED` with a `Retry-After` header: wait that many
seconds before retrying. Answers without a valid key (`401`, and the `429` for too many failed
authentications from your IP) carry `Retry-After` when limited, but no `X-RateLimit-*` headers.

```json theme={null}
{
  "ok": false,
  "error": { "code": "RATE_LIMITED", "message": "Too many requests for this API key or its organization" }
}
```

## Retrying writes

A write that fails with `500`, times out or loses its connection may or may not have happened.
Before retrying it, read the resource to see whether the change is there.

### `Idempotency-Key`

The opportunity and record writes accept an `Idempotency-Key` header; the webhook writes do not.
The [API reference](https://docs.eloout.com/api-reference/introduction.md) lists it on each write that accepts it.

* The value is 1 to 255 printable ASCII characters, without spaces. Use a new value for each
  write, such as a UUID.
* Keys are scoped to your API key. A retry with the same key and the same request (method,
  path, query and body) within 24 hours gets the answer stored for the first one, with the
  header `Idempotent-Replayed: true`, and does not run again. Answers below `500`, errors
  included, are stored.
* Answers of `500` and above are not stored: the key is released, and a retry runs the write
  again. Check the resource before retrying.
* The same key with a different request answers `422 IDEMPOTENCY_KEY_REUSED`.
* While the first request is still running, a retry answers `409 IDEMPOTENCY_KEY_IN_PROGRESS`.
  Wait and retry.

```bash theme={null}
curl -s -X PATCH "https://app.eloout.com/api/v1/opportunities/$OPPORTUNITY_ID" \
  -H "Authorization: Bearer $ELOOUT_API_KEY" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: 0b8f6c2e-7d1a-4f3b-9e5c-2a4d6f8b1c3e" \
  -d '{"title": "Annual plan — Acme"}'
```

## Dry runs

Writes that support it accept `?dryRun=true`: the API checks and plans the write and answers as
if it were done, with `dryRun: true`, but writes nothing and sends no webhook event. An
`Idempotency-Key` is ignored on a dry run.

The [API reference](https://docs.eloout.com/api-reference/introduction.md) shows which writes accept `Idempotency-Key` and
`dryRun`.

## Request size and text

* Request bodies are limited to 1,048,576 bytes.
* Text values are trimmed before they are checked, so a length limit applies to the trimmed
  value. Lengths count Unicode characters (code points).


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