# Rate limits

| Limit | Value | Counted per |
|---|---|---|
| Requests a minute | 120 | credential (an API key, or one OAuth connection) |
| Requests a day | 5,000 | credential, UTC day |
| Posts created a day | 100 posts | workspace, API and MCP together, UTC day |
| Requests a minute, all credentials together | 600 | workspace (more keys or apps do not add up to more) |
| Requests a day, all credentials together | 20,000 | workspace, UTC day |
| Failed authentications a minute | 30 | key or token presented (a valid credential is never refused because of failures) |
| Failed authentications a minute, all keys | 300 | client address (an IPv6 address counts by its /64) |

Every API answer, and every MCP request, carries two headers:

```http
RateLimit-Policy: "minute";q=120;w=60, "day";q=5000;w=86400
RateLimit: "minute";r=87;t=23
```

`RateLimit-Policy` lists the windows: `q` is the quota and `w` the window in seconds. `RateLimit` describes the tighter
window right now: `r` requests remain and the window resets in `t` seconds.

When you are over a limit the answer is 429 with `Retry-After: <seconds>` and one of two codes:

- `rate_limited`: the request limits (a credential, the workspace as a whole, or too many failed authentications with one key or from
  your address). Wait for `Retry-After` seconds.
- `daily_post_limit`: the workspace has made 100 posts today. It resets at 00:00 UTC.

```json
{"error": {"code": "rate_limited", "message": "Too many requests. Wait for 'Retry-After' seconds.", "field": null, "details": []}}
```

A post counts toward the 100 only once it passes validation, and a create that fails after being counted gives the count
back. `POST /posts/validate` and reads do not count as posts, but they do count as requests.

`GET /me` (and the MCP tool `postaki_get_limits`) shows what is left of today's allowances.

## Being polite

- Back off on 429 and use `Retry-After`; do not retry in a tight loop.
- Reuse the same `Idempotency-Key` when you retry a write, so a retry never makes a second post
  ([Idempotency](https://postaki.io/docs/idempotency/)).
- Prefer webhooks to polling ([Webhooks](https://postaki.io/docs/webhooks/)).
- Some platforms have allowances of their own that are shared by every customer, such as YouTube's daily uploads for the
  whole project. `GET /brands/{id}/channels` shows what is left.
