ื“ืœื’ ืœืชื•ื›ืŸ ื”ืจืืฉื™

Pagination & Filtering

All list endpoints in the Ever Gauzy API support pagination, sorting, filtering, and relation loading through query parameters.

Paginationโ€‹

Parametersโ€‹

ParameterTypeDefaultDescription
takenumber10Number of records to return (page size)
skipnumber0Number of records to skip (offset)

Exampleโ€‹

GET /api/employee?take=25&skip=50
Authorization: Bearer {token}

Returns records 51โ€“75.

Response Formatโ€‹

All paginated endpoints return:

{
"items": [...],
"total": 150
}
  • items โ€” array of entities for the requested page
  • total โ€” total count of matching records (for calculating page count)

Calculate Total Pagesโ€‹

totalPages = Math.ceil(total / take)
currentPage = Math.floor(skip / take) + 1

Sortingโ€‹

Order Parametersโ€‹

Use order[field]=ASC|DESC:

GET /api/employee?order[createdAt]=DESC&order[firstName]=ASC

Multiple Sort Fieldsโ€‹

Multiple sort fields are applied in order:

GET /api/tasks?order[priority]=ASC&order[dueDate]=ASC&order[title]=ASC

Filteringโ€‹

Where Conditionsโ€‹

Use where[field]=value for exact matches:

GET /api/employee?where[isActive]=true&where[organizationId]=org-uuid

Nested Filteringโ€‹

For related entity fields:

GET /api/tasks?where[project][name]=Gauzy

Organization & Tenantโ€‹

Most endpoints automatically filter by the current tenant. You can additionally filter by organization:

GET /api/employee?where[organizationId]=org-uuid

Relationsโ€‹

Loading Relationsโ€‹

Use relations[]=name to eager-load related entities:

GET /api/employee?relations[]=user&relations[]=organization&relations[]=tags

Nested Relationsโ€‹

GET /api/employee?relations[]=user.role&relations[]=organization.contact

Common Relationsโ€‹

EntityAvailable Relations
Employeeuser, organization, tags, skills
Taskproject, creator, members, teams, tags
Time Logemployee, project, task, timeSlots
InvoicetoContact, fromOrganization, invoiceItems
Candidateuser, source, interview, skills

Date Range Filteringโ€‹

Many endpoints support date range parameters:

GET /api/timesheet/time-log?startDate=2024-01-01&endDate=2024-01-31
ParameterFormatDescription
startDateISO 8601Start of date range
endDateISO 8601End of date range

Some endpoints support full-text search:

GET /api/employee?search=John

Tag Filteringโ€‹

Filter by tags:

GET /api/tasks?tags[]=frontend&tags[]=urgent

Query Builder Syntaxโ€‹

For complex queries, the API supports a query builder syntax via the request body on POST endpoints:

POST /api/employee/search
Authorization: Bearer {token}
Content-Type: application/json

{
"findInput": {
"where": {
"isActive": true,
"organizationId": "org-uuid"
},
"relations": ["user", "organization"],
"order": { "createdAt": "DESC" },
"take": 25,
"skip": 0
}
}

Limitationsโ€‹

  • Maximum take value: 50 (configurable per endpoint)
  • Maximum relation depth: 3 levels
  • Default take when not specified: 10

Best Practicesโ€‹

  1. Always paginate โ€” never request all records without take
  2. Load only needed relations โ€” reduce response payload
  3. Use server-side filtering โ€” filter via query params, not client-side
  4. Cache page counts โ€” total is expensive for large datasets
  5. Use date ranges โ€” for time-based data, always specify date boundaries