Skip to content

Throttle API requests based on user permissions #1909

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 11 commits into from
Jul 1, 2025
Merged

Conversation

keshav-space
Copy link
Member

@keshav-space keshav-space commented Jun 11, 2025

Anon users are throttled at 3600 requests/hour, authenticated users without any specific throttling permissions are subjected to medium throttling i.e. 14400 requests/hour. Users may be granted permissions from throttle_0_low, throttle_1_medium, throttle_2_high and throttle_3_unrestricted to adjust rate limits as needed.

Below is the current default rate for different tiers. To customize these throttling rates, override them via .env file.

Tier Default rate
THROTTLE_RATE_ANON 3600/hour
THROTTLE_RATE_USER_LOW 10800/hour
THROTTLE_RATE_USER_MEDIUM 14400/hour
THROTTLE_RATE_USER_HIGH 18000/hour
Available Throttling Permissions
Screenshot 2025-06-26 at 2 33 59 PM

Resolves #1884

@keshav-space keshav-space self-assigned this Jun 11, 2025
@keshav-space keshav-space changed the title Throttle API users based on user group Throttle API requests based on user permissions Jun 13, 2025
@keshav-space keshav-space force-pushed the 1884-api-group branch 3 times, most recently from 7fb30f2 to 15ff441 Compare June 13, 2025 12:29
# ),
path(
"admin/",
admin.site.urls,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this rather about enabling altcha and unrelated to this PR?

Copy link
Member

@pombredanne pombredanne left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome! Plaese merge!

Signed-off-by: Keshav Priyadarshi <git@keshav.space>
Signed-off-by: Keshav Priyadarshi <git@keshav.space>
Signed-off-by: Keshav Priyadarshi <git@keshav.space>
Signed-off-by: Keshav Priyadarshi <git@keshav.space>
Signed-off-by: Keshav Priyadarshi <git@keshav.space>
Signed-off-by: Keshav Priyadarshi <git@keshav.space>
Signed-off-by: Keshav Priyadarshi <git@keshav.space>
Signed-off-by: Keshav Priyadarshi <git@keshav.space>
Signed-off-by: Keshav Priyadarshi <git@keshav.space>
Signed-off-by: Keshav Priyadarshi <git@keshav.space>
Signed-off-by: Keshav Priyadarshi <git@keshav.space>
@keshav-space keshav-space merged commit 43cc21c into main Jul 1, 2025
10 checks passed
@keshav-space keshav-space deleted the 1884-api-group branch July 1, 2025 12:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Design user group with appropriate permission for API throttling
2 participants