Pagination, filtering and sorting
How APROS list endpoints page through results, which filter and sort parameters they take, and the exceptions to watch for.
List endpoints return one page of records at a time. Most of them page by number, filter with
query parameters and sort with sortBy and sortOrder.
For the main lists (leads, contacts, companies, deals, activities, projects, tasks and products), the API reference lists every query parameter the endpoint accepts. For other lists it does not list them yet. This page explains the common pattern and the exceptions.
Page through results
Most list endpoints take two query parameters:
| Parameter | Meaning |
|---|---|
page | The page number, starting at 1. |
pageSize | How many records per page. |
They answer with the records in items and the totals next to them:
{
"items": [ ... ],
"total": 128,
"page": 2,
"pageSize": 50,
"pageCount": 3
}total counts every record that matches your filters, not only the ones on this page.
pageCount is the number of pages at this pageSize. A few endpoints call it totalPages
instead, and GET /api/products returns both.
To read everything, request pages until page reaches pageCount (or until items comes back
empty):
curl "https://<your-workspace>.apros.app/api/contacts?page=2&pageSize=100" \
-H "Authorization: Bearer $APROS_API_KEY"Page size limits
- The default page size depends on the endpoint: 20 for leads, 50 for contacts, companies, deals
and tasks, for example. Set
pageSizeexplicitly so you do not depend on it. - The largest page size is 100 on most endpoints.
GET /api/tasksallows up to 500. - Endpoints differ in what they do with a larger value: some answer
400(for example/api/leads,/api/contacts,/api/companies,/api/deals), others quietly use their maximum. Do not ask for more than 100.
Exceptions
| Endpoint | How it differs |
|---|---|
GET /api/invoices, GET /api/quotes | Page size is limit, not pageSize (default 50, max 100). The response reports it back as pageSize and has no pageCount. |
GET /api/tasks/{id}/activity, GET /api/projects/{id}/activity | Cursor-based. Pass limit (max 100) and, for the next page, cursor set to the previous response's nextCursor. Stop when hasMore is false. |
GET /api/employees/directory | A lookup for pickers, not a paged list. Pass search (matched against names) and limit (default 50, max 200). The response has items, returned (how many came back) and hasMore; when hasMore is true, narrow the search. |
| Small reference lists | Some lists, such as currencies, units and tax rates, return everything at once in data with no paging. |
Check each endpoint's response keys in the reference: they are listed for every operation.
Filter
List endpoints filter with query parameters named after the field: for example
GET /api/leads?status=QUALIFIED&temperature=HOT. Common ones:
| Parameter | Meaning |
|---|---|
search | Free text, matched against the main fields of the record (for leads: name, company, email and phone). |
ownerId, departmentId | Records owned by a person or a department. |
status, stageId, pipelineId | Records in a status, a stage or a pipeline. |
createdFrom, createdTo | A creation date range, as ISO 8601 date-times. |
You always get only the records the key's owner is allowed to see; filters narrow that further.
Custom fields
Leads, contacts, companies and deals can be filtered by your workspace's custom fields with
parameters prefixed cf_ and the field's name:
| Field type | Parameters |
|---|---|
| Text, select, boolean | cf_<name>=value (true or false for a boolean) |
| Multi-select | cf_<name>=value1,value2 |
| Number, currency, percentage, rating | cf_<name>Min, cf_<name>Max |
| Date, date and time | cf_<name>From, cf_<name>To |
On contacts, companies and deals, a cf_ parameter that matches no custom field is refused with
400 and the code UNKNOWN_CUSTOM_FIELD_FILTER.
Unknown parameters are refused
Contacts, companies, deals, projects, tasks, products, files, custom entity records and the lead
duplicate endpoints check their query string strictly. A parameter they do not accept, or a
single-value parameter given twice, answers 400 instead of being ignored:
{
"error": "Unknown query parameter(s): limit. Accepted: page, pageSize, ...",
"code": "UNKNOWN_QUERY_PARAM",
"details": {
"unknownParams": ["limit"],
"acceptedParams": ["page", "pageSize", "..."]
}
}The example is shortened; in a real response details.acceptedParams is the full list of what the
endpoint takes. Other endpoints, /api/leads among them, still ignore parameters they do not know,
so a misspelled filter there returns an unfiltered list. Check parameter names against the
reference.
Sort
Most list endpoints sort with two parameters:
| Parameter | Meaning |
|---|---|
sortBy | The field to sort by. The reference lists the accepted fields for each endpoint. |
sortOrder | asc or desc. |
Without them, lists come in a default order, usually newest first (createdAt, desc).
Two endpoints sort differently
GET /api/invoices and GET /api/quotes take a single sort parameter in the form
field:direction, for example sort=dueDate:asc.
The main lists (leads, contacts, companies, deals, projects, tasks and products) accept only the
sortBy fields the reference lists for them and refuse any other with 400. Not every endpoint
checks sortBy, so sort only by fields you know the endpoint supports.