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

# Pagination and filtering

> Page through Peerlogic API results and apply supported query filters.

List endpoints support page-number pagination. Individual endpoints may also support filters and sorting; use only the parameters shown in the API Reference for that endpoint.

## Pagination

Use these query parameters on paginated endpoints:

* `page`: Page number, beginning with `1`.
* `page_size`: Number of results per page. The default is `50`, and JSON responses accept up to `100`.

```bash theme={null}
curl "https://api.prod.peerlogic.com/api/calls/?page=2&page_size=50" \
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN"
```

A paginated response contains:

```json theme={null}
{
  "meta": {
    "page": 2,
    "page_total": 25,
    "page_size": 50,
    "results_total": 1240
  },
  "links": {
    "previous": "https://api.prod.peerlogic.com/api/calls/?page=1&page_size=50",
    "self": "https://api.prod.peerlogic.com/api/calls/?page=2&page_size=50",
    "next": "https://api.prod.peerlogic.com/api/calls/?page=3&page_size=50"
  },
  "results": []
}
```

Follow `links.next` until it is `null`. This avoids calculating page URLs yourself.

## Filtering

Filtering and sorting options are specific to each endpoint. The endpoint's API Reference lists every supported query parameter, its accepted format, and whether it is required.

Many filters accept Peerlogic resource IDs. Use the identifiers returned by the API, especially the organization and practice IDs described in [Organization, practice, and resource IDs](/concepts/organizations-and-practices).

### Filter naming conventions

Some filter names use double underscores (`__`) to express a relationship or comparison:

| Pattern | Meaning |
| - | - |
| `related_resource__field` | Filter using a field on a related resource. |
| `field__in` | Match any value in a supplied set. The endpoint defines the accepted multi-value format. |
| `field__gte` | Match values greater than or equal to the supplied value. |
| `field__lte` | Match values less than or equal to the supplied value. |
| `field__startswith` | Match text values beginning with the supplied text. |

Relationships can span more than one resource, so a supported parameter can contain multiple double-underscore segments. Send the complete parameter name exactly as it appears in the API Reference.

Other common conventions include:

* Parameters ending in `_after` or `_before` define time boundaries. Check the endpoint description to determine whether each boundary is inclusive or exclusive.
* Boolean filters accept the values documented by the endpoint.
* `search` performs the endpoint's supported text search.
* `sort` or `ordering` selects a supported sort field. Prefix the field with `-` for descending order when the endpoint supports that convention.

<Note>
  Do not assume that a filter supported by one list endpoint is available on another. Unsupported query parameters may be ignored.
</Note>


## Related topics

- [Retrieve historical call data](/guides/pull-call-history.md)
- [Get opportunities by practice](/peerlogic-api-reference/call-insights/get-opportunities-by-practice.md)
- [Get missed-call counts by practice](/peerlogic-api-reference/call-insights/get-missed-call-counts-by-practice.md)
- [Get call counts by practice](/peerlogic-api-reference/call-insights/get-call-counts-by-practice.md)
- [List call filter options](/peerlogic-api-reference/call-insights/list-call-filter-options.md)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.