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

# Pagination

The majority of top-level API resources support bulk retrieval via list API methods. For example, you can fetch a list of [Clients](https://developer.vetcove.com/clients-and-patients/clinic-client-object), [Patients](https://developer.vetcove.com/clients-and-patients/clinic-patient-object.md), or [Appointments](https://developer.vetcove.com/scheduler/appointment-object.md).

Vetcove uses *cursor-based pagination* with the `starting_after` and `ending_before` parameters. Results are always sorted in **reverse chronological order (most recently created records first)**. An example can be found at the end of this page.

* `ending_before` returns the page that ends immediately before the given object, if set
* `starting_after` returns the page that comes immediately after the given object, if set.
* `limit` returns the number of results per page. Defaults to **10**. This value can be set to any number between **1** and **100**. *Note that larger limits may result in slower response times.*

You can only use exactly one of the `ending_before` or `starting_after` pagination parameters. If you set both parameters, you will receive an [API parameter error](https://developer.vetcove.com/overview/errors.md).

To iterate through a list of all results for a given endpoint and filters, you will pass the *object id* of the last result to `starting_after` on your next query.

We **strongly** recommend using the `next_page` response value to iterate through the data.

**kind** `string`

The type of object returned. In paginated list views, the value will always be `list`.

**has\_more** `boolean`

Indicates if there are more results to fetch.

**next\_page** `string`

A URL relative to the API's domain which you can use to fetch the next page of the list. This link will include the `starting_after` parameter pointing to the next page or, if your current request used `ending_before`, this link will include the `ending_before` parameter pointing to the previous page.

**data** `array`

A list of objects returned by the list endpoint, up to the list limit for the endpoint.

```json Sample Paginated Response theme={null}
{
    "object": "list",
    "next_page": "/ext/v2/clinic_patients?starting_after=183911",
    "has_more": true,
    "data": [{
        "id": 183893,
        "name": "Shadow",
        "species": "CANINE",
        ...
    }, {
        ...
    }]
}
```

### Example usage:

For example, if there are **20** records with IDs `1` through `20`, the first request with `limit=5` would return the following records' IDs:

`[20, 19, 18, 17, 16]`

with the `next_page` with the pre-filled `starting_after=16`.
The next request would return

`[15, 14, 13, 12, 11]`

and so on and so forth, until the value `has_more=False`.

**Note:** Because of soft deletions, some records in the sequence may be missing, though the overall ordering remains intact.
