Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Bitbucket REST API Rate Limiting ?

Jeremy Freeman February 26, 2018

I'm downloading a list of commits through the Bitbucket REST API, and I'm running into the flowing message:

AppError: Rate limit for this resource has been exceeded.

There is information on the rate limits here: https://confluence.atlassian.com/bitbucket/rate-limits-668173227.html

However, there isn't a lot of information around how they work, when they reset, or what the timeout is. I would like to modify my download script in a way that can download the full list of commits, while still respecting the limits.

2 answers

1 accepted

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

Post a new question

1 vote
Answer accepted
Ana Retamal
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
February 28, 2018

Hi Jeremy, rate limits are divided into one hour windows for both authenticated and unauthenticated requests. To obtain a list of repository commits, the rate is 1,000 requests per hour. Once you reach it you'll need to wait until 1 hour has passed so you can continue sending requests.

Hope this clarifies!

Ana

Jeremy Freeman February 28, 2018

So, does that mean If I make 1000 requests from 9:45 to 9:59, I can then make 1000 more requests from 10:01-10:15.

Is the one hour window based on clock time? is it a rolling count? Does it start with the last request?

My workload is bursty, so, I would like some clarification around how it's calculated to better prepare for this.

Yana
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
March 1, 2018

Hi Jeremy, 

It's the rolling count I believe , not by clock hour. 

Cheers.

Yana

Jeremy Freeman March 3, 2018

Thanks!  Is there no official documentation on this behavior, aside from the above link?

Yana
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
March 6, 2018

Hi Jeremy, 

The document linked above is what we have available right now. 

If you do get more questions or need clarification on anything please do get in touch via the community or raise a support ticket with us.

Cheers.

Yana

Jeremy Freeman May 9, 2018

I'm responding to this to add to the documentation.  My tests confirmed that it's a rolling count.

Like # people like this
Earl Berg April 8, 2020

@Ana Retamal your comment here contradicts the documentation 

Rate limits are divided into a one-hour rolling window for both authenticated and unauthenticated requests, 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. 

That would imply that when you hit the limit, you may only have to wait 1 minute to have some requests available. For example, if I send 500 requests at 3:33 and 500 requests at 4:32, as soon as it ticks 4:33, you'll get those first 500 requests back. But if I send all 1000 requests at 4:32, I'll have to wait until 5:32 to send another request.

... assuming my understanding of the documentation and its intended meaning are the same thing.

Like Charles Perrot-Minot likes this
1 vote
Alok Saldanha May 4, 2018

I may be missing something, but rather than using the API could you clone the entire repo and extract the list of commits locally?

Jeremy Freeman May 7, 2018

I'm not able to find an endpoint to clone the repository from the OAuth Credentials.

seanaty
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
June 4, 2019

I realize that this is a year late, but in case anyone lands here, you can use an oauth access token to clone repos as described on this page: https://developer.atlassian.com/bitbucket/api/2/reference/meta/authentication

Repository Cloning

Since add-ons will not be able to upload their own SSH keys to clone with, access tokens can be used as Basic HTTP Auth credentials to clone securely over HTTPS. This is much like GitHub, yet slightly different:

$ git clone https://x-token-auth:{access_token}@bitbucket.org/user/repo.git

The literal string x-token-auth as a substitute for username is required (note the difference with GitHub where the actual token is in the username field).

Like Jeremy Freeman likes this
Jeremy Freeman June 12, 2019

Thanks for that @seanaty I had since found this, and have started using it.  

TAGS
AUG Leaders

Atlassian Community Events