Skip to content
Arbinel

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.

[arbinel.api_ratelimit]
ENABLED = true
REQUESTS_PER_WINDOW = 15000
SERVER_SECONDS_PER_WINDOW = 1800

[arbinel.api_ratelimit.account.renovate-bot]
REQUESTS_PER_WINDOW = 50000
SERVER_SECONDS_PER_WINDOW = 7200

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.

  • 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.

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.