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!


Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
Community Members
Community Events
Community Groups

Return commit hash after creating a commit using API

The Create a commit by uploading a file endpoint doesn't return anything. I need the commit hash that it has created. Is there a workaround for this?

2 answers

1 vote
Theodora Boudale
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
Apr 12, 2023

Hi @Jonathan Li!

With curl, it is possible to add the -v option, as follows:

curl -u BitbucketUsername:AppPassword -v \
-F myFile.txt=@myFile.txt

When the -v option is added, the output will return, among other things, a line that looks like this:

< location:

The last part is the commit hash of the commit created by the API call.

Kind regards,

0 votes
Aron Gombas _Midori_
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
Apr 06, 2023

If it doesn't return it, maybe you could get the refs from the repo right after you created the commit. Because you know to which branch you created the commit, you need the hash of the head of that branch.

(You could even get the branch itself from the REST API, but as far as I saw it won't return the hash either?!)

Anyway, it should give you an idea.

Suggest an answer

Log in or Sign up to answer
Site Admin
AUG Leaders

Atlassian Community Events