> ## Documentation Index
> Fetch the complete documentation index at: https://developers.dock.us/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 accounts](/api-reference/endpoint/accounts/retrieve-a-list-of-accounts)
* [retrieve a list of users](/api-reference/endpoint/users/retrieve-a-list-of-users)
* [retrieve a list of workspaces](/api-reference/endpoint/workspaces/retrieve-a-list-of-workspaces)

## Parameters

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

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

Here is how pagination response data looks like:

```json theme={null}
{
  "pageInfo": {
    "page": 1,
    "pages": 10,
    "total": 100,
    "pageTotal": 10,
    "hasNextPage": true,
    "hasPrevPage": false
  }
}
```

## 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.dock.us/v1/accounts?page=1&limit=10' \
    --header 'Authorization: Bearer <token>'
  ```

  ```javascript JavaScript theme={null}
  const options = { method: 'GET', headers: { Authorization: 'Bearer <token>' } };

  fetch('https://api.dock.us/v1/accounts?page=1&limit=10', options)
    .then(response => response.json())
    .then(response => console.log(response))
    .catch(err => console.error(err));
  ```

  ```python Python theme={null}
  import requests

  url = "https://api.dock.us/v1/accounts"

  querystring = {"page":"1","limit":"10"}

  headers = {"Authorization": "Bearer <token>"}

  response = requests.request("GET", url, headers=headers, params=querystring)

  print(response.text)
  ```

  ```go Go theme={null}
  package main

  import (
  	"fmt"
  	"net/http"
  	"io/ioutil"
  )

  func main() {

  	url := "https://api.dock.us/v1/accounts?page=1&limit=10"

  	req, _ := http.NewRequest("GET", url, nil)

  	req.Header.Add("Authorization", "Bearer <token>")

  	res, _ := http.DefaultClient.Do(req)

  	defer res.Body.Close()
  	body, _ := ioutil.ReadAll(res.Body)

  	fmt.Println(res)
  	fmt.Println(string(body))

  }
  ```
</CodeGroup>
