HTTP response code: 429. Not doing more than 200 requests in 1 hour
Asked by mgnavarrete:

Hi!

Since the beginning of this week we are having a problem making requests to bitbucket Cloud. The 11th of October everything was working perfectly, we were doing about 400 requests every time we run hour script. However since Monday the execution gives as a 429 error when only around 130 requests have been done.

Has something changed in the rate limit? maybe we are doing requests to fast? I don't understand why this problem is happening when rate limit is 1000.


Answers:
author: Saxea _Flowie_
body: This ticket is also relevant [BCLOUD-17723](https://jira.atlassian.com/browse/BCLOUD-17723) - about rate limit increase


author: mgnavarrete
body: I am doing this request by an Oauth-token I have in workspace. But I also have more oauth for other purposes that also make requests. The requests from different oauth in same workspace count together in order to reach the rate limit?

comments: author: Patrik S
body: Hello [@mgnavarrete](/t5/user/viewprofilepage/user-id/5124621) and thank you for reaching out to Community!

I've reviewed our internal logs for your workspace and it's indeed exceeding the 1000 requests per hour during some periods, which results in the 429 response code you reported.

It's important to note that rate limits are divided into a one-hour rolling window, which means that for every minute that passes, you will be provided that time to run new requests but the total you can run **consecutively** over an hour is 1,000. With that in mind, you can try reducing the calls per hour ratio to avoid being rate-limited.

As for your questions regarding the OAuth consumers you have in the workspace, since those credentials represent the "workspace user", and the rate-limited is applied at the user level, all the OAuth consumers' API calls sum together to calculate the rate limit.

One alternative would be to use [Workspace Access tokens](https://support.atlassian.com/bitbucket-cloud/docs/using-workspace-access-tokens/) instead, as each token will represent a "bot user" that will have its own rate limit.

Hope that helps! Let me know if you have any questions :)

Thank you, [@mgnavarrete](/t5/user/viewprofilepage/user-id/5124621) !  

Patrik S


author: mgnavarrete
body: Thanks you for your answer, I wasn't aware of the Workspace Access tokens and they are very useful for me. However, I still have same problem due to I have more than 1000 repositories and I need to do 1 request per repository in my automation, that means I am going to encounter this very same problem every time regardless what I do.

Is there any way to increment the rate limit for the Workspace Access tokens or for the workspace user? I understand that for normal users it is nor possible because they could collapse the server but workspace user is meant to do automation so 1000 requests is very limitating.


author: mgnavarrete
body: removed


author: Patrik S
body: Hello [@mgnavarrete](/t5/user/viewprofilepage/user-id/5124621) ,

I'm afraid it's not currently possible to increase the rate limits are they are in place to grant the stability of the platform for all the users - we have the feature request for that [BCLOUD-17723](https://jira.atlassian.com/browse/BCLOUD-17723) which you can vote for.

As I mentioned above, if you decide to go with the Workspace Access token, you can create more than one token and divide the calls among them. Each access token represents a separate "bot user" in the workspace, meaning that each token will get its own 1000 requests/hour.

Another alternative, since the rate limits are calculated in a rolling hour window, is to space out the calls to the API on the script/automation you are executing.

Thank you, [@mgnavarrete](/t5/user/viewprofilepage/user-id/5124621) !  
Patrik S


author: mgnavarrete
body: Thanks for the info Patrik, I will vote for that feature request because sadly other solutions do not fit for us.


Tags: bitbucket-cloud

cloud