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

Unable to close source branch on merge using Rest API

I am using BitBucket server version 6.5.1.

I am doing a pull followed by a merge, however post the merge the source doesn't get deleted even though I set 'closed' to true in my pull request. 

Pull API (POST) -  /rest/api/1.0/projects/{projectKey}/repos/{repositorySlug}/pull-requests

Sample Body: 

{"title":"test title","description":null,"state":"OPEN","open":true,"closed":true,"fromRef":{"id":"test_id","repository":{"name":null,"slug":"sample","project":{"key":"SAMPLE"},"state":null}},"toRef":{"id":"master","repository":{"name":null,"slug":"sample","project":{"key":"SAMPLE"},"state":null}}}

Sample Response: 



The pull and merge functionality are working fine, however the source doesn't get deleted.

I am referring the rest APIs using link -

What am I missing?


1 answer

0 votes


I hope you need first remove PR, then branch. 


Thanks for the response.

I do not intend to delete the branch separately but to provide a functionality similar to ‘Delete source branch after merging’ – the check box that is seen in the UI, when a merge is done. I found a bug - '' which seems to cover the issue.


Suggest an answer

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

Powering DevOps with Bitbucket Server & Data Center

Hi everyone, The Cloud team recently announced 12 new DevOps features that help developers ship better code, faster   ! While we’re all excited about the new improvements to Bitbucket ...

1,878 views 0 7
Read article

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