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

Rate Limits of Pull Request API endpoint?

John Lindahl June 12, 2019

I am building a check-script på a CI-env to check for new Pull Requests and run builds for them. The problem I am facing is that I do get alot of 429 errorcodes since I bombard the API to much (multiple repos and every X time-interval).

https://confluence.atlassian.com/bitbucket/rate-limits-668173227.html does not however document how many requests I am allowed to do for the endpoint(s):

/api/2.0/repositories/${project}/${repository}/pullrequests?limit=${limit}&state=OPEN

Also the document mentions that you are locked out for an hour which is not the way I "feel" how the API responds. But rather it works again just a few seconds later.

 

Is there any better way to do these checks and/or any info on how much I will have to throttle my requests?

1 answer

1 accepted

0 votes
Answer accepted
Daniel Santos
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
June 14, 2019

Hi @John Lindahl

Thank you for the detailed description of your scenario.

Let me share what I know about it:

  • The 1h limit is measured by a rolling window which means that in every minute you may have back some "credits" to run new requests until the total of 1000. That explains why you are not blocked for 1h.
  • Any request to /api/2.0/repositories/... will share the same request limit of 1000 calls.
    It means that you call 500 times the /api/2.0/repositories/${project}/${repository}/pullrequest endpoint and also call 500 times the /api/2.0/repositories/{username} endpoint in less than 1h you will be blocked until the rolling window frees up some calls.
  • Each user will have a new set of limits. So you will have 1000 calls per hour for user A and also 1000 request per hour for user B. In case you have more users to run those calls this is how you could handle more calls per hour.

I hope I could clarify a little bit how the limits are set.

Please let me know if you have more questions.

John Lindahl June 14, 2019

Thank you for this clarification. Now I Know how to work around this.

Like Daniel Santos likes this
Daniel Santos
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
June 18, 2019

You are welcome!
I'm glad I could help you with this one.

Jérôme Fraissinet
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
October 30, 2019

We are facing the same  problem with our generic account which build the release. Is it possible to increase this rate limit just for him ? We plan to migrate to gitlab just for that.

Daniel Santos
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
November 4, 2019

Hi @Jérôme Fraissinet

The only way to increase the number of requests is by using an extra user and splitting the requests between the two. We can't change the limits for your account, unfortunately.

JamesHueston NA
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
December 22, 2020

@Daniel Santos - when you say "extra user" - do you mean

A) a second Member (User Account Login) of the existing Workspace, or
B) a second Workspace and move projects from the existing Workspace to the new one, or
C) something else?

where:  https://bitbucket.org/[Workspace]/[Repository]/

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events