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

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

Bitbucket API merge returns 202 even when async param is false

I have a job in Jenkins that merges a BitBucket branch using the Bitbucket API v2.

I am receiving always a 202 status code and I am not sure when this started to happen, because some time ago it wasn't like that, I was receiving 200.

Based on the documentation, there is an optional parameter async that makes the merge in the background, returning 202 with a URL in the header to poll for the status. The documentation specifies that the parameter is false by default and I am not sending it, so I don't see why it's returning 202. But even if I send the parameter with false, I keep receiving always the 202 status code.

Is the documentation outdated and now it's always merging in background? Is that a bug that I should report somewhere?

1 answer

0 votes

Hi Adrian,

Our engineering teams are in the process of migrating many of our core services onto new infrastructure. The move has contributed to recent performance issues that you can read about here:

All Bitbucket Cloud merges are performed asynchronously, be it via the UI or via the API. When using the API, if the merge task completes within a timeout threshold, you will receive 200 response code with the response in JSON format. If the merge takes longer than the timeout threshold, you will receive 202 response code with a polling link in the response header. This is a task-status API endpoint you can poll for the result of the merge task. Please be aware that due to higher latencies post our infrastructure migration it may take longer to receive a success result. If you used our merge API before, you would have received a 500 response after the threshold timeout so your workflows might need to be updated to account for the new 202 response code.

This is the behavior by default, where async query param is set to False, which allows you to receive 200 response within the timeout, before returning 202. You can set this param to True and receive 202 straight away, which allows you to start polling the link on your end right away.

We are aware that this behavior is not well explained in our API docs here:

Our Dev team has an internal ticket in place to get this document properly updated in the next 2 weeks.

We appreciate your patience during these times.

Kind regards,

Suggest an answer

Log in or Sign up to answer
Community showcase
Posted in Bitbucket

How do you use the Bitbucket-Jira integration? How does it help your team?

Hey everyone, over the past year, we've added several new features on how you can use Bitbucket and Jira together. We'd love to know how you'll are using the integration and how it's helping your t...

152 views 0 2
Join discussion

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you