/
Search clients
Advanced client filtering with custom GraphQL where clauses and dynamic ordering
This query provides maximum flexibility for client data retrieval through custom GraphQL-style where clause construction and dynamic ordering specifications. It's designed for complex business requirements that need sophisticated filtering logic.
Key Features:
- Custom GraphQL where clause construction for unlimited filtering combinations
- Dynamic order_by specifications supporting multi-field sorting with custom directions
- Advanced boolean logic combining multiple filter conditions with _and, _or, _not
- Relationship-based filtering across connected entities (contacts, staff assignments)
- Custom pagination with flexible pageSize and page controls for any result set size
- Full access to GraphQL query capabilities through REST interface abstraction
- Enterprise-grade filtering supporting complex business logic requirements
- Support for nested queries and conditional logic patterns
Advanced Filtering Capabilities:
- Boolean Logic: _and, _or, _not operators for complex condition combinations
- Text Operations: _like, _ilike, _regex for pattern matching and search
- Comparison Operators: _gt, _gte, _lt, _lte, _eq, _neq for numerical/date comparisons
- Array Operations: _in, _nin for multi-value filtering and inclusion/exclusion
- Null Handling: _is_null for empty value detection and filtering
- Relationship Traversal: Filter on connected entities like contacts and staff
- Date Ranges: Precision timestamp filtering for time-based analysis
- Case Sensitivity: Both case-sensitive and case-insensitive text matching
Dynamic Ordering Options:
- Multi-field Sorting: Order by multiple columns with individual sort directions
- Relationship Sorting: Sort by connected entity fields (staff names, contact info)
- Custom Directions: Mix ascending and descending order across different fields
- Priority Ordering: Define primary, secondary, tertiary sort criteria
- Date-based Sorting: createdAt, updatedAt for chronological ordering
- Text Sorting: Alphabetical ordering with locale-aware collation
Real Example:
curl --location 'https://{{host}}/v1/clients/search' \
--header 'Authorization: bearer {{token}} \
--header 'Content-Type: application/json' \
--data '{
"pageSize": 1,
"where": {
"_and": [
{
"_or": [
{
"name": {
"_ilike": "%tech%"
}
},
{
"clientRef": {
"_ilike": "%45%"
}
}
]
},
{
"active": {
"_eq": true
}
},
{
"createdAt": {
"_gte": "1900-01-01T00:00:00Z"
}
},
{
"partnerStaffId": {
"_in": [
5,
6,
7,
8
]
}
}
]
},
"orderBy": [
{
"name": "asc"
},
{
"createdAt": "desc"
}
]
}'Security
BearerAuth
GraphQL-style where clause for complex filtering
Example:
{ "_and": [ { … }, { … }, { … }, { … } ] }
- Mock serverhttps://api.doc.aiwyn.ai/_mock/bundle/gql/v1/clients/search
- Sandboxhttps://demo.api.aiwyn.ai/gql/v1/clients/search
- Staginghttps://staging.api.aiwyn.app/gql/v1/clients/search
curl -i -X POST \
https://api.doc.aiwyn.ai/_mock/bundle/gql/v1/clients/search \
-H 'Authorization: Bearer <YOUR_JWT_HERE>' \
-H 'Content-Type: application/json' \
-d '{
"pageSize": 1,
"where": {
"_and": [
{
"_or": [
{
"name": {
"_ilike": "%tech%"
}
},
{
"clientRef": {
"_ilike": "%45%"
}
}
]
},
{
"active": {
"_eq": true
}
},
{
"createdAt": {
"_gte": "1900-01-01T00:00:00Z"
}
},
{
"partnerStaffId": {
"_in": [
5,
6,
7,
8
]
}
}
]
},
"orderBy": [
{
"name": "asc"
},
{
"createdAt": "desc"
}
]
}'Response
- Filtered clients with dynamic ordering and relationships
- Sample from actual API response
- No clients match filter criteria
{ "clients": [ { … }, { … } ], "total": { "aggregate": { … } } }