🔐 Required role:
API_ADMIN📖 Data dictionary: Client
Advanced client filtering with flexible where clauses and dynamic ordering
Uses standard limit/offset pagination via pageSize and page — see Pagination.
This query provides maximum flexibility for client data retrieval through custom where clause construction and dynamic ordering specifications. It's designed for complex business requirements that need sophisticated filtering logic.
Key Features:
- Custom
whereclause construction for unlimited filtering combinations - Dynamic
order_byspecifications 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)
- 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
Limit — number of records to return (not a page count). Hasura maps this to limit. Defaults to 50 when omitted.
Offset — number of records to skip. This is not a page index. Same contract as POST /gql/v1/clients. When page is at or beyond total.aggregate.count, clients is an empty array.
Flexible where clause for complex filtering
{ "_and": [ { … }, { … }, { … }, { … } ] }
- Sandbox (requires Cloudflare Access headers)https://api.sandbox.aiwyn.app/gql/v1/clients/search
- Staging (requires Cloudflare Access headers)https://api.staging.aiwyn.app/gql/v1/clients/search
- Production (your live firm data; no Cloudflare Access headers)https://api.aiwyn.ai/gql/v1/clients/search
curl -i -X POST \
https://api.sandbox.aiwyn.app/gql/v1/clients/search \
-H 'Authorization: Bearer <YOUR_JWT_HERE>' \
-H 'CF-Access-Client-Id: YOUR_API_KEY_HERE' \
-H 'CF-Access-Client-Secret: YOUR_API_KEY_HERE' \
-H 'Content-Type: application/json' \
-d '{
"pageSize": 1,
"page": 0,
"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"
}
]
}'{ "clients": [ { … } ], "total": { "aggregate": { … } } }