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

Setting the main branch via REST API

I'm creating repositories in BitBucket Cloud and I'm looking for a way to configure the main branch. If I use a simple request as in API documentation in response I see "mainbranch": null. I tried to add a mainbranch parameter to the request body but it's ignored. Actually it looks like any unsupported parameter is ignored.


So the question is how to configure the main branch via API?

1 answer

1 vote

Hi @v-hleb_v ,

I'm afraid that it is not possible to configure the main branch of a repo via API.

We have a feature request for supporting the main branch update via API (with the PUT method) for existing repos:

I went ahead and created an additional one for setting up the main branch on repo creation (with the POST method) as well:

I would suggest that you add your vote in the feature requests (by selecting the Vote for this issue link) as the number of votes helps the development team and product managers better understand the demand for new features. You are more than welcome to leave any feedback, and you can also add yourself as a watcher (by selecting the Start watching this issue link) if you'd like to get notified via email on updates.

Implementation of new features is done as per our policy here and any updates will be posted in the feature requests.

Please feel free to let me know if you have any questions.

Kind regards,

Suggest an answer

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

New improvements to user management in Bitbucket Cloud 👥

Hey Community! We’re willing to wager that quite a few of you not only use Bitbucket, but administer it too. Our team is excited to share that we’ll be releasing improvements throughout this month of...

3,888 views 10 16
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