Add the power of the Box AI API to your custom apps at Content Cloud Summit on May 15

Learn more and register!



The search API supports offset-based pagination using the offset and limit query parameters. Marker-based pagination is not supported.

API Pagination

To fetch the first page of search results, the API needs to be called either without the offset parameter, or with the offset set to 0. The limit field is optional.

curl \
  -H "authorization: Bearer ACCESS_TOKEN"

To fetch the next page of entries the API needs to be called with an offset parameter that's equals the sum of the previous offset value and limit returned in the previous result, previous_offset + previous_limit.

curl \
  -H "authorization: Bearer ACCESS_TOKEN"

Note that the offset should be increased by the previous limit and not by the size of the entries in the response array, as this may be less than the limit. Generally we advise using the value of the limit in the response object to increase the offset value.

The final page of items has been requested when the next offset value exceeds the total_count value in the response object. At this point there are no more items to fetch.

Learn more about offset-based pagination

SDK Pagination

Each of our SDKs has built-in support for API pagination. The following code samples show how to use pagination in the search API.

long offsetValue = 0;
long limitValue = 50;

BoxSearch boxSearch = new BoxSearch(api);
BoxSearchParameters searchParams = new BoxSearchParameters();

PartialCollection<BoxItem.Info> page1 = boxSearch.searchRange(offsetValue, limitValue, searchParams);

offsetValue += 50;
PartialCollection<BoxItem.Info> page2 = boxSearch.searchRange(offsetValue, limitValue, searchParams);
BoxCollection<BoxItem> page1 = await client.SearchManager
    .QueryAsync("sales", limit: 50);
BoxCollection<BoxItem> page2 = await client.SearchManager
    .QueryAsync("sales", limit: 50, offset: 50);
page1 ='sales', limit=50)
page2 ='sales', limit=50, offset=50)
const page1 = await'sales', {
  limit: 50
const page2 = await'sales'. {
  limit: 50,
  offset: 50