How to apply the limit filter in Bitbucket Server and Datacenter ReST API and query more than the max limit of 1000 results.

Platform Notice: Data Center Only - This article only applies to Atlassian products on the Data Center platform.

Note that this KB was created for the Data Center version of the product. Data Center KBs for non-Data-Center-specific features may also work for Server versions of the product, however they have not been tested. Support for Server* products ended on February 15th 2024. If you are running a Server product, you can visit the Atlassian Server end of support announcement to review your migration options.

*Except Fisheye and Crucible

Summary

By default, Bitbucket Server and Datacenter ReST API returns 25 results, which can be increased to 1000 using the limit filter. However, for some customers, this limit may not be enough. To get the complete result set, follow the steps in the solution section of the article.

Environment

Bitbucket Server and Datacenter 6.x, 7.x,8.x,9.x

Solution

Case 1:

To fetch 1000 results, append ?limit=1000 at the end of the Bitbucket Server and Datacenter ReST resource.

Example:

1 curl -H "Content-Type:application/json" --user <Bitbucket admin username>:<password> -H "Accept:application/json" -X GET "<BITBUCKET_BASE_URL>/rest/api/1.0/admin/users?limit=1000"

Note: If you are using cURL to run the API call enclose the entire ReST resource in double quotes, in the case of Postman it is not mandatory. 

Case 2:

To fetch all the results

  1. Run the API to get the first 1000 results

  2. Note the"nextPageStart" value from the results

  3. set the number from "nextPageStart" to start parameter

    ?start=1&limit=1000

1 curl -H "Content-Type:application/json" --user <Bitbucket admin username>:<password> -H "Accept:application/json" -X GET "<BITBUCKET_BASE_URL>/rest/api/1.0/admin/users?start=1&limit=1000"

Updated on March 20, 2025

Still need help?

The Atlassian Community is here for you.