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

API 2.0 Find files in a branch


Hey all,

Using the API and running this query for example...

returns only myfile.json if it exists in the Master branch of the "myrepo" repo. I can't find any information on how to search within another branch.

How can I alter this search to search either a specific branch or the entire repo?


1 answer

0 votes
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
Dec 17, 2020

@StuMid the code search API only indexes the main branch so you're correct that you can only use this API with that branch to search file contents.

That said, you can use the src API to fetch files from any branch given that you know the filename.

You can use a branch name where it says "commit" but there is an annoying limitation that the branch name cannot contain a slash. If the branch name contains a slash you'd have to take a 2 step approach and first look up the commit of the branch using the branch API.

Adolfo Perez Solis
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
Mar 09, 2023 • edited

Reading the documentation seems like you also need to know the path in addition to the filename when using the src API you suggested isn't it? In 2023 isn't still an easy way to search for files in a given branch? Without knowing the full path of the file

Suggest an answer

Log in or Sign up to answer
AUG Leaders

Atlassian Community Events