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

How can I set the page size of branches on V2.0?

This question is in reference to Atlassian Documentation: Use the Bitbucket Cloud REST APIs

I need to get a list of branches from my repo. I try this:<repo_name>/<slug>/refs/branches and I get an object:


"pagelen": 10,
"size": 12,
"values": ...


"next": <link>


I want to get more (or possibly more) branches. I tried:<repo_name>/<slug>/refs/branches?limit=1000 but got nothing different. 

  1. Is there a way to get all the branches?
  2. Is there a way to get just the branch names?



2 answers

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

Post a new question

Hi Ben,

You can increase the page length of the returned response by using the pagelen query parameter. But most Bitbucket APIs have a maximum permissible pagelength (usually 100). So in the case of the branches API, you can increase the page length all the way to 100, but no more. You'll still have to page through the branches.

Luis, this appears to be fixed. I just tried it and it worked for me.

Noah helped me understand that urls with multiple parameters need to be in quotes to be recognized by the bitbucket API 2.0.


curl "{teamname}?pagelen=100&page=2"

Yeah, I don't actually remember my thought processes on why I put the quotes on. But I think that & is a reserved character in bash so probably had to do it for that.

Like # people like this

Hi @Abhin Chhabra,

Thanks for the reply. I tried before with pagelen=1000 and got just 10. Now that you told me that the limit is 100 I tried pagelen=100 and it worked. Thanks a lot.

Do you know if there's a way to get just the names without limit? 
I need to show just a list of branches, and getting all this useless data is redundant.



There is an undocumented way (it's undocumented because it's not finished). We accept an undocumented query parameter called fields that can be used for excluding fields (or even for including fields that don't usually get included).

For example, one could do:

$ curl\?pagelen\=1\&amp;fields\="-values.heads,-values.links,-values.repository," | jq .
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100   262  100   262    0     0    344      0 --:--:-- --:--:-- --:--:--   344
  "pagelen": 1,
  "size": 1449,
  "values": [
      "type": "named_branch",
      "name": "0.6"
  "page": 1,
  "next": ";page=2&amp;"

You can exclude even more fields from the list. I hope this helps.

Community showcase
Published in Confluence

An update on Confluence Cloud customer feedback – June 2022

Hi everyone, We’re always looking at how to improve Confluence and customer feedback plays an important role in making sure we're investing in the areas that will bring the most value to the most c...

167 views 1 3
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