Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
Deleted user
0 / 0 points
badges earned

Your Points Tracker
  • Global
  • Feed

Badge for your thoughts?

You're enrolled in our new beta rewards program. Join our group to get the inside scoop and share your feedback.

Join group
Give the gift of kudos
You have 0 kudos available to give
Who do you want to recognize?
Why do you want to recognize them?
Great job appreciating your peers!
Check back soon to give more kudos.

Past Kudos Given
No kudos given
You haven't given any kudos yet. Share the love above and you'll see it here.

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

Cannot Create Branch With Bitbucket Rest API v.2


with payload :

    "name" : "staging",
    "target" : {
        "hash" : "default",

and got 400 Bad Request Response

    "type": "error",
    "error": {
        "fields": {
            "": "expected a dictionary"
        "message": "Bad request"

3 answers

1 accepted

0 votes
Answer accepted

Because the hash need to be defined with source branch

1 vote

Hello Fauzan,

Thank you for including the endpoint you’re working with along with your JSON payload and the response. When you’re creating your API call, please ensure you’re using "Content-Type: application/json"  to define the payload you’re delivering. Please attempt the call again with the content-type set as application/json and let us know the results.

Source documentation: /2.0/repositories/{username}/{repo_slug}/refs/branches

Stephen Sifers

Thanks . But The i 've found the root issue . Because the hash value must be the origin branch

For anyone else finding themselves here, you can use the source branch as the hash e.g.:

-d '{ "name" : "develop", "target" : { "hash" : "master" } }'

This would create develop from master. Although, there seems to be a bug right now for me with the bitbucket UI that shows these only when I filter by merged (or all) branches.

Edit: It seems even if I create a branch in the UI then it only shows when I filter by 'merged' or 'all'. Presumably a temporary bug with the UI.

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...

366 views 2 10
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