# Search task types

**Advanced task type filtering with custom GraphQL where clauses and dynamic ordering**
Supports flexible filtering across any task type field using GraphQL-style `where`
clauses, with pagination and dynamic ordering.
**Common filter examples (pass in the `where` field):**
- By code:          `{ "code": { "_eq": "PREP" } }`
- By active status: `{ "active": { "_eq": true } }`
- By billable flag: `{ "billable": { "_eq": true } }`
- By category:      `{ "taskTypeCategoryId": { "_eq": 5 } }`
- By service line:  `{ "serviceLineId": { "_eq": 2 } }`
- Combined:         `{ "_and": [ { "billable": { "_eq": true } }, { "active": { "_eq": true } } ] }`

**Real Example:**

```bash
curl --location 'https://{{host}}/v1/task-types/search' \
--header 'Authorization: Bearer {{token}}' \
--header 'Content-Type: application/json' \
--data '{
  "pageSize": 25,
  "page": 0,
  "where": {
    "_and": [
      { "billable": { "_eq": true } },
      { "active": { "_eq": true } }
    ]
  },
  "orderBy": [
    { "display": "asc" }
  ]
}'
```

Endpoint: POST /v1/task-types/search
Version: 1.0.0
Security: BearerAuth

## Request fields (application/json):

  - `pageSize` (integer)
    Maximum number of task types to return
    Example: 25

  - `page` (integer)
    Offset (number of records to skip) for pagination
    Example: 0

  - `where` (object)
    GraphQL-style where clause for filtering. Supports operators such as `_eq`, `_neq`, `_in`, `_nin`, `_ilike`, `_gte`, `_lte`, and logical combinators `_and`, `_or`, `_not`.
    Example: {"_and":[{"billable":{"_eq":true}},{"active":{"_eq":true}}]}

  - `orderBy` (array)
    Dynamic ordering specifications. Each element is an object mapping a field name to `"asc"` or `"desc"`. Defaults to `[{ "display": "asc" }]`.
    Example: [{"display":"asc"}]

## Response 200 fields (application/json):

  - `taskTypes` (array)
    List of task types matching the filter criteria

  - `taskTypes.id` (integer)
    Unique identifier of the task type
    Example: 1

  - `taskTypes.pmsRef` (string)
    Practice management system reference identifier
    Example: TAX-PREP

  - `taskTypes.code` (string)
    Short code used to identify the task type
    Example: TXPRP

  - `taskTypes.display` (string)
    Human-readable display name
    Example: Tax Preparation

  - `taskTypes.description` (string)
    Detailed description of the task type
    Example: Federal and state income tax preparation

  - `taskTypes.billable` (boolean)
    Whether time logged under this task type is billable
    Example: true

  - `taskTypes.taxable` (boolean)
    Whether this task type is subject to tax
    Example: false

  - `taskTypes.active` (boolean)
    Whether the task type is currently active
    Example: true

  - `taskTypes.customHourlyRate` (number)
    Optional custom hourly rate that overrides the default rate
    Example: 275

  - `taskTypes.rateTypeId` (integer)
    ID of the rate type associated with this task type
    Example: 3

  - `taskTypes.taskTypeCategoryId` (integer)
    ID of the task type category
    Example: 2

  - `taskTypes.serviceLineId` (integer)
    ID of the service line this task type belongs to
    Example: 5

  - `taskTypes.projectsUsedInCount` (integer)
    Number of projects this task type is used in
    Example: 42

  - `taskTypes.invoicesUsedInCount` (integer)
    Number of invoices this task type appears on
    Example: 118

  - `taskTypes.isCreatedByAiwyn` (boolean)
    Whether this task type was created by Aiwyn
    Example: false

  - `taskTypes.isManagedByAiwyn` (boolean)
    Whether this task type is managed by Aiwyn
    Example: false

  - `taskTypes.createdAt` (string)
    Timestamp when the task type was created
    Example: 2023-01-15T08:00:00Z

  - `taskTypes.updatedAt` (string)
    Timestamp when the task type was last updated
    Example: 2024-06-01T12:30:00Z

  - `taskTypes.version` (integer)
    Optimistic locking version number
    Example: 3

  - `total` (object)
    Aggregate count matching the filter (ignores pagination)

  - `total.aggregate` (object)

  - `total.aggregate.count` (integer)
    Total number of task types matching the where clause
    Example: 12

