API rate limits

Hey all,
I’ve come across several (somewhat-old) articles on this forum that outline API rate limits (ex: Global rate limits and throttling in Discourse). I’m interested in this because, during the customization of our site, we’re making several API calls related to users and topics, and I’d like to ensure we keep the calls to a minimum.

Are these settings still configurable via the Admin panel? I haven’t come across anything thus far that relates to the Discourse API rate limits.

If not, is there a way to monitor the request activity somewhere?

Thank you in advance!

2 Likes

These API rate limit settings are not configured via the admin panel, but you will add them to the app.yml file on the server where your discourse site is hosted. So you will have to ssh into your server to make the change if you are self hosted.

3 Likes

@blake thank you for the response! My team is actually going to lean on Discourse for hosting, so we don’t have any of our own config files. Are there any avenues for viewing or tweaking the API limits if this is the route we go down?

:+1:

If you are on enterprise we can tweak some of these limits for you as well as provide some api guidance so that we can reduce your api usage load.

What we recommend is to have your app that is making the API calls handle 429 errors and then check the Retry-After header that is received and this will let you know when you can start making requests again.

@blake thanks again for the info! I think my team is most likely fine with the current standard rate limits as defined by Discourse. Can you share what these limits are? I’ve been unable to track down a definitive list thus far.

Yea the default limits are listed here for the standard/business plans.

@blake once again, thank you for the information! This is somewhat related, but do you know if there is a timeline to add serializer customizations to at the themes/component level? I’ve seen that feature mentioned on this forum here and there over the past year, but I know it hasn’t been implemented yet.

I ask because we’re currently fetching user data on a per-topic basis in the topic list, which can add up once our platform has more and more users. Adding certain pieces of data of the user model to certain serializers could help cut down the API calls we’re currently having to make.

There is not a timeline for that that I’m aware of.

However, I recommend using the data-explorer plugin for custom data requests like this. What you can do is create your own custom sql query and save it so that it gets an id. Then you can make an API call to that saved query and it will execute then and return the json you are after in a single request.