# How to get file from no-default branch

**URL:** <https://forum.gitea.com/t/how-to-get-file-from-no-default-branch/3388>\
**Category:** Install/Maintain/Configure\
**Created:** [June 18, 2021, 11:04am UTC](https://forum.gitea.com/t/how-to-get-file-from-no-default-branch/3388 "2021-06-18T11:04:51Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![helen](https://avatars.discourse-cdn.com/v4/letter/h/a88e57/32.png) [@helen](https://forum.gitea.com/u/helen)\
**Post date:** [June 18, 2021, 11:04am UTC](https://forum.gitea.com/t/how-to-get-file-from-no-default-branch/3388/1 "2021-06-18T11:04:51Z")

</div>

A repositopy has 2 branches - master (default) and stage. If I try to get file from branch stage by API, I get file from master. I use url ‘[https://g.cnvl.io/api/v1/repos/myowner/myrepo/raw/gate.php?ref=stage](https://g.cnvl.io/api/v1/repos/myowner/myrepo/raw/gate.php?ref=stage)’

---

<div class="post-metadata">

**Author:** ![TJvV](https://avatars.discourse-cdn.com/v4/letter/t/858c86/32.png) [@TJvV](https://forum.gitea.com/u/TJvV)\
**Post date:** [June 21, 2021, 8:05am UTC](https://forum.gitea.com/t/how-to-get-file-from-no-default-branch/3388/2 "2021-06-21T08:05:12Z")

</div>

Hi,

I think you might want to use the contents rather than raw call.  
At least in the docs (\<host\>/api/swagger) of my current gitea version, raw has no ref parameter, but contents does.

If you check out the swagger page, you can also try out the commands interactively to see whether things will work as expected.
