Skip to content

Pagination, Sorting, and Filters

Most list endpoints in the Crewsum customer API use the same query parameters for paging, sorting, and archived records. This page describes those shared rules. Each list endpoint page gives the exact parameters, sort columns, and filters that it supports.

All query parameter values are strings in the URL. The API converts them as described below.

ParameterDefaultDescription
page0The page to return. The first page is 0, not 1.
pageSize25The number of items on each page. There is no maximum.

The API skips page × pageSize items and returns the next pageSize items.

Paged list responses contain the items for the current page and a count:

{
"message": "Successfully fetched clients",
"data": {
"clients": [],
"count": 3
}
}

count is the total number of items that match your filters, across all pages. It is not the number of items on this page. The name of the item array depends on the endpoint, such as clients, projects, or users.

Increase page until you have read count items, or until a page comes back empty.

Terminal window
curl "https://api.crewsum.com/v1/clients/clients?page=0&pageSize=100" \
-H "x-api-key: $CREWSUM_API_KEY"
curl "https://api.crewsum.com/v1/clients/clients?page=1&pageSize=100" \
-H "x-api-key: $CREWSUM_API_KEY"
  • A page or pageSize value that is not a number, such as pageSize=all, is ignored, and the default is used.
  • pageSize=0 returns an empty page. count is still the total.
  • A negative page or pageSize can cause an error (500).
  • A page after the last page returns an empty array. count is still the total.
  • Records can be added or changed while you page through a list. If you need a stable order, sort by createdAt.
ParameterDescription
sortColThe field to sort by. Each list endpoint page lists the allowed values.
sortDirasc or desc.

The API uses sortCol and sortDir only when you send both, and both values are valid. If either one is missing or invalid, the API ignores both without an error and uses the default order.

For most list endpoints:

  • sortDir is not case-sensitive (ASC works).
  • The default order is updatedAt descending, then createdAt descending. Records that were never updated (updatedAt: null) come last.
  • Empty (null) values come last in both directions.

List Timesheets has different rules: sortCol is one of submitted_at, period_start, or period_end, sortDir must be lowercase, and the default order is by submitted_at, newest first.

Terminal window
curl "https://api.crewsum.com/v1/projects/projects?sortCol=createdAt&sortDir=asc" \
-H "x-api-key: $CREWSUM_API_KEY"

Many list endpoints return only records that are not archived by default. Two parameters change this:

ParameterDescription
archivedtrue returns only archived records.
alltrue returns archived and non-archived records. When all=true, the API ignores archived.

These parameters are true only for the exact value true (lowercase). Any other value, such as 1, yes, or True, is treated as false.

You sendYou get
NothingNon-archived records
archived=trueArchived records only
all=trueAll records

List endpoints do not return deleted records. The exception is List Tasks: with all=true, it also returns deleted tasks. Check isDeleted on each task.

EndpointPagingSortingarchived and all
List ClientsYesYesYes
List End CustomersYesYesYes
List ProjectsYesYesYes
List ContactsYesYesYes
List TasksYesYesYes
List SuppliersYesYesYes
List Supplier ContactsYesYesYes
List UsersYesYesYes
List User GroupsYesYesNo
List TimesheetsYesYes, with different rulesNo
List AssociationsNo, returns all matchesNoNo
List User AssignmentsNo, returns all matchesNoNo

Some list endpoints also have their own filters, such as clientId or projectId. See each endpoint page.