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

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root


1 badge earned


Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!


Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.


Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!


Unable to create a new branch in a repo using Bitbucket API 2.0

I want to create a new branch named test-branch-name from the master branch in a given repository. So as per the documentation provided here, I tried creating a new branch in the repository using Postman.

curl --location --request POST '<workspace>/<repo_name>/refs/branches' \
--header 'Content-Type: application/json' \
--header 'Authorization: Basic <auth_token>' \
--data-raw '{
    "name" : "test-branch-name",
    "target" : {
        "hash" : "default"

With above-mentioned request, I get this response.

    "type": "error",
    "error": {
        "fields": {
            "target.hash": "Commit not found: default"
        "message": "Bad request"

If, instead of the default hash, I put the full commit hash of the latest commit from the master branch in the request payload, the API call creates the branch from develop branch and not from master.

What am I missing?

2 answers

1 accepted

1 vote
Answer accepted
Daniil Penkin
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
Feb 10, 2020

Hello @Akshay Maldhure,

Welcome to the Community!

A branch in Git is a pointer to a commit. Bitbucket needs to understand which commit you want to create the branch at. So the value of hash should be something identifying a commit. This can be its hash, a tag or a branch name. You get the error because your repository doesn't have any branches or tags called default, and obviously it's not a valid commit hash too.

As for master vs develop problem when using hash you mentioned, this shouldn't happen. Can you double check you used the right commit hash? The only other explanation I can think of is that master and develop point at the same commit, but I guess that's not the case.

If you're sure you used the right hash, and you still get the branch created at the wrong place, do you mind opening a support case with us and pointing there to the repo in question and dumping commands you ran with their outputs?


If, by making sure about using the right hash, you mean going to<repository_name>/commits/branch/master, clicking on the latest commit and using the full commit has which appears in the browser's address bar, then yes, I'm sure I'm using the right hash. I've created a support request for this issue.

Like Daniil Penkin likes this

@Daniil Penkin ,


How to define the target --> hash for newly created repo

Please guide me to do the same.




@Daniil Penkin ,


How to define the target --> hash for newly created repo

Please guide me to do the same.




Suggest an answer

Log in or Sign up to answer
AUG Leaders

Atlassian Community Events