> ## 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.

# Affinity Get Persons: Inputs, Cost & CLI Example

> Persons / Search for persons. Includes inputs, outputs, pricing notes, Deepline CLI examples, and GTM automation guidance.

## Run in Enrichment Spreadsheet

<Info>
  Use this function as a column step in `deepline enrich`.
</Info>

```bash theme={null}
deepline enrich --input leads.csv --output leads.enriched.csv --with 'result=affinity_get_persons:{}' --json
```

<Tip>
  Map payload values to spreadsheet columns with `{{column_name}}` placeholders.
</Tip>

## Input Schema

| Name                                 | Type     | Required | Default | Description                                                                                                                                             |
| ------------------------------------ | -------- | -------- | ------- | ------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `payload.term`                       | `string` | No       |         | A string used to search all the persons in your team's address book. This could be an email address, a first name or a last name.                       |
| `payload.with_interaction_dates`     | `string` | No       |         | When true, interaction dates will be present on the returned resources. Only persons that have interactions will be returned.                           |
| `payload.with_interaction_persons`   | `string` | No       |         | When true, persons for each interaction will be returned. Used in conjunction with with\_interaction\_dates                                             |
| `payload.with_opportunities`         | `string` | No       |         | When true, opportunity IDs will be returned for each person.                                                                                            |
| `payload.with_current_organizations` | `string` | No       |         | When true, the organization IDs of each person's current organizations (according to the Affinity Data: Current Organizations column) will be returned. |
| `payload.min_first_email_date`       | `string` | No       |         | Only returns persons with the first\_email above the given value. This would be used with max interation.                                               |
| `payload.min_last_email_date`        | `string` | No       |         | Only returns persons with the last\_email above the given value. This would be used with max interation.                                                |
| `payload.min_last_interaction_date`  | `string` | No       |         | Only returns persons with the last\_interaction above the given value. This would be used with max interation.                                          |
| `payload.min_last_event_date`        | `string` | No       |         | Only returns persons with the last\_event above the given value. This would be used with max interation.                                                |
| `payload.min_first_event_date`       | `string` | No       |         | Only returns persons with the first\_event above the given value. This would be used with max interation.                                               |
| `payload.min_next_event_date`        | `string` | No       |         | Only returns persons with the next\_event above the given value. This would be used with max interation.                                                |
| `payload.max_first_email_date`       | `string` | No       |         | Only returns persons with the first\_email below the given value. This would be used with min interation.                                               |
| `payload.max_last_email_date`        | `string` | No       |         | Only returns persons with the last\_email below the given value. This would be used with min interation.                                                |
| `payload.max_last_interaction_date`  | `string` | No       |         | Only returns persons with the last\_interaction below the given value. This would be used with min interation.                                          |
| `payload.max_last_event_date`        | `string` | No       |         | Only returns persons with the last\_event below the given value. This would be used with min interation.                                                |
| `payload.max_first_event_date`       | `string` | No       |         | Only returns persons with the first\_event below the given value. This would be used with min interation.                                               |
| `payload.max_next_event_date`        | `string` | No       |         | Only returns persons with the next\_event below the given value. This would be used with min interation.                                                |
| `payload.page_size`                  | `string` | No       |         | How many results to return per page. (Default is the maximum value of 500.)                                                                             |
| `payload.page_token`                 | `string` | No       |         | The next\_page\_token from the previous response required to retrieve the next page of results.                                                         |

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

  ### Input JSON Schema

  ```json theme={null}
  {
    "type": "object",
    "description": "Persons / Search for persons",
    "properties": {
      "term": {
        "type": "string",
        "description": "A string used to search all the persons in your team's address book. This could be an email address, a first name or a last name."
      },
      "with_interaction_dates": {
        "type": "string",
        "description": "When true, interaction dates will be present on the returned resources. Only persons that have interactions will be returned."
      },
      "with_interaction_persons": {
        "type": "string",
        "description": "When true, persons for each interaction will be returned. Used in conjunction with with_interaction_dates"
      },
      "with_opportunities": {
        "type": "string",
        "description": "When true, opportunity IDs will be returned for each person."
      },
      "with_current_organizations": {
        "type": "string",
        "description": "When true, the organization IDs of each person's current organizations (according to the Affinity Data: Current Organizations column) will be returned."
      },
      "min_first_email_date": {
        "type": "string",
        "description": "Only returns persons with the first_email above the given value. This would be used with max interation."
      },
      "min_last_email_date": {
        "type": "string",
        "description": "Only returns persons with the last_email above the given value. This would be used with max interation."
      },
      "min_last_interaction_date": {
        "type": "string",
        "description": "Only returns persons with the last_interaction above the given value. This would be used with max interation."
      },
      "min_last_event_date": {
        "type": "string",
        "description": "Only returns persons with the last_event above the given value. This would be used with max interation."
      },
      "min_first_event_date": {
        "type": "string",
        "description": "Only returns persons with the first_event above the given value. This would be used with max interation."
      },
      "min_next_event_date": {
        "type": "string",
        "description": "Only returns persons with the next_event above the given value. This would be used with max interation."
      },
      "max_first_email_date": {
        "type": "string",
        "description": "Only returns persons with the first_email below the given value. This would be used with min interation."
      },
      "max_last_email_date": {
        "type": "string",
        "description": "Only returns persons with the last_email below the given value. This would be used with min interation."
      },
      "max_last_interaction_date": {
        "type": "string",
        "description": "Only returns persons with the last_interaction below the given value. This would be used with min interation."
      },
      "max_last_event_date": {
        "type": "string",
        "description": "Only returns persons with the last_event below the given value. This would be used with min interation."
      },
      "max_first_event_date": {
        "type": "string",
        "description": "Only returns persons with the first_event below the given value. This would be used with min interation."
      },
      "max_next_event_date": {
        "type": "string",
        "description": "Only returns persons with the next_event below the given value. This would be used with min interation."
      },
      "page_size": {
        "type": "string",
        "description": "How many results to return per page. (Default is the maximum value of 500.)"
      },
      "page_token": {
        "type": "string",
        "description": "The next_page_token from the previous response required to retrieve the next page of results."
      }
    },
    "required": [],
    "additionalProperties": false
  }
  ```
</details>

## Output Schema

| Name          | Type     | Required | Default | Description                                    |
| ------------- | -------- | -------- | ------- | ---------------------------------------------- |
| `result.data` | `object` | Yes      |         | Provider response payload.                     |
| `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.",
        "additionalProperties": true
      },
      "meta": {
        "type": "object",
        "description": "Additional response metadata (status, paging).",
        "additionalProperties": true
      }
    },
    "required": [
      "data"
    ],
    "additionalProperties": false
  }
  ```
</details>

## Advanced: Direct CLI

<Info>
  Use direct execution for single payload debugging.
</Info>

```bash theme={null}
deepline tools execute affinity_get_persons --payload '{}' --json
```

### CLI flags

| Flag                        | Description                                         |
| --------------------------- | --------------------------------------------------- |
| `--json`                    | Print machine-readable output.                      |
| `--wait`                    | Wait for terminal provider status when supported.   |
| `--debug`                   | Enable wait mode with additional status/log output. |
| `--wait-timeout SECONDS`    | Max seconds to wait in wait mode.                   |
| `--poll-interval SECONDS`   | Polling interval in seconds during wait mode.       |
| `--timeout SECONDS`         | Request timeout in seconds.                         |
| `--connect-timeout SECONDS` | Connection timeout in seconds.                      |

## Cost

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