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

How do i get the file content by passing commit version number?

Shruthi R I'm New Here Dec 08, 2021

May i get a bitbucket API to copy the file content by passing the commit version number?

1 answer

0 votes
Patrik S Atlassian Team Dec 09, 2021

Hello @Shruthi R ,

Welcome to Atlassian Community!

The Bitbucket API provides the following endpoint to get the contents of a single file, or the contents of a directory at a specified revision (commit) :

GET /2.0/repositories/{workspace}/{repo_slug}/src/{commit}/{path}
  • When path points to a file, this endpoint returns the raw contents.
  • When path points to a directory instead of a file, the response is a paginated list of directory and file objects

That being said, and example request to that endpoint would like like the following :

curl --request GET --user <BitbucketUsername>:<AppPassword> --url{workspace}/{repo_slug}/src/{commit}/{path}


For more information about this and other endpoints available on the Bitbucket API, you can refer to the following documentation:

Hope that helps to address your question. Let us know if you need further assistance :)

Best regards,

Patrik S

Suggest an answer

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

📣 Calling Bitbucket Data Center customers to participate in research

Hi everyone, Are you Bitbucket DC customer? If so, we'd love to talk to you! Our team wants to dive deep to understand your long-term plans regarding Bitbucket DC and Atlassian Cloud. Do you plan...

178 views 2 4
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