OnFinality adds rate limiting to its public API endpoints. By default, the rate limit allows:
HTTP: 900 requests/minute per IP
Websocket: 50 responses/second per web socket connection, with short bursts of 100 responses.
We have different rate limits set for private API endpoints (e.g. ones with API tokens attached) - Read more below
How do we measure this?
For websockets, we use the Token Bucket approach. Each web socket connection has a “bucket” of tokens, representing allowed web socket responses.
50 tokens are added to the bucket per second
The bucket can hold a maximum of 100 tokens. If a token arrives at the bucket when it is full it will be discarded
That means that each web socket connection can sustain a steady stream of 50 responses/second, or bursts of 100 responses after saving up tokens over a period.
Read more on Wikipedia: https://en.wikipedia.org/wiki/Token_bucket
Rate Limit Responses
When a web sockets connection receives a response but has no available tokens OnFinality will return the following error:
API rate limit exceeded
Too Many Requests, Please apply for an OnFinality API key to receive a higher rate limit
We recommend pausing requests over the web sockets connection for several seconds after receiving one of the above error messages to allow the token bucket to fill before trying again.
Access Higher Rate Limits
Rate limits only apply to the Public API and endpoints that have a free API key.
If an app requires a higher rate limit they can upgrade to a paid plan for their OnFinality Workspace and attach their API key to their request. Upgrade now at https://app.onfinality.io
Public Rate Limit Exceptions
The following public APIs have rate limits different to the default
Web Sockets Rate Limit
HTTP Rate Limit
For networks who would like to replicate the rate limit on their own public API endpoint