API rate limitations

Hello Coda team!

As of yesterday I started getting Too Many Requests error when using Coda API. I looked for any even aproximated secifications of Coda API rate limit but the only thing i found is that “Coda API sets a reasonable limit on the number of requests that can be made per minute” and that you are still tuning this parameter, so “it’s hard to be clear on this”.
So I tried to conduct a test and find out the limitations by myself, which gave me a result of 200 GET and 199 PUT requests in 5 minutes max. So i added 5 minute waits between parts of my script and it worked all fine until I got Too Many Requests again right after one of the 5m waits (in the middle of the script). This made me think that you might have some per-hour limitations, but re-running the script right after that worked all right. So I am a little bit confused, and it would be great if you could help me with any tips and tricks :slight_smile: .
More info on my ‘set-up’: I am using Python and codaio Python wrapper.

Thanks!

1 Like

I’m interested in the answer to this too.

But also, maybe others would have some ideas about how to optimize things in your script if you keep hitting the limits - maybe some batching? Feel free to share some info about your script if you like.

2 Likes

Hi @Anastasiia_RSG_DA - Welcome to the Coda community! I can totally understand the frustration, and in my experience it’s pretty common for APIs to be cagey when it comes to the exact details around rate limits. This is for a few reasons:

  • To discourage developers from hard-coding those limits into their application, since it makes it more painful if they have to change in the future.
  • Rate limits can be enforced by many different layers and parts of the system, so it can be hard to track them down and document them.

As you’ve shown it’s possible via experimentation to determine the approximate current rate limits, but I would still advise you don’t rely on those numbers as they are subject to change. Instead detect rate limit errors (429 response code) and when they occur wait for a bit and then try again. One popular strategy for this is exponential backoff, whereby you double the time you wait each time it fails (30 seconds, then a minute, then two minutes, etc).

As @Nick_HE mentioned it’s also worth investigating if you can use batch endpoints to reduce the total number of requests you are making. For example, the upsertRows endpoint allows you to add multiple rows at once.

Let me know if this helps, and if you have any other questions.

1 Like