# Rate limits

Source: https://modulify.ai/docs/api/rate-limits

The per-minute budget every token has, the headers that report it, and the quotas some methods add.

Two kinds of limit apply to the API. Every token has a budget of calls per minute, and some methods add a quota of their own on the work they do.

## The per-minute budget

Every token may make 240 method calls a minute. The budget belongs to the token, not to the API: an AI client using the same token over MCP spends from the same budget, and two scripts sharing one token share it too.

The minute starts with the first call after the previous minute ran out. Every call to a method counts, including one refused because of a missing scope or a bad argument. These do not count:

- `GET /v1/token`, `GET /v1/tools` and `GET /v1/openapi.json`.
- A call refused before the method runs: a missing or bad token, a method name that does not exist, a body that is too large or not a JSON object, or an `Idempotency-Key` that is malformed, still running or used for something else.
- A repeated call answered from an earlier result through its `Idempotency-Key`.

Over the budget, a call is refused with a `429` and runs nothing:

```json
{
  "success": false,
  "message": "Too many tool calls. Wait 27 seconds and try again!",
  "data": null,
  "code": 429,
  "version": "0.0.1740"
}
```

## The headers

Every call to a method reports where the token stands:

| Header | What it holds |
| --- | --- |
| `X-RateLimit-Limit` | The calls the token may make in a minute |
| `X-RateLimit-Remaining` | The calls left in the token's current one-minute window |
| `X-RateLimit-Reset` | Seconds until that window ends |
| `Retry-After` | On a `429` from the budget, or from a quota that says how long to wait, the seconds to wait before calling again |

`GET /v1/token` reports the same three numbers in `data.rateLimit` as `limit`, `remaining` and `resetSeconds`, without spending a call. When the token has made no call in the last minute, `remaining` equals `limit` and `resetSeconds` is `0`.

## Stay inside it

- **Wait for `Retry-After`.** After a `429` that carries it, sleep for the seconds it gives, then carry on. Retrying sooner only gets more refusals.
- **Pace long loops.** When `X-RateLimit-Remaining` gets low, slow down rather than running into the wall.
- **Poll gently.** Methods that report progress, such as `get_job` and `get_publish_status`, only need a call every few seconds. See [Long-running work](https://modulify.ai/docs/api/long-running-work).
- **Give separate jobs separate tokens.** Each token has its own budget, and a token per job also makes it clear which one to revoke.

## Quotas on the work itself

Some methods limit the work they do, whatever token calls them. These answer with their own message. The chat queue frees up only as its messages run, so waiting for that work to finish is the fix rather than retrying. The other quotas count calls over a window: their `429` carries `Retry-After` and `data.retryAfter` with the seconds until the window has room again, and calling again after that wait is the fix:

| Quota | Limit | Answer when reached |
| --- | --- | --- |
| Messages waiting in a site's chat queue | 20 per site, and 8 from any one person | `429` from `send_message`, naming the cap |
| Analytics lookups | 1,200 per site per hour, shared by every token and every AI client reading that site | `429` from the analytics methods, with `Retry-After` |
| Calls to one deploy hook, including through `trigger_deploy_hook` | 10 a minute per hook | `429` until the minute passes, with `Retry-After` |
| Domain searches | 30 a minute per person, shared with the **Domains** page | `429` from `search_available_domains`, with `Retry-After` |
| Domain prices | 20 a minute per person | `429` from `get_domain_price`, with `Retry-After` |
| DNS record lists of bought domains | 20 a minute per person | `429` from `list_dns_records` and `preview_dns_records`, with `Retry-After` |
| Changes to bought domains | 30 a minute per workspace, shared with the **Domains** page | `429` from the methods that change a bought domain's records, nameservers, registrant, transfer lock or auto-renew, and from `get_domain_transfer_code`, with `Retry-After` |
| Domain purchases and renewals | 10 an hour per workspace | `429` from `buy_domain` and `renew_domain`, with `Retry-After` |

Other methods have size limits on what they take or return, such as the longest prompt or the largest file. Each method's page states its own.

## Next

- [Errors](https://modulify.ai/docs/api/errors) for every status code.
- [Idempotency and retries](https://modulify.ai/docs/api/idempotency) for retrying writes safely.