Pagination and filtering
List endpoints take their options as query parameters.
| Parameter | Type | Default | Notes |
|---|---|---|---|
page |
integer ≥ 1 | 1 |
1-based page number. |
limit |
integer ≥ 1 | 25 |
Items per page; max 100 on most endpoints (a few allow 200; the reference page is authoritative). Values above the maximum fail validation. |
sort |
string | newest first | A field name, ascending; prefix with - for descending (-created_at). Only fields the endpoint allows are honoured. |
search |
string | — | Free-text search over the resource’s main text fields. |
Most list endpoints also accept resource-specific filters (status, owner, dates and so on). The reference page for each endpoint lists them.
curl -H "Authorization: Bearer pat_…" \ "https://api.pitch2sale.com/api/v1/leads?page=2&limit=100&sort=-created_at&search=acme"Response shape
Section titled “Response shape”A list response wraps the items in a key named after the resource, next to the paging totals:
{ "leads": [ { "_id": "65f0c0ffee0000000000abcd", "name": "Acme Ltd", "…": "…" } ], "total": 412, "page": 2, "limit": 100, "totalPages": 5}| Field | Meaning |
|---|---|
<collection> |
The items on this page (leads, contacts, invoices, …). |
total |
Items matching the query across all pages. |
page, limit |
The values used for this response. |
totalPages |
ceil(total / limit). |
Not every list endpoint is uniform — some return a different key or a smaller default limit. The reference page for each endpoint is authoritative.
Fetching everything
Section titled “Fetching everything”Request page=1, then keep incrementing page until page >= totalPages. Use limit=100 to keep the number of requests down, and watch the rate limits. Results can shift while you page if records are created or deleted, so for a full sync sort on a stable field and de-duplicate by id.
Record ids are 24-character hexadecimal MongoDB ObjectIds, for example 65f0c0ffee0000000000abcd. An id in a path that is not 24 hex characters is rejected with 400.