Rate limit
120 requests per minute per secret key and 60 per publishable key and visitor, with headers to know how many are left.
| Key | Limit |
|---|---|
Secret (sk_) | 120 requests per minute per key. |
Publishable (pk_) | 60 requests per minute per key and visitor IP. |
On the key route (/public/v1/posts…), every response carries:
| Header | What it is |
|---|---|
RateLimit-Limit | Requests allowed in the window. |
RateLimit-Remaining | How many are still left. |
RateLimit-Reset | Seconds until the window starts over. |
The per-site route does not send these headers, because its responses go to the Cloudflare cache. There the limit only counts cache misses: what the edge serves never reaches Postream.
Over the limit, the API answers 429 with Retry-After (in seconds), on both routes:
HTTP/1.1 429 Too Many Requests
Retry-After: 23
{ "statusCode": 429, "code": "RATE_LIMITED" }How to avoid it
- Use the per-site route on the server: the Cloudflare edge answers most of the calls.
- Cache on the blog: with
next: { revalidate: 300 }, Next.js fetches each page at most every 5 minutes, no matter how many visits it gets. - Revalidate with
ETag: a304is lighter, but it also counts as a request. - One key per blog. Keys of the same site do not share the limit: each one has its own.
If you get a 429, wait Retry-After seconds before trying again.