Shauny
(Shaun Robinson)
February 20, 2024, 8:47am
1
Is there a rate limit for posting to the API?
I have set up my site to grant badges to users on the forum based on stuff they achieve on my main site, and I am doing bulk API calls to add in the historical ones now as it’s a new feature.
However when I set it off, it may add 30 or more badges for a user, and it only does some of those then I need to trigger it again to get the rest.
There seems to be a rate limit?
Can I increase this limit somewhere? Maybe just for calls from my website?
Thanks
1 Like
Lilly
February 20, 2024, 4:27pm
2
Maybe have a look at this topic:
Discourse ships with 3 different global rate limits that can be configured by site admins.
Global per-ip rate limits
These limits apply to every unique IP address that hits the Discourse application. (files that are served directly from the filesystem or the CDN are excluded)
By default this rate limit is enabled, you may disable it or set it to a reporting mode.
DISCOURSE_MAX_REQS_PER_IP_MODE : default block, this rate limit applies out of the box. (other options are warn, warn+block, and no…
I think API rate limits are here:
### rate limits apply to all sites
max_user_api_reqs_per_minute = 20
max_user_api_reqs_per_day = 2880
max_admin_api_reqs_per_key_per_minute = 60
max_reqs_per_ip_per_minute = 200
max_reqs_per_ip_per_10_seconds = 50
# applies to asset type routes (avatars/css and so on)
max_asset_reqs_per_ip_per_10_seconds = 200
# global rate limiter will simply warn if the limit is exceeded, can be warn+block, warn, block or none
max_reqs_per_ip_mode = block
# bypass rate limiting any IP resolved as a private IP
max_reqs_rate_limit_on_private = false
3 Likes
RGJ
(Richard - Communiteq)
February 20, 2024, 5:34pm
3
So if you’re on a hosted plan somewhere you’ll just need to add a one-second delay between your calls to stay under the limit:
2 Likes