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

# Pipedrive: Search Leads

> Search leads. Pipedrive Search Leads reference includes SDK V2 and CLI requests, input constraints, response fields, and Deepline cost.

Search leads.

<Info>
  Tool ID: `pipedrive_search_leads`
</Info>

## Run this action

Use the TypeScript SDK for a single call. Put `ctx.tools.execute(...)` inside a Play when the call should be durable, scheduled, or run across a CSV.

```ts theme={null}
import { Deepline } from 'deepline';

const deepline = await Deepline.connect();
const result = await deepline.tools.execute(
  'pipedrive_search_leads',
  {
    "term": "software companies hiring engineers"
  },
);

console.log(result.toolResponse.raw);
```

### CLI

```bash theme={null}
deepline tools execute pipedrive_search_leads --input '{
  "term": "software companies hiring engineers"
}' --json
```

## Example response

The SDK exposes this shape at `result.toolResponse.raw`. Values below are representative.

```json theme={null}
{
  "data": {
    "success": true,
    "data": {
      "items": [
        {
          "result_score": 123,
          "item": {}
        }
      ]
    },
    "additional_data": {
      "next_cursor": "cursor_123"
    }
  }
}
```

Use `deepline tools get pipedrive_search_leads --json` for the latest machine-readable contract.

## Input reference

Searches all leads by title, notes and/or custom fields. This endpoint is a wrapper of /v1/itemSearch with a narrower OAuth scope. Found leads can be filtered by the person ID and the organization ID.

| Name                      | Type                                    | Required | Default | Details                                                                                                                                               |
| ------------------------- | --------------------------------------- | -------- | ------- | ----------------------------------------------------------------------------------------------------------------------------------------------------- |
| `payload.term`            | `string`                                | Yes      | —       | The search term to look for. Minimum 2 characters (or 1 if using `exact_match`). Please note that the search term has to be URL encoded.              |
| `payload.fields`          | `"custom_fields" \| "notes" \| "title"` | No       | —       | A comma-separated string array. The fields to perform the search from. Defaults to all of them. Allowed: `custom_fields`, `notes`, `title`.           |
| `payload.exact_match`     | `boolean`                               | No       | —       | When enabled, only full exact matches against the given term are returned. It is not case sensitive.                                                  |
| `payload.person_id`       | `integer`                               | No       | —       | Will filter leads by the provided person ID. The upper limit of found leads associated with the person is 2000.                                       |
| `payload.organization_id` | `integer`                               | No       | —       | Will filter leads by the provided organization ID. The upper limit of found leads associated with the organization is 2000.                           |
| `payload.include_fields`  | `"lead.was_seen"`                       | No       | —       | Supports including optional fields in the results which are not provided by default Allowed: `lead.was_seen`.                                         |
| `payload.limit`           | `integer`                               | No       | —       | For pagination, the limit of entries to be returned. If not provided, 100 items will be returned. Please note that a maximum value of 500 is allowed. |
| `payload.cursor`          | `string`                                | No       | —       | For pagination, the marker (an opaque string value) representing the first item on the next page                                                      |

<details>
  <summary>Show raw input schema</summary>

  ### Input JSON Schema

  ```json theme={null}
  {
    "type": "object",
    "description": "Searches all leads by title, notes and/or custom fields. This endpoint is a wrapper of /v1/itemSearch with a narrower OAuth scope. Found leads can be filtered by the person ID and the organization ID.",
    "properties": {
      "term": {
        "type": "string",
        "description": "The search term to look for. Minimum 2 characters (or 1 if using `exact_match`). Please note that the search term has to be URL encoded."
      },
      "fields": {
        "type": "string",
        "description": "A comma-separated string array. The fields to perform the search from. Defaults to all of them.",
        "enum": [
          "custom_fields",
          "notes",
          "title"
        ]
      },
      "exact_match": {
        "type": "boolean",
        "description": "When enabled, only full exact matches against the given term are returned. It is not case sensitive."
      },
      "person_id": {
        "type": "integer",
        "description": "Will filter leads by the provided person ID. The upper limit of found leads associated with the person is 2000."
      },
      "organization_id": {
        "type": "integer",
        "description": "Will filter leads by the provided organization ID. The upper limit of found leads associated with the organization is 2000."
      },
      "include_fields": {
        "type": "string",
        "description": "Supports including optional fields in the results which are not provided by default",
        "enum": [
          "lead.was_seen"
        ]
      },
      "limit": {
        "type": "integer",
        "description": "For pagination, the limit of entries to be returned. If not provided, 100 items will be returned. Please note that a maximum value of 500 is allowed."
      },
      "cursor": {
        "type": "string",
        "description": "For pagination, the marker (an opaque string value) representing the first item on the next page"
      }
    },
    "required": [
      "term"
    ],
    "additionalProperties": false
  }
  ```
</details>

## Output reference

Standard tool result payload.

| Name                                              | Type      | Required | Default | Details                                                                                                                                                                   |
| ------------------------------------------------- | --------- | -------- | ------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `result.data`                                     | `object`  | Yes      | —       | Provider response payload.                                                                                                                                                |
| `result.data.success`                             | `boolean` | No       | —       | If the response is successful or not                                                                                                                                      |
| `result.data.data`                                | `object`  | No       | —       | —                                                                                                                                                                         |
| `result.data.data.items`                          | `array`   | No       | —       | The array of leads                                                                                                                                                        |
| `result.data.data.items[].result_score`           | `number`  | No       | —       | Search result relevancy                                                                                                                                                   |
| `result.data.data.items[].item`                   | `object`  | No       | —       | —                                                                                                                                                                         |
| `result.data.data.items[].item.id`                | `string`  | No       | —       | The ID of the lead                                                                                                                                                        |
| `result.data.data.items[].item.type`              | `string`  | No       | —       | The type of the item                                                                                                                                                      |
| `result.data.data.items[].item.title`             | `string`  | No       | —       | The title of the lead                                                                                                                                                     |
| `result.data.data.items[].item.owner`             | `object`  | No       | —       | —                                                                                                                                                                         |
| `result.data.data.items[].item.owner.id`          | `integer` | No       | —       | The ID of the owner of the lead                                                                                                                                           |
| `result.data.data.items[].item.person`            | `object`  | No       | —       | —                                                                                                                                                                         |
| `result.data.data.items[].item.person.id`         | `integer` | No       | —       | The ID of the person the lead is associated with                                                                                                                          |
| `result.data.data.items[].item.person.name`       | `string`  | No       | —       | The name of the person the lead is associated with                                                                                                                        |
| `result.data.data.items[].item.organization`      | `object`  | No       | —       | —                                                                                                                                                                         |
| `result.data.data.items[].item.organization.id`   | `integer` | No       | —       | The ID of the organization the lead is associated with                                                                                                                    |
| `result.data.data.items[].item.organization.name` | `string`  | No       | —       | The name of the organization the lead is associated with                                                                                                                  |
| `result.data.data.items[].item.phones`            | `array`   | No       | —       | —                                                                                                                                                                         |
| `result.data.data.items[].item.emails`            | `array`   | No       | —       | —                                                                                                                                                                         |
| `result.data.data.items[].item.custom_fields`     | `array`   | No       | —       | Custom fields                                                                                                                                                             |
| `result.data.data.items[].item.notes`             | `array`   | No       | —       | An array of notes                                                                                                                                                         |
| `result.data.data.items[].item.value`             | `integer` | No       | —       | The value of the lead                                                                                                                                                     |
| `result.data.data.items[].item.currency`          | `string`  | No       | —       | The currency of the lead                                                                                                                                                  |
| `result.data.data.items[].item.visible_to`        | `integer` | No       | —       | The visibility of the lead                                                                                                                                                |
| `result.data.data.items[].item.is_archived`       | `boolean` | No       | —       | A flag indicating whether the lead is archived or not                                                                                                                     |
| `result.data.additional_data`                     | `object`  | No       | —       | Pagination related data                                                                                                                                                   |
| `result.data.additional_data.next_cursor`         | `string`  | No       | —       | The first item on the next page. The value of the `next_cursor` field will be `null` if you have reached the end of the dataset and there’s no more pages to be returned. |
| `result.meta`                                     | `object`  | No       | —       | Additional response metadata (status, paging).                                                                                                                            |

<details>
  <summary>Show raw output schema</summary>

  ### Output JSON Schema

  ```json theme={null}
  {
    "type": "object",
    "description": "Standard tool result payload.",
    "properties": {
      "data": {
        "type": "object",
        "description": "Provider response payload.",
        "properties": {
          "success": {
            "type": "boolean",
            "description": "If the response is successful or not"
          },
          "data": {
            "type": "object",
            "properties": {
              "items": {
                "type": "array",
                "description": "The array of leads",
                "items": {
                  "type": "object",
                  "properties": {
                    "result_score": {
                      "type": "number",
                      "description": "Search result relevancy"
                    },
                    "item": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "string",
                          "description": "The ID of the lead"
                        },
                        "type": {
                          "type": "string",
                          "description": "The type of the item"
                        },
                        "title": {
                          "type": "string",
                          "description": "The title of the lead"
                        },
                        "owner": {
                          "type": "object",
                          "properties": {
                            "id": {
                              "type": "integer",
                              "description": "The ID of the owner of the lead"
                            }
                          },
                          "additionalProperties": false
                        },
                        "person": {
                          "type": "object",
                          "properties": {
                            "id": {
                              "type": "integer",
                              "description": "The ID of the person the lead is associated with"
                            },
                            "name": {
                              "type": "string",
                              "description": "The name of the person the lead is associated with"
                            }
                          },
                          "additionalProperties": false
                        },
                        "organization": {
                          "type": "object",
                          "properties": {
                            "id": {
                              "type": "integer",
                              "description": "The ID of the organization the lead is associated with"
                            },
                            "name": {
                              "type": "string",
                              "description": "The name of the organization the lead is associated with"
                            }
                          },
                          "additionalProperties": false
                        },
                        "phones": {
                          "type": "array",
                          "items": {
                            "type": "string"
                          }
                        },
                        "emails": {
                          "type": "array",
                          "items": {
                            "type": "string"
                          }
                        },
                        "custom_fields": {
                          "type": "array",
                          "description": "Custom fields",
                          "items": {
                            "type": "string"
                          }
                        },
                        "notes": {
                          "type": "array",
                          "description": "An array of notes",
                          "items": {
                            "type": "string"
                          }
                        },
                        "value": {
                          "type": "integer",
                          "description": "The value of the lead"
                        },
                        "currency": {
                          "type": "string",
                          "description": "The currency of the lead"
                        },
                        "visible_to": {
                          "type": "integer",
                          "description": "The visibility of the lead"
                        },
                        "is_archived": {
                          "type": "boolean",
                          "description": "A flag indicating whether the lead is archived or not"
                        }
                      },
                      "additionalProperties": false
                    }
                  },
                  "additionalProperties": false
                }
              }
            },
            "additionalProperties": false
          },
          "additional_data": {
            "type": "object",
            "description": "Pagination related data",
            "properties": {
              "next_cursor": {
                "type": "string",
                "description": "The first item on the next page. The value of the `next_cursor` field will be `null` if you have reached the end of the dataset and there’s no more pages to be returned."
              }
            },
            "additionalProperties": false
          }
        },
        "required": [],
        "additionalProperties": false
      },
      "meta": {
        "type": "object",
        "description": "Additional response metadata (status, paging).",
        "additionalProperties": true
      }
    },
    "required": [
      "data"
    ],
    "additionalProperties": false
  }
  ```
</details>

## Deepline cost

* Pricing model: `fixed` (per call).
* Estimated Deepline credits: `0` per pricing unit.
* Provider-native pricing may still exist outside Deepline credit billing.

## Related documentation

* [Pipedrive provider guide](/docs/providers/pipedrive/guide)
* [SDK V2 quickstart](/docs/sdk-v2/quickstart)
* [SDK reference](/docs/sdk-v2/sdk-reference)
* [Run tools across a CSV](/docs/sdk-v2/batch-csv)
