Add support to create / delete branch via REST API in Bitbucket Cloud

Issue #12295 open
Shannon Cruey created an issue

The Bitbucket cloud REST API does not support branch creation / deletion. However the REST API for Bitbucket server does as found in the link below:

Use case: we want to standardize and automate the branch creation process and would most prefer to do this via the REST API. Delete would be nice too.

Comments (19)

  1. Lee Hull

    We need this to implement automation during out development process, currently we have to stop automation to create the branch manually, we really need a way to automate the creation of the branch

  2. Development Tools Sabre Technology

    This is very important for us, to have this feature also in Bitbucket Server.

  3. KartikG

    This is really important to have in Bitbucket Cloud API. we need this functionality desperately. Does anyone know any alternate solution for this?

  4. Toon Geens

    The web-ui seems to use this:

    Request URL:!api/1.0/repositories/xenit/fred/_branch/EWONECM-43
    Request Method:DELETE
  5. Christopher Dancy

    So there is documentation here:

    However ... whether or not the branch exists or not you get a 204 returned which is terrible at best. I write the bitbucket-rest client and this has really bitten our users. There is no good way to tell when a branch is actually deleted.

  6. Zaid

    You can always inspect and use what they use in their web application to create or delete branch.We have been using that way for quiet some time now for our automation work. Also they have a different set of apis for bitbucket cloud and branch. Reach out to me at, will surely help .

  7. Luciano Deriu

    Thanks @Vladimir Starkov,

    For everyone's reference, here is an example curl command that creates a branch off of a specific commit:

    curl -i -X POST \
       -H "Authorization:<token>" \
       -d "branch=release/1.3.1" \
       -d "message=Creating Release 1.3.1 Branch" \
       -d "parents=b58e9c1b435c889ea632c691e15fadf9ca39ce28" \
  8. Christopher Dancy

    Or if on java you can just use the aforemetioned bitbucket-rest client and do the below:

    BitbucketClient client = BitbucketClient.builder()
    CreateBranch createBranch = CreateBranch.create("release/1.3.1", "b58e9c1b435c889ea632c691e15fadf9ca39ce28", "Creating Release 1.3.1 Branch");
    Branch branch = client.api().branchApi().create(createBranch);


  9. Luciano Deriu

    The delete seems to be working now. Here is a curl example that worked for me:

    curl -i -X DELETE \
       -H "Authorization:{token}" \

    See the docs

  10. Log in to comment