> ## Documentation Index
> Fetch the complete documentation index at: https://developer.box.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Marker-based Pagination

export const Link = ({href, children, className, ...props}) => {
  const localizedHref = href;
  return <a href={localizedHref} className={className} {...props}>
      {children}
    </a>;
};

export const MultiRelatedLinks = ({sections = []}) => {
  if (!sections || sections.length === 0) {
    return null;
  }
  return <div className="space-y-8">
      {sections.map((section, index) => <RelatedLinks key={index} title={section.title} items={section.items} />)}
    </div>;
};

export const RelatedLinks = ({title, items = []}) => {
  const getBadgeClass = badge => {
    if (!badge) return "badge-default";
    const badgeType = badge.toLowerCase().replace(/\s+/g, "-");
    return `badge-${badge === "ガイド" ? "guide" : badgeType}`;
  };
  if (!items || items.length === 0) {
    return null;
  }
  return <div className="my-8">
      {}
      <h3 className="text-sm font-bold uppercase tracking-wider mb-4">{title}</h3>

      {}
      <div className="flex flex-col gap-3">
        {items.map((item, index) => <a key={index} href={item.href} className="py-2 px-3 rounded related_link hover:bg-[#f2f2f2] dark:hover:bg-[#111827] flex items-center gap-3 group no-underline hover:no-underline border-b-0">
            {}
            <span className={`px-2 py-1 rounded-full text-xs font-semibold uppercase tracking-wide flex-shrink-0 ${getBadgeClass(item.badge)}`}>
              {item.badge}
            </span>

            {}
            <span className="text-base">{item.label}</span>
          </a>)}
      </div>
    </div>;
};

APIs that use marker-based paging use the `marker` and `limit` query parameters
to paginate through items in a collection.

Marker-based pagination is often used in cases where the length of the total set
of items is either changing frequently, or where the total length might not be
known upfront.

## Paging

To fetch the first page of entries in a collection the API needs to be called
either without the `marker` parameter, or with the `marker` set to `0`. The
`limit` parameter is optional.

```sh theme={null}
curl https://api.box.com/2.0/folders/0/items?limit=100&usemarker=true&marker= \
    -H "authorization: Bearer ACCESS_TOKEN"
```

<Note>
  APIs that support both offset-based pagination and marker-based pagination
  require the `usemarker` query parameter to be set to `true` to ensure
  marker-based pagination is used.
</Note>

To fetch the next page of entries the API needs to be called with
an `marker` parameter that equals value of the `next_marker` value that was
received in the API response.

```sh theme={null}
curl https://api.box.com/2.0/folders/0/items?marker=34332423&limit=100&usemarker=true \
    -H "authorization: Bearer ACCESS_TOKEN"
```

The final page of items has been requested when the next `next_marker` value is
`null` in the response object. At this point there are no more items to fetch.

<Note>
  With marker-based paging there is no way to determine the total number of
  entries in a collection except by fetching them all. Applications should not
  retain the `next_marker` value long-term as the internal implementation of the
  markers may change over time.
</Note>

## Marker & Limit

The following query parameters are used to paginate a collection.

| Query parameter | Type    | Default        |                                                                                                                                                                                    |
| --------------- | ------- | -------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `marker`        | String  |                | The first position in the collection to return results from. This should be a value that was returned in a previous request.                                                       |
| `limit`         | Integer | Depends on API | The maximum number of entries to return. If the value exceeds the maximum, then the maximum value will be used.                                                                    |
| `usemarker`     | Boolean |                | An optional query parameter that can be used with API endpoints that support both types of pagination to select pagination type. Set to `true` to enforce marker-based pagination. |

## Collections

When paginating collections, the API returns an object that contains the set of
results as an array, as well as some information about the current page of results.

| Field         | Type    |                                                                                                                                                                    |
| ------------- | ------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| `entries`     | Array   | The page of items for this page. This will be an empty array if there are no results.                                                                              |
| `next_marker` | String  | The value that can be used as the `marker` value to fetch the next page of results. If this value is `null` or an empty string there are no more results to fetch. |
| `limit`       | Integer | The limit used for this page of results. This will be the same as the `limit` query parameter unless it exceeded the maximum value allowed for this API endpoint.  |

## Example endpoints

Some endpoints that support marker-based pagination are:

* <Link href="/reference/get-folders-id-items">List items for a folder</Link>
* <Link href="/reference/get-files-id-collaborations">List a file's collaborations</Link>
* <Link href="/reference/get-webhooks">List all webhooks for a user</Link>
* <Link href="/reference/get-users">List all users in an enterprise</Link>
* <Link href="/reference/get-folders-trash-items">List all items in the trash</Link>

<RelatedLinks
  title="RELATED APIS"
  items={[
{ label: translate("List items in folder"), href: "/reference/get-folders-id-items", badge: "GET" },
{ label: translate("List file collaborations"), href: "/reference/get-files-id-collaborations", badge: "GET" },
{ label: translate("List folder collaborations"), href: "/reference/get-folders-id-collaborations", badge: "GET" },
{ label: translate("List all webhooks"), href: "/reference/get-webhooks", badge: "GET" },
{ label: translate("List all metadata templates for enterprise"), href: "/reference/get-metadata-templates-enterprise", badge: "GET" },
{ label: translate("List recently accessed items"), href: "/reference/get-recent-items", badge: "GET" },
{ label: translate("List all legal hold policies"), href: "/reference/get-legal-hold-policies", badge: "GET" },
{ label: translate("List enterprise device pins"), href: "/reference/get-enterprises-id-device-pinners", badge: "GET" },
{ label: translate("List enterprise users"), href: "/reference/get-users", badge: "GET" },
{ label: translate("List trashed items"), href: "/reference/get-folders-trash-items", badge: "GET" },
{ label: translate("List enterprise users"), href: "/reference/get-users", badge: "GET" }
]}
/>

<RelatedLinks
  title="RELATED GUIDES"
  items={[
{ label: translate("Sorting responses"), href: "/guides/api-calls/sorting", badge: "GUIDE" },
{ label: translate("Offset-based Pagination"), href: "/guides/api-calls/pagination/offset-based", badge: "GUIDE" }
]}
/>
