> ## Documentation Index
> Fetch the complete documentation index at: https://developer.surense.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Search leads

Search leads with filtering and pagination.

Example:

```json
{
    "startRow": 0,
    "endRow": 10,
    "sorts": [
        {
            "dir": "desc",
            "field": "createdDate"
        }
    ],
    "filtersOperator": "or",
    "filters": [
        {
            "field": "customer.hbDataDate",
            "value": [
                "2025-09-08",
                "2025-10-14"
            ],
            "operator": "inRange"
        },
        {
            "field": "interest",
            "operator": "isAnyOf",
            "value": [
                "63b7e678-f645-45ab-a9b8-4177282e0d8b",
                "fedb19c9-a42b-4d8c-9c9d-42cd597c5c92",
                "37cbcd65-a7c9-425d-ae30-56ad4855d88c",
                "ccd03acb-e975-4810-b33b-96b28b034e1d",
                "37376236-3934-6538-3831-363734663735"
            ]
        }
    ]
}
```

# OpenAPI definition

```json
{
  "openapi": "3.1.0",
  "info": {
    "title": "API",
    "description": "Surense API",
    "termsOfService": "https://static.surense.com/terms.htm",
    "contact": {
      "name": "API Support",
      "email": "contact@surense.com"
    },
    "version": "1"
  },
  "servers": [
    {
      "url": "https://api.surense.com/api/v1",
      "description": "Production"
    }
  ],
  "paths": {
    "/leads/search": {
      "post": {
        "tags": [
          "Leads"
        ],
        "summary": "Search leads",
        "description": "Search leads with filtering and pagination.",
        "operationId": "searchLeads",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PaginatedSearchRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "*/*": {
                "schema": {
                  "type": "object"
                }
              }
            }
          }
        },
        "security": [
          {
            "oauth2": [
              "leads:read"
            ]
          }
        ]
      }
    }
  },
  "components": {
    "schemas": {
      "FilterDefinition": {
        "type": "object",
        "description": "Filter definition for search criteria",
        "properties": {
          "field": {
            "type": "string",
            "description": "Field name to filter by. Available fields can be fetched using GET /{entity}/fields (e.g., /meetings/fields, /workflows/fields, /leads/fields). The field name is shown under `fieldName`",
            "example": "status"
          },
          "value": {
            "description": "Filter value. Can be a string or an array of values.",
            "oneOf": [
              {
                "type": "string"
              },
              {
                "type": "array",
                "items": {
                  "type": "string"
                }
              }
            ]
          },
          "operator": {
            "type": "string",
            "description": "Filter operator",
            "enum": [
              "inRange",
              "notInRange",
              "greaterThan",
              "lessThan",
              "equals",
              "isAnyOf",
              "isNoneOf",
              "notEquals",
              "isEmpty",
              "greaterThanOrEqual"
            ],
            "example": "equals"
          },
          "list": {
            "type": "boolean"
          }
        },
        "required": [
          "field",
          "operator"
        ]
      },
      "PaginatedSearchRequest": {
        "type": "object",
        "description": "Request for paginated search operations",
        "properties": {
          "sorts": {
            "type": "array",
            "description": "List of sort definitions for search results",
            "items": {
              "$ref": "#/components/schemas/SortDefinition"
            }
          },
          "filtersOperator": {
            "type": "string",
            "description": "Operator to combine multiple filters (defaults to 'and' if not specified)",
            "enum": [
              "and",
              "or"
            ],
            "example": "and"
          },
          "filters": {
            "type": "array",
            "description": "List of filter definitions for search criteria",
            "items": {
              "$ref": "#/components/schemas/FilterDefinition"
            }
          },
          "startRow": {
            "type": "integer",
            "format": "int32",
            "description": "Starting row index for pagination (0-based) (defaults to 0 if not specified)",
            "example": 0
          },
          "endRow": {
            "type": "integer",
            "format": "int32",
            "description": "Ending row index for pagination (exclusive). The page size (i.e. endRow - startRow) must be less than or equals 50. (defaults to 50 if not specified)",
            "example": 50
          }
        }
      },
      "SortDefinition": {
        "type": "object",
        "description": "Sort definition for search results",
        "properties": {
          "field": {
            "type": "string",
            "description": "Field name to sort by. Available fields can be fetched using GET /{entity}/fields (e.g., /meetings/fields, /workflows/fields, /leads/fields). The field name is shown under `fieldName`",
            "example": "name"
          },
          "dir": {
            "type": "string",
            "description": "Sort direction: 'asc' for ascending order, 'desc' for descending order (defaults to 'asc' if not specified)",
            "enum": [
              "asc",
              "desc"
            ],
            "example": "asc"
          }
        },
        "required": [
          "field"
        ]
      }
    },
    "securitySchemes": {
      "oauth2": {
        "type": "oauth2",
        "flows": {
          "authorizationCode": {
            "authorizationUrl": "https://auth.surense.com/authorize",
            "tokenUrl": "https://auth.surense.com/oauth/token",
            "scopes": {
              "openid": "OpenID",
              "profile": "Profile",
              "global:export": "Export"
            }
          }
        }
      }
    }
  }
}
```