FiveM’s API is a well made API and very easy to access and use/work with other programs for devs. I want to know if there is any rate limit or for requesting the API.

Let’s say I want to make a server list that’s constantly pulling a get request via ajax from https://servers-live.fivem.net/api/servers/ this data will be parsed and stlyed non stop.

I know that a lot of services have rate limits on their api as discord’s rate limit is 60000ms but is dynamic. When u do go under this threshold, as of what I have been told they get ip banned from discord’s services. I have been banned from twitch’s services for exceeding their rate limit due to my twitch bot surpassing the twitch rate limit (as my bots run on my network) by a stream of mine ‘blowing up’ and sending a welcome msg to all 100 new viewers and also people who leave the stream. Back on topic, will I get ip banned or restricted in anyway if I abuse the web api? Or is there already an automated rate limiter built in it?

If you’re requesting this really often, please make sure:

  • you’re using /api/servers/stream/ (returns a custom-framed list of master.Server) or /api/servers/proto/ (returns a master.Servers with more detail that still takes bandwidth), the current protobuf proto file is found below and the code to parse the /stream/ headers is around ext/cfx-ui/app/servers/servers.worker.ts:
    cfx.proto (851 Bytes)
  • your requests are sending Accept-Encoding: gzip and can handle gzip responses

The main /api/servers/ JSON is there for legacy reasons and I don’t believe it supports gzip responses and it’s really huge and takes up a lot of bandwidth on our end. If you really have to use it, please handle gzip as we’re likely to block non-gzip access to it at some point in the future.

Note: as an implementation detail, currently the main list is cached for 15 seconds, so requesting more often than this has no real point.

2 Likes