# Pagination

All API v2.1 list endpoints return paginated responses by default. This improves performance and ensures that large datasets can be retrieved efficiently.

***

## How Pagination Works

Every list endpoint responds with a standardized JSON structure that includes:

* `next`: the URL to fetch the next page (or `null` if there is no next page)
* `previous`: the URL to fetch the previous page (or `null` if you are on the first page)
* `results`: an array containing the records in the current page

{% hint style="warning" %}
The `count` field is now deprecated because the API is now using Cursor Pagination.
{% endhint %}

***

## Example Paginated Response of a Case Query:

```json
{
  "next": "https://clearinghouse.net/api/v2p1/cases/?case_type=7811&cursor=cD00Njg2Mg%3D%3D&no_cache=1",
  "previous": "https://clearinghouse.net/api/v2p1/cases/?case_type=7811&cursor=cj0xJnA9NDY5MjQ%3D&no_cache=1",
  "results": [
    {
      "id": 15150,
      "name": "Pottinger v. City of Miami",     
      "case_documents_url": "https://clearinghouse.net/api/v2p1/cases/46862/documents/", // URL to retrieve documents related to this case.
      "case_dockets_url": "https://clearinghouse.net/api/v2p1/cases/46862/dockets/", // URL to retrieve documents related to this case.
      "case_resources_url": "https://clearinghouse.net/api/v2p1/cases/46862/resources/" // URL to retrieve documents related to this case.
      "...": "..."
    },
    ...
    // More cases here
  ]
}

```
