Rate Limits

Rate limits in Eludris fully depend on the instance's configuration. You can always get a specific instance's rate limit info by using the /rate_limit route or dynamically using response headers.

RateLimitConf

Represents a rate limit for a specific part of the Eludris spec.

FieldTypeDescription
reset_afterNumberThe number of seconds the client should wait before making new requests.
limitNumberThe number of requests that can be made within the time frame denoted by reset_after.

Example

{
  "reset_after": 10,
  "limit": 5
}

InstanceRateLimits

Represents all rate limits that apply to the connected Eludris instance. This includes individual rate limit information for Oprish (REST-api), Pandemonium (Gateway), and Effis (CDN).

FieldTypeDescription
oprishOprishRateLimitsThe rate limits that apply to the connected Eludris instance's REST api.
pandemoniumRateLimitConfThe rate limits that apply to the connected Eludris instance's gateway.
effisEffisRateLimitsThe rate limits that apply to the connected Eludris instance's CDN.

OprishRateLimits

Represents the rate limits for Oprish (REST-api). This denotes the rate limits on each individual route.

FieldTypeDescription
infoRateLimitConfThe rate limit information for the / route.
message_createRateLimitConfThe rate limit information for the /messages route.
rate limitsRateLimitConfThe rate limit information for the /rate_limits route.

EffisRateLimitConf Object

Represents a singular rate limit for Effis (CDN). Unlike normal rate limits, these also include a file size limit.

FieldTypeDescription
reset_afterNumberThe number of seconds the client should wait before making new requests.
limitNumberThe number of requests that can be made within the time frame denoted by reset_after.
file_size_limitNumberThe maximum number of bytes that can be uploaded in the time frame denoted by reset_after.

Example

{
  "reset_after": 10,
  "limit": 5,
  "file_size_limit": 50000000 // 50MB
}

EffisRateLimits Object

Represents the rate limits for Effis. These rate limits denote how often files can be requested from the CDN, as well as maximum file size limits.

FieldTypeDescription
assetsEffisRateLimitConfThe rate limit information for the handling of Assets.
attachmentsEffisRateLimitConfThe rate limit information for the handling of Attachments.

Headers

Every request to a rate limited route returns some rate limit related headers, you're supposed to use these to properly rate limit any clients or API wrapper you make.

HeaderTypeDescription
X-RateLimit-ResetNumberThe reset interval length of a bucket in milliseconds.
X-RateLimit-MaxNumberThe maximum number of requests that can be sent per bucket interval.
x-RateLimit-Last-resetNumberThe UNIX timestamp of the last time this bucket interval was reset in milliseconds.
x-RateLimit-Request-CountNumberThe amount of requests done by the client for this bucket.



X-RateLimit-Byte-MaxNumberThe maximum number of bytes that can be sent per bucket interval
X-RateLimit-Sent-BytesNumberThe number of sent bytes by the client for this bucket interval.

Notes

These headers also exist on 429 responses.


The UNIX timestamps here all use the actual UNIX epoch and not the Eludris one.

How To Implement Rate Limiting

Ideally how rate limiting is implemented is that you check the response headers on every request and check if you've ran out of requests for this interval.

If so, you prevent any other requests on the same bucket for Now - (X-RateLimit-Last-Reset + X-RateLimit-Reset) milliseconds.

Additionally - when dealing with Effis - you should also check if the uploaded files abide by the limits of file sizes in the InstanceInfo payload.

You should also keep track of how many more bytes you can send and limit requests according to that.

Relevant Endpoints

MethodEndpoint
GETOprish /rate_limits
GETOprish /