Skip to content

Search staff

Request

🔐 Required role: API_ADMIN

📖 Data dictionary: Staff

Advanced staff filtering with flexible where clauses and dynamic ordering

Uses standard limit/offset pagination via pageSize and page — see Pagination. Use total.aggregate.count to detect the end.

Provides flexible, enterprise-grade filtering for staff directory queries with boolean logic, relationship traversal, and multi-field ordering.

Each result includes service and sub-service lines, wage and employee types, role (formerly staffType), permission set, supervisor, and the record's updatedAt timestamp.

Key capabilities include boolean operators (_and, _or, _not), text matching (_ilike), comparison operators (_gt, _gte, _lt, _lte, _eq, _neq), array operators (_in, _nin), and nested/related filtering (e.g., by office or manager).

Security
(BearerAuth and CfAccessClientId and CfAccessClientSecret) or BearerAuth
Bodyapplication/json
pageSizeinteger, [ 1 .. 1000 ]

Limit — number of records to return (not a page count). Hasura maps this to limit.

Default:50
Example:50
pageinteger, >= 0

Offset — number of records to skip. This is not a page index. To fetch the next N rows after the first N, send pageSize: N and page: N. An offset at or beyond total.aggregate.count returns an empty result array.

Default:0
whereobject

Flexible where clause for complex staff filtering

Example:
{ "_and": [ { … }, { … }, { … }, { … } ] }
orderByArray of objects

Dynamic ordering specifications with multiple fields

Example:
[ { "lastName": "asc" }, { "firstName": "asc" } ]
curl -i -X POST \
  https://api.sandbox.aiwyn.app/gql/v1/staff/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,
    "where": {
      "_and": [
        {
          "_or": [
            {
              "firstName": {
                "_ilike": "%john%"
              }
            },
            {
              "lastName": {
                "_ilike": "%doe%"
              }
            }
          ]
        },
        {
          "active": {
            "_eq": true
          }
        },
        {
          "createdAt": {
            "_gte": "1900-01-01T00:00:00Z"
          }
        },
        {
          "deptId": {
            "_in": [
              1,
              2,
              3
            ]
          }
        }
      ]
    },
    "orderBy": [
      {
        "lastName": "asc"
      },
      {
        "firstName": "asc"
      }
    ]
  }'

Responses

Successfully retrieved filtered staff with dynamic ordering

Bodyapplication/json
staffArray of objects(StaffDirectoryRecord)required
totalobjectrequired
Response
{ "staff": [ { … } ], "total": { "aggregate": { … } } }