# Search Tasks

POST https://services.leadconnectorhq.com/projects/tasks/search

Searches tasks across the location with filters, sort, free-text `query`, and optional `subtaskViewMode`. Requires `limit`; pass body `searchAfter` from the previous response `searchAfter` (opaque base64url string) for the next page. Scope to lists with `listIds` (max 10) — do not send a separate `graph` filter when using `listIds`. Filter subtasks with `parentTaskId` (Tasks V2 locations only; otherwise 422). `subtaskViewMode=expanded` returns embedded `subtasks[]`; `separate` may include `parentName`. Neither field appears on Get/Create/Update/List/Batch. `total` is the hit count after filters and access scope.

## Authentication

Send `Authorization: Bearer <token>` using:

- **Sub-Account token: OAuth access token or Private Integration Token.** Scopes: `projects/tasks.readonly`

## Parameters

### Header Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `Version` | string | Yes | API Version |

### Query Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `locationId` | string | No | Location id. **Required for `channel: APP`.** Ignored for OAuth/PIT — those use the location on the auth token. Do not send in path, body, or headers. |

## OpenAPI Specification

```json
{
  "openapi": "3.0.0",
  "info": {
    "title": "HighLevel API",
    "version": "2021-04-15"
  },
  "servers": [
    {
      "url": "https://services.leadconnectorhq.com"
    }
  ],
  "paths": {
    "/projects/tasks/search": {
      "post": {
        "summary": "Search Tasks",
        "operationId": "searchTasks",
        "description": "Searches tasks across the location with filters, sort, free-text `query`, and optional `subtaskViewMode`. Requires `limit`; pass body `searchAfter` from the previous response `searchAfter` (opaque base64url string) for the next page. Scope to lists with `listIds` (max 10) — do not send a separate `graph` filter when using `listIds`. Filter subtasks with `parentTaskId` (Tasks V2 locations only; otherwise 422). `subtaskViewMode=expanded` returns embedded `subtasks[]`; `separate` may include `parentName`. Neither field appears on Get/Create/Update/List/Batch. `total` is the hit count after filters and access scope.",
        "parameters": [
          {
            "name": "Version",
            "in": "header",
            "description": "API Version",
            "required": true,
            "schema": {
              "type": "string",
              "enum": [
                "2021-04-15"
              ]
            }
          },
          {
            "name": "locationId",
            "required": false,
            "in": "query",
            "description": "Location id. **Required for `channel: APP`.** Ignored for OAuth/PIT — those use the location on the auth token. Do not send in path, body, or headers.",
            "schema": {
              "example": "ve9EPM428h8b87FE9C12Kg",
              "type": "string",
              "description": "Location id. Required for APP channel (`?locationId=`). Ignored for OAuth/PIT (token location is used). Do not send in path, body, or headers."
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ProjectsSearchTasksBodyDto"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProjectsTaskSearchResponseDto"
                }
              }
            }
          },
          "400": {
            "description": "Bad Request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProjectsErrorResponseDto"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProjectsErrorResponseDto"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden — missing scope or no access to this space, folder, list, or task",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProjectsErrorResponseDto"
                }
              }
            }
          },
          "404": {
            "description": "Not Found — space, folder, list, task, comment, or recurring task missing",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProjectsErrorResponseDto"
                }
              }
            }
          },
          "422": {
            "description": "Unprocessable Entity",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProjectsErrorResponseDto"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProjectsErrorResponseDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "bearer": [
              "projects/tasks.readonly"
            ]
          }
        ]
      }
    }
  },
  "components": {
    "securitySchemes": {
      "bearer": {
        "scheme": "bearer",
        "bearerFormat": "JWT",
        "name": "Authorization",
        "in": "header",
        "description": "Use the Access Token generated with user type as Sub-Account (OR) Private Integration Token of Sub-Account.",
        "type": "http"
      },
      "Location-Access": {
        "scheme": "bearer",
        "bearerFormat": "JWT",
        "name": "Authorization",
        "in": "header",
        "description": "Use the Access Token generated with user type as Sub-Account (OR) Private Integration Token of Sub-Account.",
        "type": "http"
      },
      "Location-Access-Only": {
        "scheme": "bearer",
        "bearerFormat": "JWT",
        "name": "Authorization",
        "in": "header",
        "description": "Use the Access Token generated with user type as Sub-Account.",
        "type": "http"
      },
      "Agency-Access": {
        "scheme": "bearer",
        "bearerFormat": "JWT",
        "name": "Authorization",
        "in": "header",
        "description": "Use the Access Token generated with user type as Agency (OR) Private Integration Token of Agency.",
        "type": "http"
      },
      "Agency-Access-Only": {
        "scheme": "bearer",
        "bearerFormat": "JWT",
        "name": "Authorization",
        "in": "header",
        "description": "Use the Access Token generated with user type as Agency.",
        "type": "http"
      }
    },
    "schemas": {
      "ProjectsSearchTasksBodyDto": {
        "type": "object",
        "properties": {
          "limit": {
            "type": "number",
            "description": "Maximum number of tasks per page",
            "example": 25,
            "minimum": 1,
            "maximum": 100
          },
          "searchAfter": {
            "description": "Opaque searchAfter from the previous response `searchAfter` (base64url-encoded JSON array). Pass the string back verbatim. A legacy decoded JSON array is also accepted.",
            "allOf": [
              {
                "type": "string",
                "description": "Opaque searchAfter (base64url-encoded JSON array, typically `[sortValue, taskId]`). Pass back verbatim as Get Tasks query `searchAfter` or Search Tasks body `searchAfter`.",
                "example": "WzE3Mzg2ODM4MjgzNzIsIjY3YTIzNWI0OWIyODk0MzFiY2Y2NTdmOCJd",
                "title": "ProjectsTaskCursor"
              }
            ],
            "example": "WzE3Mzg2ODM4MjgzNzIsIjY3YTIzNWI0OWIyODk0MzFiY2Y2NTdmOCJd"
          },
          "query": {
            "type": "string",
            "description": "Free-text search across searchable task properties (max 75 characters)",
            "example": "follow up",
            "maxLength": 75
          },
          "filters": {
            "type": "array",
            "description": "Prefer `listIds` to scope a query to lists. Otherwise each item is a Filter (`field`, `operator`, `value`) or a GroupFilter (`group`: `AND` | `OR`, nested `filters`). Operators: `eq`, `not_eq`, `gt`, `gte`, `lt`, `lte`, `contains`, `not_contains`, `contains_set`, `range`, `nested`, `exists`, `not_exists`. Task fields: `status`, `assignees`, `parentTaskId`, `dueDate`, `startDate`, `createdAt`, `updatedAt`, `contactId`, `businessId`, plus custom-field keys. Unknown field or operator is rejected by search (422). Groups may nest. Do not combine `listIds` with a `graph` filter.",
            "example": [
              {
                "group": "AND",
                "filters": [
                  {
                    "field": "status",
                    "operator": "eq",
                    "value": "to_do"
                  }
                ]
              },
              {
                "field": "updatedAt",
                "operator": "gte",
                "value": "2026-09-01T00:00:00.000Z"
              }
            ],
            "items": {
              "oneOf": [
                {
                  "type": "object",
                  "properties": {
                    "field": {
                      "type": "string",
                      "description": "Field to filter. Task properties use their public names (`status`, `dueDate`, `assignees`, …). Record timestamps: `createdAt`, `updatedAt`.",
                      "example": "status"
                    },
                    "operator": {
                      "type": "string",
                      "description": "Comparison operator. `exists` / `not_exists` take no value. List scope uses `nested` on field `graph` (see Search Tasks). Date ranges use `gte`/`lte` or `range`. Allowed: `eq`, `not_eq`, `gt`, `gte`, `lt`, `lte`, `contains`, `not_contains`, `contains_set`, `range`, `nested`, `exists`, `not_exists`.",
                      "enum": [
                        "eq",
                        "not_eq",
                        "gt",
                        "gte",
                        "lt",
                        "lte",
                        "contains",
                        "not_contains",
                        "contains_set",
                        "range",
                        "nested",
                        "exists",
                        "not_exists"
                      ],
                      "example": "eq"
                    },
                    "value": {
                      "description": "Comparison value. Omitted for `exists` / `not_exists`. Arrays for `contains_set`. Nested filters when `operator` is `nested`.",
                      "oneOf": [
                        {
                          "type": "string",
                          "example": "to_do"
                        },
                        {
                          "type": "number",
                          "example": 2
                        },
                        {
                          "type": "boolean",
                          "example": true
                        },
                        {
                          "type": "array",
                          "items": {},
                          "example": [
                            "user_1"
                          ]
                        },
                        {
                          "type": "object",
                          "additionalProperties": {
                            "description": "Value for one custom field. Type depends on the field definition (string, number, boolean, array, or null). Discover keys via the Custom Fields API with `objectKey: \"task\"`.",
                            "oneOf": [
                              {
                                "type": "string",
                                "nullable": true,
                                "example": "discovery"
                              },
                              {
                                "type": "number",
                                "example": 42
                              },
                              {
                                "type": "boolean",
                                "example": true
                              },
                              {
                                "type": "array",
                                "items": {
                                  "type": "string"
                                },
                                "example": [
                                  "option_a"
                                ]
                              }
                            ]
                          },
                          "example": {
                            "gte": "2026-01-01"
                          }
                        }
                      ],
                      "example": "to_do"
                    }
                  },
                  "required": [
                    "field",
                    "operator"
                  ],
                  "title": "ProjectsSearchFilterDto"
                },
                {
                  "type": "object",
                  "properties": {
                    "group": {
                      "type": "string",
                      "description": "How child filters combine. Allowed: `AND`, `OR`. Groups may nest up to 3 levels deep.",
                      "enum": [
                        "AND",
                        "OR"
                      ],
                      "example": "AND"
                    },
                    "filters": {
                      "type": "array",
                      "description": "Child filters or nested groups (max nesting depth 3).",
                      "items": {
                        "type": "object"
                      },
                      "example": []
                    }
                  },
                  "required": [
                    "group",
                    "filters"
                  ],
                  "title": "ProjectsSearchFilterGroupDto"
                }
              ]
            }
          },
          "listIds": {
            "description": "List ids to scope the search (max 10). Equivalent to one nested `graph` filter (`type=list`, `id` eq or `contains_set`). More than 10 ids, a non-list target, or a second graph scope returns **422** (`error`: `graph_scope_invalid`).",
            "example": [
              "6a58be26653cd983b7d3d437"
            ],
            "maxItems": 10,
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "sort": {
            "description": "Sort order applied before pagination",
            "example": [
              {
                "field": "dueDate",
                "direction": "asc"
              }
            ],
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "field": {
                  "type": "string",
                  "description": "Field to sort by. Allowed: `dueDate`, `startDate`, `createdAt`, `updatedAt`. These tie-break safely with the `[sortValue, taskId]` searchAfter tuple.",
                  "enum": [
                    "dueDate",
                    "startDate",
                    "createdAt",
                    "updatedAt"
                  ],
                  "example": "updatedAt"
                },
                "direction": {
                  "type": "string",
                  "description": "Sort direction. Allowed: `asc`, `desc`. Defaults to `asc`.",
                  "enum": [
                    "asc",
                    "desc"
                  ],
                  "example": "asc",
                  "default": "asc"
                }
              },
              "required": [
                "field"
              ],
              "title": "ProjectsSearchTasksSortDto"
            }
          },
          "subtaskViewMode": {
            "type": "string",
            "description": "How subtasks appear. Allowed: `collapsed` (parents only), `expanded` (parents with embedded `subtasks[]`), `separate` (subtasks as their own records with `parentTaskId` / `parentName`). Requires a Tasks V2 / Kanban location. On any other location this field, or a `parentTaskId` filter, returns **422**. `parentName` and `subtasks` are search-only — Get Task By ID, Get Tasks, and Fetch Tasks By IDs do not populate them. `total` is the hit count after filters and access scope (post-RBAC). Page with `searchAfter` until it is null.",
            "enum": [
              "collapsed",
              "expanded",
              "separate"
            ],
            "example": "collapsed"
          }
        },
        "required": [
          "limit"
        ],
        "title": "ProjectsSearchTasksBodyDto"
      },
      "ProjectsTaskSearchResponseDto": {
        "type": "object",
        "description": "Task search / list-tasks results. `searchAfter` is an opaque base64url string when more pages exist. Pass it back verbatim as Search Tasks body `searchAfter` or Get Tasks query `searchAfter`.",
        "required": [
          "tasks",
          "total"
        ],
        "properties": {
          "tasks": {
            "type": "array",
            "description": "Matching tasks",
            "items": {
              "type": "object",
              "description": "Public task record. Assignees are `assignees` (never CO `owners`). Priority is `properties.priority` 1–4 (never `priorityN`). Location custom-field values appear as extra keys under `properties`. `graph` and `listPositions` are not returned — use Get Lists For A Task and `properties.primaryListId` for membership.",
              "required": [
                "id",
                "properties"
              ],
              "properties": {
                "id": {
                  "type": "string",
                  "description": "Task id",
                  "example": "6a102435124ecfb348bd5509"
                },
                "locationId": {
                  "type": "string",
                  "description": "Location id",
                  "example": "ve9EPM428h8b87FE9C12Kg"
                },
                "objectKey": {
                  "type": "string",
                  "description": "Always `task` for Project Management tasks when present. Optional for forward compatibility. Allowed: `task`.",
                  "enum": [
                    "task"
                  ],
                  "example": "task"
                },
                "assignees": {
                  "type": "array",
                  "description": "Assignee user ids (same values accepted on create/update as `assignees`)",
                  "items": {
                    "type": "string"
                  },
                  "example": [
                    "user_1"
                  ]
                },
                "parentName": {
                  "type": "string",
                  "description": "Parent task title. Populated only by Search Tasks with `subtaskViewMode=separate`. Not returned by Get Task By ID, Get Tasks, or Fetch Tasks By IDs.",
                  "example": "Parent task"
                },
                "createdAt": {
                  "type": "string",
                  "description": "When the task was created (ISO-8601)",
                  "example": "2026-09-20T10:00:00.000Z"
                },
                "updatedAt": {
                  "type": "string",
                  "description": "When the task was last updated (ISO-8601). Use as a Search filter (`gte`) and sort field for incremental sync.",
                  "example": "2026-09-21T12:00:00.000Z"
                },
                "createdBy": {
                  "type": "object",
                  "description": "Who created the task",
                  "properties": {
                    "sourceId": {
                      "type": "string",
                      "description": "User or resource id",
                      "example": "user_1"
                    },
                    "source": {
                      "type": "string",
                      "description": "Creation source. Common values: `PUBLIC_API`, `USER`.",
                      "example": "PUBLIC_API"
                    },
                    "channel": {
                      "type": "string",
                      "description": "Creation channel. Common values: `OAUTH`, `APP`, `IST`.",
                      "example": "OAUTH"
                    },
                    "createdAt": {
                      "type": "string",
                      "description": "Stamp time (ISO-8601)",
                      "example": "2026-09-20T10:00:00.000Z"
                    }
                  },
                  "example": {
                    "sourceId": "user_1",
                    "source": "PUBLIC_API",
                    "channel": "OAUTH",
                    "createdAt": "2026-09-20T10:00:00.000Z"
                  }
                },
                "subtasks": {
                  "type": "array",
                  "description": "Embedded child tasks — **Search Tasks only**, when `subtaskViewMode=expanded`. Never returned by Get Task, Create Task, Update Task, Get Tasks (list), or Fetch Tasks By IDs.",
                  "items": "circular(ProjectsTaskRecordDto)",
                  "example": [
                    {
                      "id": "6a102435124ecfb348bd5510",
                      "locationId": "ve9EPM428h8b87FE9C12Kg",
                      "objectKey": "task",
                      "assignees": [
                        "user_1"
                      ],
                      "properties": {
                        "title": "Call notes",
                        "status": "to_do",
                        "dueDate": "2026-09-20T17:00:00.000Z",
                        "priority": 3,
                        "primaryListId": "6a102435124ecfb348bd5507",
                        "parentTaskId": "6a102435124ecfb348bd5509"
                      }
                    }
                  ]
                },
                "properties": {
                  "type": "object",
                  "description": "Task fields plus location custom-field values as extra keys (no `task.` prefix). Reserved keys, do not use these names for custom fields: `title`, `body`, `status`, `statusGroup`, `dueDate`, `startDate`, `priority`, `primaryListId`, `parentTaskId`, `contactId`, `businessId`. `statusGroup` is read-only.",
                  "required": [
                    "title"
                  ],
                  "properties": {
                    "title": {
                      "type": "string",
                      "description": "Task title",
                      "example": "Follow up with client"
                    },
                    "body": {
                      "type": "string",
                      "description": "Task body as TipTap HTML or TipTap JSON (same field as comment `body`). See [TipTap documentation](https://tiptap.dev/docs/editor/introduction).",
                      "example": "<p>Call the client about renewal</p>"
                    },
                    "status": {
                      "type": "string",
                      "description": "Status **key** from the space workflow (not the label). Location-defined — discover via Get Statuses or Get List Statuses.",
                      "example": "to_do"
                    },
                    "statusGroup": {
                      "type": "string",
                      "description": "Server-derived group key for `status`. Read-only — do not send on create or update. A task is complete when this is `done`.",
                      "example": "to_do"
                    },
                    "dueDate": {
                      "type": "string",
                      "description": "Due date (ISO-8601)",
                      "example": "2026-09-20T17:00:00.000Z"
                    },
                    "startDate": {
                      "type": "string",
                      "description": "Start date (ISO-8601)",
                      "example": "2026-09-20T10:00:00.000Z"
                    },
                    "priority": {
                      "type": "number",
                      "description": "Priority level. Allowed: `1` (highest), `2`, `3`, `4` (lowest).",
                      "enum": [
                        1,
                        2,
                        3,
                        4
                      ],
                      "example": 2
                    },
                    "primaryListId": {
                      "type": "string",
                      "description": "Home list id",
                      "example": "6a102435124ecfb348bd5507"
                    },
                    "parentTaskId": {
                      "type": "string",
                      "description": "Parent task id when this task is a subtask. This is the field to read.",
                      "example": "6a102435124ecfb348bd5508"
                    },
                    "contactId": {
                      "type": "string",
                      "description": "Linked contact id",
                      "example": "sx6wyHhbFdRXh302Lunr"
                    },
                    "businessId": {
                      "type": "string",
                      "description": "Linked business id",
                      "example": "biz_1"
                    }
                  },
                  "additionalProperties": {
                    "description": "Value for one custom field. Type depends on the field definition (string, number, boolean, array, or null). Discover keys via the Custom Fields API with `objectKey: \"task\"`.",
                    "oneOf": [
                      {
                        "type": "string",
                        "nullable": true,
                        "example": "discovery"
                      },
                      {
                        "type": "number",
                        "example": 42
                      },
                      {
                        "type": "boolean",
                        "example": true
                      },
                      {
                        "type": "array",
                        "items": {
                          "type": "string"
                        },
                        "example": [
                          "option_a"
                        ]
                      }
                    ]
                  },
                  "example": {
                    "title": "Follow up with client",
                    "status": "to_do",
                    "dueDate": "2026-09-20T17:00:00.000Z",
                    "priority": 2,
                    "primaryListId": "6a102435124ecfb348bd5507",
                    "project_phase": "discovery"
                  }
                }
              },
              "title": "ProjectsTaskRecordDto"
            },
            "example": [
              {
                "id": "6a102435124ecfb348bd5509",
                "locationId": "ve9EPM428h8b87FE9C12Kg",
                "objectKey": "task",
                "assignees": [
                  "user_1"
                ],
                "properties": {
                  "title": "Follow up with client",
                  "status": "to_do",
                  "dueDate": "2026-09-20T17:00:00.000Z",
                  "priority": 2,
                  "primaryListId": "6a102435124ecfb348bd5507"
                }
              }
            ]
          },
          "total": {
            "type": "number",
            "description": "Total matching count",
            "example": 1
          },
          "searchAfter": {
            "type": "string",
            "nullable": true,
            "description": "Opaque searchAfter (base64url-encoded JSON array, typically `[sortValue, taskId]`). Pass back verbatim as Search Tasks body `searchAfter` or Get Tasks query `searchAfter`. `null` when there is no further page.",
            "example": "WzE3Mzg2ODM4MjgzNzIsIjY3YTIzNWI0OWIyODk0MzFiY2Y2NTdmOCJd"
          }
        },
        "title": "ProjectsTaskSearchResponseDto"
      },
      "ProjectsErrorResponseDto": {
        "type": "object",
        "description": "Error payload for non-2xx responses. Same shape on every Projects operation.\n\n`message` is a string, or a string array for validation failures.\n\n`error` is usually the HTTP reason phrase (`Bad Request`, `Unprocessable Entity`, …). Known domain values include `graph_scope_invalid` (Search list-scope failures).\n\nWhen `error` is `graph_scope_invalid`, `reason` discriminates the failure: `too_many_ids` | `non_list_type` | `duplicate_graph_scope`.",
        "required": [
          "statusCode",
          "message"
        ],
        "properties": {
          "statusCode": {
            "type": "number",
            "description": "HTTP status code",
            "example": 422
          },
          "message": {
            "description": "Human-readable message, or a list of validation messages",
            "oneOf": [
              {
                "type": "string",
                "example": "Task is already in the destination list"
              },
              {
                "type": "array",
                "items": {
                  "type": "string"
                },
                "example": [
                  "dueDate must be a string"
                ]
              }
            ],
            "example": null
          },
          "error": {
            "type": "string",
            "description": "HTTP reason phrase or domain code when present. Domain codes seen today: `graph_scope_invalid`. Otherwise Nest’s reason phrase.",
            "example": "graph_scope_invalid"
          },
          "reason": {
            "type": "string",
            "description": "Present when `error` is `graph_scope_invalid`. Discriminates Search list-scope failures. Allowed: `too_many_ids`, `non_list_type`, `duplicate_graph_scope`.",
            "enum": [
              "too_many_ids",
              "non_list_type",
              "duplicate_graph_scope"
            ],
            "example": "too_many_ids"
          }
        },
        "example": {
          "statusCode": 422,
          "message": "graph.id scope may not exceed 10 list IDs",
          "error": "graph_scope_invalid",
          "reason": "too_many_ids"
        },
        "title": "ProjectsErrorResponseDto"
      }
    }
  }
}
```

## Code Examples

**cURL**

```bash
curl -L -X POST 'https://services.leadconnectorhq.com/projects/tasks/search' \
  -H 'Authorization: Bearer <TOKEN>' \
  -H 'Version: 2021-04-15' \
  -H 'Content-Type: application/json' \
  --data-raw '{
  "limit": 25,
  "searchAfter": "WzE3Mzg2ODM4MjgzNzIsIjY3YTIzNWI0OWIyODk0MzFiY2Y2NTdmOCJd",
  "query": "follow up",
  "filters": [
    {
      "group": "AND",
      "filters": [
        {
          "field": "status",
          "operator": "eq",
          "value": "to_do"
        }
      ]
    },
    {
      "field": "updatedAt",
      "operator": "gte",
      "value": "2026-09-01T00:00:00.000Z"
    }
  ],
  "listIds": [
    "6a58be26653cd983b7d3d437"
  ],
  "sort": [
    {
      "field": "dueDate",
      "direction": "asc"
    }
  ],
  "subtaskViewMode": "collapsed"
}'
```

**Node.js**

```javascript
const options = {
  method: 'POST',
  headers: {
    Authorization: 'Bearer <TOKEN>',
    Version: '2021-04-15',
    'Content-Type': 'application/json'
  },
  body: JSON.stringify({
      "limit": 25,
      "searchAfter": "WzE3Mzg2ODM4MjgzNzIsIjY3YTIzNWI0OWIyODk0MzFiY2Y2NTdmOCJd",
      "query": "follow up",
      "filters": [
        {
          "group": "AND",
          "filters": [
            {
              "field": "status",
              "operator": "eq",
              "value": "to_do"
            }
          ]
        },
        {
          "field": "updatedAt",
          "operator": "gte",
          "value": "2026-09-01T00:00:00.000Z"
        }
      ],
      "listIds": [
        "6a58be26653cd983b7d3d437"
      ],
      "sort": [
        {
          "field": "dueDate",
          "direction": "asc"
        }
      ],
      "subtaskViewMode": "collapsed"
  })
};

try {
  const response = await fetch('https://services.leadconnectorhq.com/projects/tasks/search', options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

**Python**

```python
import requests

url = "https://services.leadconnectorhq.com/projects/tasks/search"

headers = {
    "Authorization": "Bearer <TOKEN>",
    "Version": "2021-04-15"
}

payload = {
    "limit": 25,
    "searchAfter": "WzE3Mzg2ODM4MjgzNzIsIjY3YTIzNWI0OWIyODk0MzFiY2Y2NTdmOCJd",
    "query": "follow up",
    "filters": [
        {
            "group": "AND",
            "filters": [
                {
                    "field": "status",
                    "operator": "eq",
                    "value": "to_do"
                }
            ]
        },
        {
            "field": "updatedAt",
            "operator": "gte",
            "value": "2026-09-01T00:00:00.000Z"
        }
    ],
    "listIds": [
        "6a58be26653cd983b7d3d437"
    ],
    "sort": [
        {
            "field": "dueDate",
            "direction": "asc"
        }
    ],
    "subtaskViewMode": "collapsed"
}

response = requests.post(url, json=payload, headers=headers)
print(response.json())
```

**PHP**

```php
<?php
$curl = curl_init();

curl_setopt_array($curl, [
  CURLOPT_URL => 'https://services.leadconnectorhq.com/projects/tasks/search',
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_CUSTOMREQUEST => 'POST',
  CURLOPT_HTTPHEADER => [
    'Authorization: Bearer <TOKEN>',
    'Version: 2021-04-15',
    'Content-Type: application/json',
  ],
  CURLOPT_POSTFIELDS => '{
  "limit": 25,
  "searchAfter": "WzE3Mzg2ODM4MjgzNzIsIjY3YTIzNWI0OWIyODk0MzFiY2Y2NTdmOCJd",
  "query": "follow up",
  "filters": [
    {
      "group": "AND",
      "filters": [
        {
          "field": "status",
          "operator": "eq",
          "value": "to_do"
        }
      ]
    },
    {
      "field": "updatedAt",
      "operator": "gte",
      "value": "2026-09-01T00:00:00.000Z"
    }
  ],
  "listIds": [
    "6a58be26653cd983b7d3d437"
  ],
  "sort": [
    {
      "field": "dueDate",
      "direction": "asc"
    }
  ],
  "subtaskViewMode": "collapsed"
}',
]);

$response = curl_exec($curl);
curl_close($curl);
echo $response;
```

**Java**

```java
HttpResponse<String> response = Unirest
  .post("https://services.leadconnectorhq.com/projects/tasks/search")
  .header("Authorization", "Bearer <TOKEN>")
  .header("Version", "2021-04-15")
  .header("Content-Type", "application/json")
  .body("{\"limit\":25,\"searchAfter\":\"WzE3Mzg2ODM4MjgzNzIsIjY3YTIzNWI0OWIyODk0MzFiY2Y2NTdmOCJd\",\"query\":\"follow up\",\"filters\":[{\"group\":\"AND\",\"filters\":[{\"field\":\"status\",\"operator\":\"eq\",\"value\":\"to_do\"}]},{\"field\":\"updatedAt\",\"operator\":\"gte\",\"value\":\"2026-09-01T00:00:00.000Z\"}],\"listIds\":[\"6a58be26653cd983b7d3d437\"],\"sort\":[{\"field\":\"dueDate\",\"direction\":\"asc\"}],\"subtaskViewMode\":\"collapsed\"}")
  .asString();
```

**Go**

```go
package main

import (
  "fmt"
  "net/http"
  "io"
  "strings"
)

func main() {
  url := "https://services.leadconnectorhq.com/projects/tasks/search"
  payload := strings.NewReader(`{
  "limit": 25,
  "searchAfter": "WzE3Mzg2ODM4MjgzNzIsIjY3YTIzNWI0OWIyODk0MzFiY2Y2NTdmOCJd",
  "query": "follow up",
  "filters": [
    {
      "group": "AND",
      "filters": [
        {
          "field": "status",
          "operator": "eq",
          "value": "to_do"
        }
      ]
    },
    {
      "field": "updatedAt",
      "operator": "gte",
      "value": "2026-09-01T00:00:00.000Z"
    }
  ],
  "listIds": [
    "6a58be26653cd983b7d3d437"
  ],
  "sort": [
    {
      "field": "dueDate",
      "direction": "asc"
    }
  ],
  "subtaskViewMode": "collapsed"
}`)
  req, _ := http.NewRequest("POST", url, payload)
  req.Header.Add("Authorization", "Bearer <TOKEN>")
  req.Header.Add("Version", "2021-04-15")

  res, _ := http.DefaultClient.Do(req)
  defer res.Body.Close()
  body, _ := io.ReadAll(res.Body)
  fmt.Println(string(body))
}
```

**Ruby**

```ruby
require 'uri'
require 'net/http'

url = URI("https://services.leadconnectorhq.com/projects/tasks/search")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["Authorization"] = "Bearer <TOKEN>"
request["Version"] = "2021-04-15"
request["Content-Type"] = "application/json"
request.body = '{
  "limit": 25,
  "searchAfter": "WzE3Mzg2ODM4MjgzNzIsIjY3YTIzNWI0OWIyODk0MzFiY2Y2NTdmOCJd",
  "query": "follow up",
  "filters": [
    {
      "group": "AND",
      "filters": [
        {
          "field": "status",
          "operator": "eq",
          "value": "to_do"
        }
      ]
    },
    {
      "field": "updatedAt",
      "operator": "gte",
      "value": "2026-09-01T00:00:00.000Z"
    }
  ],
  "listIds": [
    "6a58be26653cd983b7d3d437"
  ],
  "sort": [
    {
      "field": "dueDate",
      "direction": "asc"
    }
  ],
  "subtaskViewMode": "collapsed"
}'

response = http.request(request)
puts response.read_body
```

**PowerShell**

```powershell
$headers = @{
  "Authorization" = "Bearer <TOKEN>"
  "Version" = "2021-04-15"
}

$body = '{
  "limit": 25,
  "searchAfter": "WzE3Mzg2ODM4MjgzNzIsIjY3YTIzNWI0OWIyODk0MzFiY2Y2NTdmOCJd",
  "query": "follow up",
  "filters": [
    {
      "group": "AND",
      "filters": [
        {
          "field": "status",
          "operator": "eq",
          "value": "to_do"
        }
      ]
    },
    {
      "field": "updatedAt",
      "operator": "gte",
      "value": "2026-09-01T00:00:00.000Z"
    }
  ],
  "listIds": [
    "6a58be26653cd983b7d3d437"
  ],
  "sort": [
    {
      "field": "dueDate",
      "direction": "asc"
    }
  ],
  "subtaskViewMode": "collapsed"
}'

$response = Invoke-RestMethod -Uri 'https://services.leadconnectorhq.com/projects/tasks/search' -Method 'POST' -Headers $headers -Body $body -ContentType 'application/json'
$response | ConvertTo-Json
```
