> ## Documentation Index
> Fetch the complete documentation index at: https://speakeasy-20cf8bdf.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Pagination

> Learn how to paginate through resources in the API.

The pagination feature allows you to retrieve a subset of resources from the API. This is useful when you have a large number of resources and you want to retrieve them in smaller chunks.

These list API methods share a common set of parameters that allow you to control the number of items returned and the page number. For example, you can:

* [retrieve a list of links](/api-reference/endpoint/retrieve-a-list-of-links)
* [retrieve a list of domains](/api-reference/endpoint/retrieve-a-list-of-domains)
* [retrieve a list of events](/api-reference/endpoint/retrieve-a-list-of-events)

## Parameters

<ParamField body="page" type="string" default="1">
  The page number to retrieve. By default, the first page is returned.
</ParamField>

<ParamField body="pageSize" type="string">
  The number of items to retrieve per page. The default value varies by
  endpoint. Maximum value is 100.
</ParamField>

<ParamField body="sortBy" type="string">
  The field to sort the results by.
</ParamField>

<ParamField body="sortOrder" type="string">
  The order to sort the results by. Can be `asc` or `desc`.
</ParamField>

## Example

The following example demonstrates how to retrieve the first page of 10 links:

<CodeGroup>
  ```bash cURL theme={null}
  curl --request GET \
    --url https://api.dub.co/links?page=1&pageSize=10 \
    --header 'Authorization: Bearer <token>'
  ```

  ```typescript TypeScript theme={null}
  const res = await dub.links.list({
    page: 1,
    pageSize: 10,
  });
  ```

  ```python Python theme={null}
  res = s.links.list(request={
    "page": 1,
    "page_size": 10,
  })
  ```

  ```go Go theme={null}
  request := operations.GetLinksRequest{
    Page: dubgo.Float64(1),
    PageSize: dubgo.Float64(10),
  }

  ctx := context.Background()
  res, err := s.Links.List(ctx, request)
  ```

  ```ruby Ruby theme={null}
  req = ::OpenApiSDK::Operations::GetLinksRequest.new(
    page: 1,
    page_size: 10,
  )

  res = s.links.list(req)
  ```
</CodeGroup>
