API rate limit
The API rate limit gives each signed-in account a budget of API requests and server time per window. All access tokens and OAuth applications of an account share that budget. The limit is off by default.
All keys are in the configuration reference. An account section overrides only the keys it sets. An invalid value or an unknown section stops Arbinel at startup.
What counts
Section titled “What counts”- API requests, and web requests signed with a token, OAuth grant or password, such as raw files, archives and release downloads.
- Each request counts against the account that sent it, including administrators.
With
sudo, it counts against the administrator who sent it. - The time Arbinel spends handling a request counts against
SERVER_SECONDS_PER_WINDOW, so listing and searching use up a budget faster than cheap requests. - Browser sessions, Git and LFS over HTTP, anonymous requests and Forgejo Actions job tokens do not count.
Limit anonymous requests in the reverse proxy, and exempt accounts with
EXEMPT_ACCOUNTS.
Windows are fixed: a 3600-second window starts at each full hour.
When either budget is used up, Arbinel answers 429 Too Many Requests with Retry-After until the window ends.
Headers
Section titled “Headers”| Header | Value |
|---|---|
X-RateLimit-Limit |
Requests allowed per window. |
X-RateLimit-Remaining |
Requests left in this window. 0 when the time budget is used up too. |
X-RateLimit-Used |
Requests made in this window. |
X-RateLimit-Reset |
When the window ends, in seconds since the Unix epoch. |
X-RateLimit-Cost-Limit |
Server time allowed per window, in milliseconds. |
X-RateLimit-Cost-Remaining |
Server time left in this window, in milliseconds. |
The first three mean the same as on GitHub, so clients written for GitHub’s REST API slow down without changes.
Arbinel keeps the counters in Forgejo’s [cache].
Use redis, so that every node of a high availability setup counts against the same budget.
With memcache, Arbinel refuses to start while the limit is on.
If the cache fails or is slow, Arbinel lets requests through and logs the error.