Sorting & Filtering
AgentSync APIs support flexible query parameters that allow you to sort, filter, and select fields across array‑returning endpoints. These conventions are consistent across APIs, making it easy to build reusable integrations.
Sorting
Use the sort query parameter to order results.
Basic Sorting
Sort results by any sortable field, such as npn or state:
?sort=npn,desc
?sort=state,asc
If no order is specified, default is ascending (asc).
Multiple sort keys may be supported per endpoint.
?sort=updatedAt,desc&sort=npn,desc
Nested Field Sorting
Sort by a nested field inside an object:
?sort=licenseLoas.loaCode,desc
Filtering
All array-returning endpoints support filtering via query parameters.
To filter by multiple values, pass a comma-separated list:
?states=CA,NC
This filters results where the state is either California or North Carolina.
Refer to each endpoint's API reference documentation for supported parameters.
Field Selection
Use the fields parameter to request only specific fields:
?fields=id,firstName,lastName,email
This reduces payload size and improves performance by returning only the fields you need.
Best Practices
- Combine filters and sorting: Narrow results and order them in a single request.
- Limit fields: Use fields to minimize payload size and speed up responses.
- Validate parameters: Ensure filters and sort keys are supported by the endpoint.
- Use consistent casing: Follow API documentation for field names (e.g., created_at).