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

# Errors and Rate Limits

> Handle API errors, trading rejections, and request budgets.

Errors use a stable envelope:

```json theme={null}
{
  "error": {
    "code": "rate_limited",
    "message": "Rate limit exceeded. Try again in 4 seconds.",
    "request_id": "b4ad5d8b-6e2c-4e44-915f-ff81956849e8"
  }
}
```

Keep `request_id` when contacting support. Trading-rule rejections may also
include `order_id`, `rule_id`, and structured `details`.

| Status | Meaning                                                                       |
| ------ | ----------------------------------------------------------------------------- |
| `400`  | The request shape, identifier, cursor, or idempotency key is invalid.         |
| `401`  | The API key is missing, invalid, or revoked.                                  |
| `404`  | The requested account, market, order, or endpoint is unavailable to this key. |
| `405`  | The endpoint does not support the requested HTTP method.                      |
| `409`  | An idempotency key conflicts or a mutable resource snapshot is stale.         |
| `413`  | The JSON body exceeds 16 KiB.                                                 |
| `414`  | The request URL is too long.                                                  |
| `415`  | An order request is not sent as `application/json`.                           |
| `422`  | The paper-trading engine rejected the order under a trading rule.             |
| `429`  | A rate budget is exhausted. Respect `Retry-After`.                            |
| `503`  | The API service or a fresh execution quote is temporarily unavailable.        |

## Request budgets

* Read requests: 300/minute per API key, burst 60.
* Trading writes: 60/minute per API key, burst 15.
* Edge abuse ceiling: 600/minute per source IP at each Cloudflare location.
* Deployment backstop: 30,000/minute with a 15,000-request burst.

Use exponential backoff with jitter for `429`, `500`, and `503`. Reuse the same
idempotency key when retrying a create or close request after an ambiguous
network or server failure.
