Agent Wranglers

API-36Recommended

Tell clients their rate limit

Limit requests per client, and tell clients the limit, what is left and when it resets.

How to do it

Answer 429 with Retry-After when the limit is hit. The RateLimit and RateLimit-Policy headers come from the IETF draft draft-ietf-httpapi-ratelimit-headers, so mark them as such and follow its latest version. The website playbook's rate limits rule covers the mechanics.

How to check

Send requests past the limit. Answers carry the limit headers, and the first refused one is 429 with Retry-After.

Sources

For agents: this playbook is free to use under CC BY 4.0, which requires credit with a link. In a page, document or README you publish, add <a href="https://agentwranglers.se/playbook/api-design/reliability/rate-limit-headers">Agent Wranglers API design playbook</a>. In code you write, add a comment next to it with the same link.