# Search Opportunities

POST https://services.leadconnectorhq.com/opportunities/search

Search Opportunities based on combinations of advanced filters, with sorting and pagination. Send `filters` (each with `field`, `operator` and `value`, or a `group` of `AND`/`OR` filters) and `sort` (`field` and `direction`); the request body fields below list every supported filter field, operator and sort field, with examples. `page` starts at 1 (0 is treated as 1) and works with `limit`; `page * limit` cannot exceed 10,000, so use `searchAfter` without `page` to read further.

⚠️ Because of the advanced filtering, changes can take a few seconds to appear in the search results.

## Authentication

Send `Authorization: Bearer <token>` using:

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

## Parameters

### Header Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `Version` | string | Yes | API Version. Send `v3`. |

## OpenAPI Specification

```json
{
  "openapi": "3.0.0",
  "info": {
    "title": "LeadConnector API",
    "version": "v3"
  },
  "servers": [
    {
      "url": "https://services.leadconnectorhq.com"
    }
  ],
  "paths": {
    "/opportunities/search": {
      "post": {
        "summary": "Search Opportunities",
        "operationId": "searchOpportunities",
        "description": "Search Opportunities based on combinations of advanced filters, with sorting and pagination. Send `filters` (each with `field`, `operator` and `value`, or a `group` of `AND`/`OR` filters) and `sort` (`field` and `direction`); the request body fields below list every supported filter field, operator and sort field, with examples. `page` starts at 1 (0 is treated as 1) and works with `limit`; `page * limit` cannot exceed 10,000, so use `searchAfter` without `page` to read further.\n\n⚠️ Because of the advanced filtering, changes can take a few seconds to appear in the search results.",
        "parameters": [
          {
            "name": "Version",
            "in": "header",
            "description": "API Version. Send `v3`.",
            "required": true,
            "schema": {
              "type": "string",
              "enum": [
                "v3"
              ]
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/OpportunitySearchBodyDTO"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Not returned: the API answers 201. Kept so clients generated from earlier docs keep working.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PostSearchSuccessfulResponseDto"
                }
              }
            }
          },
          "201": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PostSearchSuccessfulResponseDto"
                }
              }
            }
          },
          "400": {
            "description": "Bad Request. Unexpected errors inside the handler can also be returned as 400 with a `traceId`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BadRequestDTO"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UnauthorizedDTO"
                }
              }
            }
          },
          "422": {
            "description": "Unprocessable Entity",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UnprocessableDTO"
                }
              }
            }
          },
          "429": {
            "description": "Too Many Requests: the rate limit for this app and location was exceeded. Retry after the burst window (`X-RateLimit-Interval-Milliseconds`) when `X-RateLimit-Remaining` is 0 or less, or after 00:00 UTC when `X-RateLimit-Daily-Remaining` is 0 or less.",
            "headers": {
              "X-RateLimit-Max": {
                "description": "Requests allowed in the burst window",
                "schema": {
                  "type": "integer",
                  "example": 100
                }
              },
              "X-RateLimit-Remaining": {
                "description": "Requests left in the current burst window; when 0 or less, retry after the window resets",
                "schema": {
                  "type": "integer",
                  "example": 0
                }
              },
              "X-RateLimit-Interval-Milliseconds": {
                "description": "Length of the burst window in milliseconds; wait this long before retrying a burst-limited request",
                "schema": {
                  "type": "integer",
                  "example": 10000
                }
              },
              "X-RateLimit-Limit-Daily": {
                "description": "Requests allowed per UTC calendar day; the count resets at 00:00 UTC",
                "schema": {
                  "type": "integer",
                  "example": 200000
                }
              },
              "X-RateLimit-Daily-Remaining": {
                "description": "Requests left today (UTC); when 0 or less, retry after 00:00 UTC",
                "schema": {
                  "type": "integer",
                  "example": 0
                }
              },
              "X-RateLimit-Daily-Reset": {
                "description": "Milliseconds until the current daily window ends and X-RateLimit-Daily-Remaining returns to the full X-RateLimit-Limit-Daily. A duration, not a timestamp: add it to the time the response was received to get the reset time. One-second precision, so always a multiple of 1000. When no daily window is running yet, reports the full window, 86400000 (24 hours), and the window starts with that request",
                "schema": {
                  "type": "integer",
                  "example": 86400000
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TooManyRequestsDTO"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/InternalServerErrorDTO"
                }
              }
            }
          },
          "default": {
            "description": "Unexpected error"
          }
        },
        "security": [
          {
            "bearer": [
              "opportunities.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": {
      "OpportunitySearchBodyDTO": {
        "type": "object",
        "properties": {
          "locationId": {
            "type": "string",
            "description": "Location ID in which the search needs to be performed",
            "example": "i2SpAtBVHSVea1sL6oah"
          },
          "query": {
            "type": "string",
            "description": "Text to search for within your opportunities. It is matched against the opportunity fields marked searchable in the location's settings. Maximum 75 characters.",
            "maxLength": 75,
            "example": "john@example.com"
          },
          "limit": {
            "type": "number",
            "description": "Number of opportunities per page. Minimum 1, maximum 500.",
            "minimum": 1,
            "maximum": 500,
            "example": 20
          },
          "page": {
            "type": "number",
            "description": "Page number for standard pagination, starting at 1 (0 is treated as 1).\n- Standard pagination returns up to **10,000** records in total: `page × limit` must not exceed 10,000. For example, `page: 20` with `limit: 500` returns the last set.\n- To go past 10,000 records, use `searchAfter`.\n- ⚠️ When you use `searchAfter`, do not send `page`: it is ignored for the results but still counts toward the 10,000 limit.",
            "minimum": 0,
            "example": 1
          },
          "searchAfter": {
            "type": "array",
            "description": "Use this to get the next page of results (cursor-based pagination).\n\n• Copy the `sort` value from the last opportunity in the previous response and send it here unchanged. Its values can be numbers or strings.\n\n• You need it to go past the first **10,000** opportunities.\n\n• Do not send `page` with it.\n\n• To start from the first page, leave it out or send an empty list (`[]`).\n\n• If the response has no opportunities, you have reached the end.",
            "items": {
              "oneOf": [
                {
                  "type": "string"
                },
                {
                  "type": "number"
                }
              ]
            },
            "example": [
              1625203104328,
              "yWQobCRIhRguQtD2llvk"
            ]
          },
          "filters": {
            "type": "array",
            "description": "Filters, or groups of filters, to narrow the results. Each filter has three parts:\n1. **Field**: the opportunity attribute the filter applies to, e.g. `status`.\n2. **Operator**: the comparison to run on the field, e.g. `eq` or `range`.\n3. **Value**: the value the field is compared with; a string, number or other type that fits the field.\n\n- Each item is either a **filter** (`field`, `operator`, `value`) or a **group** (`group`: `AND` / `OR`, with nested `filters`). Groups can be nested.\n- ⚠️ By default every filter in the `filters` array is combined with **AND**.\n- Results can take a few seconds to reflect recent changes.\n\nExample: open opportunities worth 1,000 to 5,000, assigned to a user or with a source set\n\n```json\n[\n  {\n    \"group\": \"AND\",\n    \"filters\": [\n      {\n        \"field\": \"status\",\n        \"operator\": \"eq\",\n        \"value\": \"open\"\n      },\n      {\n        \"field\": \"monetary_value\",\n        \"operator\": \"range\",\n        \"value\": {\n          \"gte\": 1000,\n          \"lte\": 5000\n        }\n      }\n    ]\n  },\n  {\n    \"group\": \"OR\",\n    \"filters\": [\n      {\n        \"field\": \"assigned_to\",\n        \"operator\": \"eq\",\n        \"value\": \"082goXVW3lIExEQPOnd3\"\n      },\n      {\n        \"field\": \"source\",\n        \"operator\": \"exists\"\n      }\n    ]\n  }\n]\n```\n\n**Opportunities changed since a time** (incremental sync): filter `date_updated` with `range` and `gte` set to the time of your last sync, sort by `date_updated` `asc`, and page with `searchAfter`. Start each sync a little before the previous one ended, so changes still being indexed are not missed. Deleted opportunities are not returned.",
            "items": {
              "type": "object",
              "properties": {
                "field": {
                  "type": "string",
                  "description": "Field to filter on (filter item). Use the field names below exactly as written (snake_case). The supported fields, grouped as in the Opportunities Search API reference, with the operators each one supports:\n\n### Opportunity Information\n\n| Display name | Field name | Supported operators | Example |\n| --- | --- | --- | --- |\n| Opportunity ID | `id` | `eq`, `not_eq` | `{ \"field\": \"id\", \"operator\": \"eq\", \"value\": \"{opportunityId}\" }` |\n| Opportunity Name | `name` | `eq`, `not_eq`, `contains`, `not_contains`, `exists`, `not_exists` | `{ \"field\": \"name\", \"operator\": \"contains\", \"value\": \"renewal\" }` |\n| Monetary Value | `monetary_value` | `eq`, `not_eq`, `range`, `exists`, `not_exists` | `{ \"field\": \"monetary_value\", \"operator\": \"range\", \"value\": { \"gte\": 1000, \"lte\": 5000 } }` |\n| Pipeline ID | `pipeline_id` | `eq`, `not_eq`, `exists`, `not_exists` | `{ \"field\": \"pipeline_id\", \"operator\": \"eq\", \"value\": \"{pipelineId}\" }` |\n| Pipeline Stage ID | `pipeline_stage_id` | `eq`, `not_eq`, `exists`, `not_exists` | `{ \"field\": \"pipeline_stage_id\", \"operator\": \"eq\", \"value\": \"{pipelineStageId}\" }` |\n| Status<br>`open`, `won`, `lost` or `abandoned` | `status` | `eq`, `not_eq`, `exists`, `not_exists` | `{ \"field\": \"status\", \"operator\": \"eq\", \"value\": \"open\" }` |\n| Lost Reason ID | `lost_reason_id` | `eq`, `not_eq`, `exists`, `not_exists` | `{ \"field\": \"lost_reason_id\", \"operator\": \"eq\", \"value\": \"{lostReasonId}\" }` |\n| Source | `source` | `eq`, `not_eq`, `exists`, `not_exists` | `{ \"field\": \"source\", \"operator\": \"eq\", \"value\": \"Website\" }` |\n| Assigned To | `assigned_to` | `eq`, `not_eq`, `exists`, `not_exists` | `{ \"field\": \"assigned_to\", \"operator\": \"eq\", \"value\": \"{userId}\" }` |\n| Followers | `followers` | `eq`, `not_eq`, `contains`, `not_contains`, `exists`, `not_exists` | `{ \"field\": \"followers\", \"operator\": \"eq\", \"value\": \"{userId}\" }` |\n\n### Contact Information\n\n| Display name | Field name | Supported operators | Example |\n| --- | --- | --- | --- |\n| Contact ID | `contact_id` | `eq`, `not_eq`, `exists`, `not_exists` | `{ \"field\": \"contact_id\", \"operator\": \"eq\", \"value\": \"{contactId}\" }` |\n| Contact Name | `contact_name` | `eq`, `not_eq`, `contains`, `not_contains`, `exists`, `not_exists` | `{ \"field\": \"contact_name\", \"operator\": \"contains\", \"value\": \"john\" }` |\n| Company Name | `company_name` | `eq`, `not_eq`, `contains`, `not_contains`, `exists`, `not_exists` | `{ \"field\": \"company_name\", \"operator\": \"eq\", \"value\": \"Tesla Inc\" }` |\n| Email | `email` | `eq`, `not_eq`, `contains`, `not_contains`, `exists`, `not_exists` | `{ \"field\": \"email\", \"operator\": \"eq\", \"value\": \"john@example.com\" }` |\n| Phone<br>Pass the country code, e.g. `+12025550107` | `phone` | `eq`, `not_eq`, `contains`, `not_contains`, `exists`, `not_exists` | `{ \"field\": \"phone\", \"operator\": \"eq\", \"value\": \"+12025550107\" }` |\n\n### Date Fields\n\n| Display name | Field name | Supported operators | Example |\n| --- | --- | --- | --- |\n| Date Added | `date_added` | `range`, `exists`, `not_exists` | `{ \"field\": \"date_added\", \"operator\": \"range\", \"value\": { \"gte\": \"2026-01-01T00:00:00Z\", \"lte\": \"2026-06-30T23:59:59Z\" } }` |\n| Date Updated | `date_updated` | `range`, `exists`, `not_exists` | `{ \"field\": \"date_updated\", \"operator\": \"range\", \"value\": { \"gte\": \"2026-11-01T00:00:00Z\" } }` |\n| Last Status Change Date | `last_status_change_date` | `range`, `exists`, `not_exists` | `{ \"field\": \"last_status_change_date\", \"operator\": \"range\", \"value\": { \"gte\": \"2026-01-01T00:00:00Z\", \"lte\": \"2026-06-30T23:59:59Z\" } }` |\n| Last Stage Change Date | `last_stage_change_date` | `range`, `exists`, `not_exists` | `{ \"field\": \"last_stage_change_date\", \"operator\": \"exists\" }` |\n\n### Custom Fields\n\n| Display name | Field name | Supported operators | Example |\n| --- | --- | --- | --- |\n| TEXT, LARGE_TEXT, SINGLE_OPTIONS, RADIO, PHONE | `custom_fields.{customFieldId}` | `eq`, `not_eq`, `contains`, `not_contains`, `exists`, `not_exists` | `{ \"field\": \"custom_fields.{customFieldId}\", \"operator\": \"contains\", \"value\": \"gold\" }` |\n| CHECKBOX, MULTIPLE_OPTIONS | `custom_fields.{customFieldId}` | `eq`, `not_eq`, `exists`, `not_exists` | `{ \"field\": \"custom_fields.{customFieldId}\", \"operator\": \"eq\", \"value\": [ \"Option A\", \"Option B\" ] }` |\n| NUMERICAL, MONETORY | `custom_fields.{customFieldId}` | `eq`, `not_eq`, `range`, `exists`, `not_exists` | `{ \"field\": \"custom_fields.{customFieldId}\", \"operator\": \"range\", \"value\": { \"gte\": 100, \"lte\": 500 } }` |\n| DATE | `custom_fields.{customFieldId}` | `range`, `exists`, `not_exists` | `{ \"field\": \"custom_fields.{customFieldId}\", \"operator\": \"range\", \"value\": { \"gte\": \"2026-01-01\", \"lte\": \"2026-12-31\" } }` |\n| TEXTBOX_LIST | `custom_fields.{customFieldId}.{optionId}` | `eq`, `not_eq`, `contains`, `not_contains`, `exists`, `not_exists` | `{ \"field\": \"custom_fields.{customFieldId}.{optionId}\", \"operator\": \"eq\", \"value\": \"Line one\" }` |\n\n- Custom field: `custom_fields.{customFieldId}`, e.g. `custom_fields.OBj007JIEmLP0IEHdV1l`.\n- TEXTBOX_LIST: add the option id, `custom_fields.{customFieldId}.{optionId}`, e.g. `custom_fields.OBj007JIEmLP0IEHdV1l.c1b70ec9-664f-400f-a3fc-6f7912c5e310`.\n- CHECKBOX / MULTIPLE_OPTIONS: `value` is an option, or an array of options to match any of them.",
                  "example": "status"
                },
                "operator": {
                  "type": "string",
                  "description": "Operator to apply (filter item). Each field supports only some operators; see the supported operators of each field.\n\n#### `eq`: Equals\n\n- **Value type:** Number, String, Boolean\n- **Character limit:** None\n\nExample\n\n```json\n{\n  \"field\": \"status\",\n  \"operator\": \"eq\",\n  \"value\": \"open\"\n}\n```\n\n#### `not_eq`: Not Equals\n\n- **Value type:** Number, String, Boolean\n- **Character limit:** None\n\nExample\n\n```json\n{\n  \"field\": \"status\",\n  \"operator\": \"not_eq\",\n  \"value\": \"lost\"\n}\n```\n\n#### `contains`: Contains\n\n- **Value type:** String\n- **Character limit:** At least 3 characters\n- ⚠️ The `contains` operator does not support special characters.\n\nExample\n\n```json\n{\n  \"field\": \"name\",\n  \"operator\": \"contains\",\n  \"value\": \"renewal\"\n}\n```\n\n#### `not_contains`: Not Contains\n\n- **Value type:** String\n- **Character limit:** At least 3 characters\n- ⚠️ The `not_contains` operator does not support special characters.\n\nExample\n\n```json\n{\n  \"field\": \"company_name\",\n  \"operator\": \"not_contains\",\n  \"value\": \"test\"\n}\n```\n\n#### `exists`: Exists (has a value)\n\n- **Value type:** Undefined\n- **Character limit:** None\n- ⚠️ **Do not pass any `value`**; `field` and `operator` are enough.\n\nExample\n\n```json\n{\n  \"field\": \"source\",\n  \"operator\": \"exists\"\n}\n```\n\n#### `not_exists`: Does not exist (no value)\n\n- **Value type:** Undefined\n- **Character limit:** None\n- ⚠️ **Do not pass any `value`**; `field` and `operator` are enough.\n\nExample\n\n```json\n{\n  \"field\": \"assigned_to\",\n  \"operator\": \"not_exists\"\n}\n```\n\n#### `range`: Range\n\n- **Value type:** An object with `gte` / `lte` (or `gt` / `lt`) bounds: numbers for number fields, ISO 8601 dates or epoch milliseconds for date fields\n- **Character limit:** None\n\nExample\n\n```json\n{\n  \"field\": \"monetary_value\",\n  \"operator\": \"range\",\n  \"value\": {\n    \"gte\": 1000,\n    \"lte\": 5000\n  }\n}\n```",
                  "example": "eq"
                },
                "value": {
                  "description": "Value to compare with (filter item). A string, number or boolean for most operators (an array matches any of its values); `{ gte, lte, gt, lt }` for `range`; omitted for `exists` / `not_exists`. `contains` and `not_contains` values need at least 3 characters.",
                  "oneOf": [
                    {
                      "type": "string"
                    },
                    {
                      "type": "number"
                    },
                    {
                      "type": "boolean"
                    },
                    {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    },
                    {
                      "type": "object"
                    }
                  ],
                  "example": "open"
                },
                "group": {
                  "type": "string",
                  "enum": [
                    "AND",
                    "OR"
                  ],
                  "description": "Logical group operator for the nested `filters` (group item). Must be either `AND` or `OR`.",
                  "example": "OR"
                },
                "filters": {
                  "type": "array",
                  "description": "Array of filters or nested filter groups to be grouped together (group item), in the same form as this item",
                  "items": {
                    "type": "object"
                  },
                  "example": [
                    {
                      "field": "pipeline_id",
                      "operator": "eq",
                      "value": "bCkKGpDsyPP4peuKowkG"
                    },
                    {
                      "field": "pipeline_stage_id",
                      "operator": "eq",
                      "value": "7915dedc-8f18-44d5-8bc3-77c04e994a10"
                    }
                  ]
                }
              }
            },
            "example": [
              {
                "field": "status",
                "operator": "eq",
                "value": "open"
              },
              {
                "field": "date_updated",
                "operator": "range",
                "value": {
                  "gte": "2026-11-01T00:00:00Z"
                }
              },
              {
                "group": "OR",
                "filters": [
                  {
                    "field": "pipeline_id",
                    "operator": "eq",
                    "value": "bCkKGpDsyPP4peuKowkG"
                  },
                  {
                    "field": "pipeline_stage_id",
                    "operator": "eq",
                    "value": "7915dedc-8f18-44d5-8bc3-77c04e994a10"
                  }
                ]
              }
            ]
          },
          "sort": {
            "type": "array",
            "description": "Sort order, applied in the order given. Without `sort`, the newest opportunities come first (`date_added` `desc`). Opportunities that tie are ordered by id, so `searchAfter` paging is stable.",
            "items": {
              "type": "object",
              "properties": {
                "field": {
                  "type": "string",
                  "description": "Field to sort on (sort item). The standard sort fields of the Opportunities Search API reference, each with an example, and how to sort on a custom field:\n\n#### Date Created: `date_added`\n\nExample: newest opportunities first\n\n```json\n[\n  {\n    \"field\": \"date_added\",\n    \"direction\": \"desc\"\n  }\n]\n```\n\n#### Date Updated: `date_updated`\n\nExample: most recently updated opportunities first\n\n```json\n[\n  {\n    \"field\": \"date_updated\",\n    \"direction\": \"desc\"\n  }\n]\n```\n\n#### Opportunity Name: `name`\n\nExample: names A to Z\n\n```json\n[\n  {\n    \"field\": \"name\",\n    \"direction\": \"asc\"\n  }\n]\n```\n\n#### Monetary Value: `monetary_value`\n\nExample: highest value first\n\n```json\n[\n  {\n    \"field\": \"monetary_value\",\n    \"direction\": \"desc\"\n  }\n]\n```\n\n#### Last Status Change Date: `last_status_change_date`\n\nExample: most recent status change first\n\n```json\n[\n  {\n    \"field\": \"last_status_change_date\",\n    \"direction\": \"desc\"\n  }\n]\n```\n\n#### Last Stage Change Date: `last_stage_change_date`\n\nExample: most recent stage change first\n\n```json\n[\n  {\n    \"field\": \"last_stage_change_date\",\n    \"direction\": \"desc\"\n  }\n]\n```\n\n#### Custom fields: `{customFieldId}`\n\nSet `field` to the custom field id itself, without the `custom_fields.` prefix that filters use.\n\nExample: highest value of a number custom field first\n\n```json\n[\n  {\n    \"field\": \"{customFieldId}\",\n    \"direction\": \"desc\"\n  }\n]\n```\n\n#### Combining sorts\n\nYou can combine sorts; they apply in the order given.\n\nExample: newest opportunities first, then by monetary value\n\n```json\n[\n  {\n    \"field\": \"date_added\",\n    \"direction\": \"desc\"\n  },\n  {\n    \"field\": \"monetary_value\",\n    \"direction\": \"asc\"\n  }\n]\n```",
                  "example": "date_added"
                },
                "direction": {
                  "type": "string",
                  "enum": [
                    "asc",
                    "desc"
                  ],
                  "description": "Sorting direction: `asc` for ascending, `desc` for descending",
                  "example": "desc"
                }
              }
            },
            "example": [
              {
                "field": "date_added",
                "direction": "desc"
              }
            ]
          },
          "additionalDetails": {
            "description": "Related data to include with each opportunity: notes, tasks and calendar events",
            "example": {
              "notes": false,
              "tasks": false,
              "calendarEvents": false
            },
            "allOf": [
              {
                "type": "object",
                "properties": {
                  "notes": {
                    "type": "boolean",
                    "description": "Include notes in the response",
                    "example": false
                  },
                  "tasks": {
                    "type": "boolean",
                    "description": "Include tasks in the response",
                    "example": false
                  },
                  "calendarEvents": {
                    "type": "boolean",
                    "description": "Include calendar events in the response",
                    "example": false
                  },
                  "unReadConversations": {
                    "type": "boolean",
                    "description": "Include unread conversations count in the response",
                    "example": false
                  }
                },
                "title": "AdditionalDetailsDTO"
              }
            ]
          }
        },
        "required": [
          "locationId",
          "limit"
        ],
        "title": "OpportunitySearchBodyDTO"
      },
      "PostSearchSuccessfulResponseDto": {
        "type": "object",
        "properties": {
          "opportunities": {
            "description": "List of opportunities matching the search criteria",
            "example": [],
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string",
                  "description": "Unique identifier of the opportunity",
                  "example": "yWQobCRIhRguQtD2llvk"
                },
                "name": {
                  "type": "string",
                  "description": "Name of the opportunity",
                  "example": "testing"
                },
                "monetaryValue": {
                  "type": "number",
                  "description": "Monetary value of the opportunity",
                  "example": 500
                },
                "pipelineId": {
                  "type": "string",
                  "description": "Identifier of the pipeline the opportunity belongs to",
                  "example": "VDm7RPYC2GLUvdpKmBfC"
                },
                "pipelineStageId": {
                  "type": "string",
                  "description": "Identifier of the pipeline stage the opportunity is in",
                  "example": "e93ba61a-53b3-45e7-985a-c7732dbcdb69"
                },
                "assignedTo": {
                  "type": "string",
                  "description": "Identifier of the user the opportunity is assigned to",
                  "example": "zT46WSCPbudrq4zhWMk6"
                },
                "status": {
                  "type": "string",
                  "description": "Current status of the opportunity",
                  "example": "open"
                },
                "source": {
                  "type": "string",
                  "description": "Source of the opportunity",
                  "example": ""
                },
                "lastStatusChangeAt": {
                  "type": "string",
                  "description": "ISO 8601 timestamp of the last status change",
                  "example": "2021-08-03T04:55:17.355Z"
                },
                "lastStageChangeAt": {
                  "type": "string",
                  "description": "ISO 8601 timestamp of the last stage change",
                  "example": "2021-08-03T04:55:17.355Z"
                },
                "lastActionDate": {
                  "type": "string",
                  "description": "ISO 8601 timestamp of the last action on the opportunity",
                  "example": "2021-08-03T04:55:17.355Z"
                },
                "createdAt": {
                  "type": "string",
                  "description": "ISO 8601 timestamp when the opportunity was created",
                  "example": "2021-08-03T04:55:17.355Z"
                },
                "updatedAt": {
                  "type": "string",
                  "description": "ISO 8601 timestamp when the opportunity was last updated",
                  "example": "2021-08-03T04:55:17.355Z"
                },
                "forecastExpectedCloseDate": {
                  "type": "string",
                  "description": "Expected close date for the forecast (YYYY-MM-DD)",
                  "example": "2026-05-20"
                },
                "forecastOriginalCloseDate": {
                  "type": "string",
                  "description": "Original forecast close date before any slippage (YYYY-MM-DD)",
                  "example": "2026-05-01"
                },
                "forecastSlippageCount": {
                  "type": "number",
                  "description": "Number of times the close date has slipped",
                  "example": 2
                },
                "forecastDaysSlipped": {
                  "type": "number",
                  "description": "Total days the close date has slipped",
                  "example": 19
                },
                "forecastLastSlippedAt": {
                  "type": "string",
                  "description": "ISO 8601 timestamp of the last close-date slip",
                  "example": "2026-05-22T10:30:00.000Z"
                },
                "forecastProbability": {
                  "type": "number",
                  "description": "Forecast win probability percentage (0–100)",
                  "example": 20
                },
                "effectiveProbability": {
                  "type": "number",
                  "description": "Effective win probability after stage and forecast adjustments (0–100)",
                  "example": 40
                },
                "contactId": {
                  "type": "string",
                  "description": "Identifier of the contact linked to the opportunity. Absent/null for contactless opportunities.",
                  "example": "zT46WSCPbudrq4zhWMk6",
                  "nullable": true
                },
                "locationId": {
                  "type": "string",
                  "description": "Identifier of the location (sub-account) the opportunity belongs to",
                  "example": "zT46WSCPbudrq4zhW"
                },
                "contact": {
                  "description": "Contact details associated with the opportunity",
                  "example": {},
                  "allOf": [
                    {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "string",
                          "description": "Unique identifier of the contact",
                          "example": "byMEV0NQinDhq8ZfiOi2"
                        },
                        "name": {
                          "type": "string",
                          "description": "Full name of the contact",
                          "example": "John Deo"
                        },
                        "companyName": {
                          "type": "string",
                          "description": "Company name associated with the contact",
                          "example": "Tesla Inc"
                        },
                        "email": {
                          "type": "string",
                          "description": "Email address of the contact",
                          "example": "john@deo.com"
                        },
                        "phone": {
                          "type": "string",
                          "description": "Phone number of the contact",
                          "example": "+1202-555-0107"
                        },
                        "tags": {
                          "description": "Tags associated with the contact",
                          "example": [
                            "lead",
                            "vip"
                          ],
                          "type": "array",
                          "items": {
                            "type": "string"
                          }
                        }
                      },
                      "title": "SearchOpportunitiesContactResponseSchema"
                    }
                  ]
                },
                "notes": {
                  "description": "Notes attached to the opportunity",
                  "example": [],
                  "type": "array",
                  "items": {
                    "type": "array"
                  }
                },
                "tasks": {
                  "description": "Tasks attached to the opportunity",
                  "example": [],
                  "type": "array",
                  "items": {
                    "type": "array"
                  }
                },
                "calendarEvents": {
                  "description": "Calendar events attached to the opportunity",
                  "example": [],
                  "type": "array",
                  "items": {
                    "type": "array"
                  }
                },
                "lostReasonId": {
                  "type": "string",
                  "description": "Identifier of the lost reason if the opportunity was marked lost",
                  "example": "zT46WSCPbudrq4zhWMk6"
                },
                "customFields": {
                  "description": "Custom fields associated with the opportunity",
                  "example": [],
                  "type": "array",
                  "items": {
                    "type": "object",
                    "properties": {
                      "id": {
                        "type": "string",
                        "description": "Unique identifier of the custom field",
                        "example": "MgobCB14YMVKuE4Ka8p1"
                      },
                      "fieldValue": {
                        "description": "The value of the custom field",
                        "example": "custom field value",
                        "oneOf": [
                          {
                            "type": "string"
                          },
                          {
                            "type": "object"
                          },
                          {
                            "type": "array",
                            "items": {
                              "type": "string"
                            }
                          },
                          {
                            "type": "array",
                            "items": {
                              "type": "object"
                            }
                          }
                        ]
                      }
                    },
                    "required": [
                      "id",
                      "fieldValue"
                    ],
                    "title": "CustomFieldResponseSchema"
                  }
                },
                "followers": {
                  "description": "User IDs following this opportunity",
                  "example": [
                    "sx6wyHhbFdRXh302Lunr"
                  ],
                  "type": "array",
                  "items": {
                    "type": "array"
                  }
                },
                "externalObjectId": {
                  "type": "string",
                  "description": "External object identifier for integrations",
                  "example": "ext_obj_12345"
                }
              },
              "title": "SearchOpportunitiesResponseSchema"
            }
          },
          "total": {
            "type": "number",
            "description": "Total number of opportunities matching the query",
            "example": 100
          },
          "stageAggregations": {
            "description": "Per-stage totals when pipeline filter is present",
            "example": [],
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "pipelineStageId": {
                  "type": "string",
                  "description": "Identifier of the pipeline stage being aggregated",
                  "example": "e93ba61a-53b3-45e7-985a-c7732dbcdb69"
                },
                "totalCount": {
                  "type": "number",
                  "description": "Total number of opportunities in this stage",
                  "example": 12
                },
                "totalValue": {
                  "type": "number",
                  "description": "Total monetary value of all opportunities in this stage",
                  "example": 24500
                },
                "weightedValue": {
                  "type": "number",
                  "description": "Probability-weighted total value of opportunities in this stage",
                  "example": 14700
                },
                "openValue": {
                  "type": "number",
                  "description": "Total value of open opportunities in this stage",
                  "example": 18000
                },
                "openWeightedValue": {
                  "type": "number",
                  "description": "Probability-weighted value of open opportunities in this stage",
                  "example": 10800
                },
                "wonValue": {
                  "type": "number",
                  "description": "Total value of won opportunities in this stage",
                  "example": 6500
                }
              },
              "required": [
                "pipelineStageId",
                "totalCount",
                "totalValue",
                "weightedValue",
                "openValue",
                "openWeightedValue",
                "wonValue"
              ],
              "title": "StageAggregationResponseDto"
            }
          },
          "aggregations": {
            "type": "object",
            "description": "Aggregation results keyed by aggregation name",
            "example": {}
          }
        },
        "required": [
          "total"
        ],
        "title": "PostSearchSuccessfulResponseDto"
      },
      "BadRequestDTO": {
        "type": "object",
        "properties": {
          "statusCode": {
            "type": "number",
            "example": 400
          },
          "message": {
            "type": "string",
            "example": "Bad Request"
          }
        },
        "title": "BadRequestDTO"
      },
      "UnauthorizedDTO": {
        "type": "object",
        "properties": {
          "statusCode": {
            "type": "number",
            "example": 401
          },
          "message": {
            "type": "string",
            "example": "Invalid token: access token is invalid"
          },
          "error": {
            "type": "string",
            "example": "Unauthorized"
          }
        },
        "title": "UnauthorizedDTO"
      },
      "UnprocessableDTO": {
        "type": "object",
        "properties": {
          "statusCode": {
            "type": "number",
            "example": 422
          },
          "message": {
            "example": [
              "Unprocessable Entity"
            ],
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "error": {
            "type": "string",
            "example": "Unprocessable Entity"
          }
        },
        "title": "UnprocessableDTO"
      },
      "TooManyRequestsDTO": {
        "type": "object",
        "properties": {
          "statusCode": {
            "type": "number",
            "description": "HTTP status code",
            "example": 429
          },
          "message": {
            "type": "string",
            "description": "Error message",
            "example": "Rate limit exceeded."
          },
          "error": {
            "type": "string",
            "description": "HTTP error name",
            "example": "Too Many Requests"
          }
        },
        "title": "TooManyRequestsDTO"
      },
      "InternalServerErrorDTO": {
        "type": "object",
        "properties": {
          "statusCode": {
            "type": "number",
            "description": "HTTP status code",
            "example": 500
          },
          "message": {
            "type": "string",
            "description": "Error message describing the internal server error",
            "example": "Internal Server Error"
          }
        },
        "title": "InternalServerErrorDTO"
      }
    }
  }
}
```

## Code Examples

**cURL**

```bash
curl -L -X POST 'https://services.leadconnectorhq.com/opportunities/search' \
  -H 'Authorization: Bearer <TOKEN>' \
  -H 'Version: v3' \
  -H 'Content-Type: application/json' \
  --data-raw '{
  "locationId": "i2SpAtBVHSVea1sL6oah",
  "query": "john@example.com",
  "limit": 20,
  "page": 1,
  "searchAfter": [
    1625203104328,
    "yWQobCRIhRguQtD2llvk"
  ],
  "filters": [
    {
      "field": "status",
      "operator": "eq",
      "value": "open"
    },
    {
      "field": "date_updated",
      "operator": "range",
      "value": {
        "gte": "2026-11-01T00:00:00Z"
      }
    },
    {
      "group": "OR",
      "filters": [
        {
          "field": "pipeline_id",
          "operator": "eq",
          "value": "bCkKGpDsyPP4peuKowkG"
        },
        {
          "field": "pipeline_stage_id",
          "operator": "eq",
          "value": "7915dedc-8f18-44d5-8bc3-77c04e994a10"
        }
      ]
    }
  ],
  "sort": [
    {
      "field": "date_added",
      "direction": "desc"
    }
  ],
  "additionalDetails": {
    "notes": false,
    "tasks": false,
    "calendarEvents": false
  }
}'
```

**Node.js**

```javascript
const options = {
  method: 'POST',
  headers: {
    Authorization: 'Bearer <TOKEN>',
    Version: 'v3',
    'Content-Type': 'application/json'
  },
  body: JSON.stringify({
      "locationId": "i2SpAtBVHSVea1sL6oah",
      "query": "john@example.com",
      "limit": 20,
      "page": 1,
      "searchAfter": [
        1625203104328,
        "yWQobCRIhRguQtD2llvk"
      ],
      "filters": [
        {
          "field": "status",
          "operator": "eq",
          "value": "open"
        },
        {
          "field": "date_updated",
          "operator": "range",
          "value": {
            "gte": "2026-11-01T00:00:00Z"
          }
        },
        {
          "group": "OR",
          "filters": [
            {
              "field": "pipeline_id",
              "operator": "eq",
              "value": "bCkKGpDsyPP4peuKowkG"
            },
            {
              "field": "pipeline_stage_id",
              "operator": "eq",
              "value": "7915dedc-8f18-44d5-8bc3-77c04e994a10"
            }
          ]
        }
      ],
      "sort": [
        {
          "field": "date_added",
          "direction": "desc"
        }
      ],
      "additionalDetails": {
        "notes": false,
        "tasks": false,
        "calendarEvents": false
      }
  })
};

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

**Python**

```python
import requests

url = "https://services.leadconnectorhq.com/opportunities/search"

headers = {
    "Authorization": "Bearer <TOKEN>",
    "Version": "v3"
}

payload = {
    "locationId": "i2SpAtBVHSVea1sL6oah",
    "query": "john@example.com",
    "limit": 20,
    "page": 1,
    "searchAfter": [
        1625203104328,
        "yWQobCRIhRguQtD2llvk"
    ],
    "filters": [
        {
            "field": "status",
            "operator": "eq",
            "value": "open"
        },
        {
            "field": "date_updated",
            "operator": "range",
            "value": {
                "gte": "2026-11-01T00:00:00Z"
            }
        },
        {
            "group": "OR",
            "filters": [
                {
                    "field": "pipeline_id",
                    "operator": "eq",
                    "value": "bCkKGpDsyPP4peuKowkG"
                },
                {
                    "field": "pipeline_stage_id",
                    "operator": "eq",
                    "value": "7915dedc-8f18-44d5-8bc3-77c04e994a10"
                }
            ]
        }
    ],
    "sort": [
        {
            "field": "date_added",
            "direction": "desc"
        }
    ],
    "additionalDetails": {
        "notes": false,
        "tasks": false,
        "calendarEvents": false
    }
}

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/opportunities/search',
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_CUSTOMREQUEST => 'POST',
  CURLOPT_HTTPHEADER => [
    'Authorization: Bearer <TOKEN>',
    'Version: v3',
    'Content-Type: application/json',
  ],
  CURLOPT_POSTFIELDS => '{
  "locationId": "i2SpAtBVHSVea1sL6oah",
  "query": "john@example.com",
  "limit": 20,
  "page": 1,
  "searchAfter": [
    1625203104328,
    "yWQobCRIhRguQtD2llvk"
  ],
  "filters": [
    {
      "field": "status",
      "operator": "eq",
      "value": "open"
    },
    {
      "field": "date_updated",
      "operator": "range",
      "value": {
        "gte": "2026-11-01T00:00:00Z"
      }
    },
    {
      "group": "OR",
      "filters": [
        {
          "field": "pipeline_id",
          "operator": "eq",
          "value": "bCkKGpDsyPP4peuKowkG"
        },
        {
          "field": "pipeline_stage_id",
          "operator": "eq",
          "value": "7915dedc-8f18-44d5-8bc3-77c04e994a10"
        }
      ]
    }
  ],
  "sort": [
    {
      "field": "date_added",
      "direction": "desc"
    }
  ],
  "additionalDetails": {
    "notes": false,
    "tasks": false,
    "calendarEvents": false
  }
}',
]);

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

**Java**

```java
HttpResponse<String> response = Unirest
  .post("https://services.leadconnectorhq.com/opportunities/search")
  .header("Authorization", "Bearer <TOKEN>")
  .header("Version", "v3")
  .header("Content-Type", "application/json")
  .body("{\"locationId\":\"i2SpAtBVHSVea1sL6oah\",\"query\":\"john@example.com\",\"limit\":20,\"page\":1,\"searchAfter\":[1625203104328,\"yWQobCRIhRguQtD2llvk\"],\"filters\":[{\"field\":\"status\",\"operator\":\"eq\",\"value\":\"open\"},{\"field\":\"date_updated\",\"operator\":\"range\",\"value\":{\"gte\":\"2026-11-01T00:00:00Z\"}},{\"group\":\"OR\",\"filters\":[{\"field\":\"pipeline_id\",\"operator\":\"eq\",\"value\":\"bCkKGpDsyPP4peuKowkG\"},{\"field\":\"pipeline_stage_id\",\"operator\":\"eq\",\"value\":\"7915dedc-8f18-44d5-8bc3-77c04e994a10\"}]}],\"sort\":[{\"field\":\"date_added\",\"direction\":\"desc\"}],\"additionalDetails\":{\"notes\":false,\"tasks\":false,\"calendarEvents\":false}}")
  .asString();
```

**Go**

```go
package main

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

func main() {
  url := "https://services.leadconnectorhq.com/opportunities/search"
  payload := strings.NewReader(`{
  "locationId": "i2SpAtBVHSVea1sL6oah",
  "query": "john@example.com",
  "limit": 20,
  "page": 1,
  "searchAfter": [
    1625203104328,
    "yWQobCRIhRguQtD2llvk"
  ],
  "filters": [
    {
      "field": "status",
      "operator": "eq",
      "value": "open"
    },
    {
      "field": "date_updated",
      "operator": "range",
      "value": {
        "gte": "2026-11-01T00:00:00Z"
      }
    },
    {
      "group": "OR",
      "filters": [
        {
          "field": "pipeline_id",
          "operator": "eq",
          "value": "bCkKGpDsyPP4peuKowkG"
        },
        {
          "field": "pipeline_stage_id",
          "operator": "eq",
          "value": "7915dedc-8f18-44d5-8bc3-77c04e994a10"
        }
      ]
    }
  ],
  "sort": [
    {
      "field": "date_added",
      "direction": "desc"
    }
  ],
  "additionalDetails": {
    "notes": false,
    "tasks": false,
    "calendarEvents": false
  }
}`)
  req, _ := http.NewRequest("POST", url, payload)
  req.Header.Add("Authorization", "Bearer <TOKEN>")
  req.Header.Add("Version", "v3")

  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/opportunities/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"] = "v3"
request["Content-Type"] = "application/json"
request.body = '{
  "locationId": "i2SpAtBVHSVea1sL6oah",
  "query": "john@example.com",
  "limit": 20,
  "page": 1,
  "searchAfter": [
    1625203104328,
    "yWQobCRIhRguQtD2llvk"
  ],
  "filters": [
    {
      "field": "status",
      "operator": "eq",
      "value": "open"
    },
    {
      "field": "date_updated",
      "operator": "range",
      "value": {
        "gte": "2026-11-01T00:00:00Z"
      }
    },
    {
      "group": "OR",
      "filters": [
        {
          "field": "pipeline_id",
          "operator": "eq",
          "value": "bCkKGpDsyPP4peuKowkG"
        },
        {
          "field": "pipeline_stage_id",
          "operator": "eq",
          "value": "7915dedc-8f18-44d5-8bc3-77c04e994a10"
        }
      ]
    }
  ],
  "sort": [
    {
      "field": "date_added",
      "direction": "desc"
    }
  ],
  "additionalDetails": {
    "notes": false,
    "tasks": false,
    "calendarEvents": false
  }
}'

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

**PowerShell**

```powershell
$headers = @{
  "Authorization" = "Bearer <TOKEN>"
  "Version" = "v3"
}

$body = '{
  "locationId": "i2SpAtBVHSVea1sL6oah",
  "query": "john@example.com",
  "limit": 20,
  "page": 1,
  "searchAfter": [
    1625203104328,
    "yWQobCRIhRguQtD2llvk"
  ],
  "filters": [
    {
      "field": "status",
      "operator": "eq",
      "value": "open"
    },
    {
      "field": "date_updated",
      "operator": "range",
      "value": {
        "gte": "2026-11-01T00:00:00Z"
      }
    },
    {
      "group": "OR",
      "filters": [
        {
          "field": "pipeline_id",
          "operator": "eq",
          "value": "bCkKGpDsyPP4peuKowkG"
        },
        {
          "field": "pipeline_stage_id",
          "operator": "eq",
          "value": "7915dedc-8f18-44d5-8bc3-77c04e994a10"
        }
      ]
    }
  ],
  "sort": [
    {
      "field": "date_added",
      "direction": "desc"
    }
  ],
  "additionalDetails": {
    "notes": false,
    "tasks": false,
    "calendarEvents": false
  }
}'

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