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

# Lemlist: Get Contacts

> Get Many Contacts. Lemlist Get Contacts reference includes SDK V2 and CLI requests, input constraints, response fields, and Deepline cost.

Get Many Contacts.

<Info>
  Tool ID: `lemlist_get_contacts`
</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(
  'lemlist_get_contacts',
  {
    "idsOrEmails": "jane.doe@example.com",
    "crmIds": "crm_123",
    "search": "software companies hiring engineers"
  },
);

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

### CLI

```bash theme={null}
deepline tools execute lemlist_get_contacts --input '{
  "idsOrEmails": "jane.doe@example.com",
  "crmIds": "crm_123",
  "search": "software companies hiring engineers"
}' --json
```

## Example response

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

```json theme={null}
{
  "data": [
    {
      "_id": "_123",
      "teamId": "team_123",
      "fullName": "Example"
    }
  ]
}
```

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

## Input reference

Retrieves contacts by IDs/emails or by CRM record ids, or searches/lists contacts by name, email, contact list, campaign membership, or company link. When using `idsOrEmails`, returns an array of matching contacts directly. When using `crmIds`, looks the contacts up by their record id in the connected CRM (HubSpot, Salesforce, or Pipedrive) and returns an array of the contacts found, each with the matched id under `crmSync.crmRecordId`. `idsOrEmails` takes precedence over `crmIds`; a lookup ignores the search filters and the pagination. When using `search`, `email`, `listId`, `notInAnyCampaign`, any of the `company*` filters, or no filter at all, returns a paginated response with `data`, `total`, `limit`, and `offset` fields. You can combine filters together to narrow results (e.g. `listId` with `search`, or `notInAnyCampaign` with `companyId`). Calling the endpoint without any filter See the live schema below for the complete notes.

| Name | Type | Required | Default | Details |
| - | - | - | - | - |
| `payload.idsOrEmails` | `string` | No | — | A comma separated string of either valid contact IDs (MongoDB ObjectId) or valid email addresses. Optional — when omitted, returns the paginated list of all contacts of the team. Maximum 100 values. |
| `payload.crmIds` | `string` | No | — | Comma-separated record ids of contacts in the CRM connected to the team (HubSpot, Salesforce, or Pipedrive); for Salesforce, the 18-character Contact or Lead id. Returns an array of the contacts found, each with the matched id under `crmSync.crmRecordId`; ids that match nothing are skipped, and the array is empty when no CRM is connected. Duplicates are removed; an empty value is ignored. Maximum 100 values (`TOO_MANY_CRM_IDS`); a value over 25 characters answers `INVALID_CRM_ID`. Ignored when See the live schema for the complete constraint. |
| `payload.search` | `string` | No | — | Search contacts by name or other text fields. Must be at least 2 characters. |
| `payload.email` | `string` | No | — | Search contacts by exact email address. Format: `email`. |
| `payload.listId` | `string` | No | — | Filter contacts by contact list ID (`clt_xxx` format). Can be combined with `search` or `email`, or used alone to list all contacts in a list. Get valid IDs from `GET /contacts/lists`. Pattern: `^clt_[a-zA-Z0-9]+$`. |
| `payload.notInAnyCampaign` | `boolean` | No | — | When set to `true`, only returns contacts that are not part of any campaign (orphan contacts). Can be used alone or combined with other filters such as `search`, `email`, or `listId`. |
| `payload.companyId` | `string` | No | — | Filter contacts by attached company ID (`cpn_xxx` format). Use this when you already know the lemlist company id (for example after fetching `GET /companies?crmSyncStatus=unique_index_error_company`). Mutually exclusive with `companyDomain`, `companyLinkedinUrl`, and `companySalesnavUrl`. Pattern: `^cpn_[a-zA-Z0-9]+$`. |
| `payload.companyDomain` | `string` | No | — | Filter contacts by their company's website domain. Resolved to a `companyId` against the Companies collection. If no company matches, the endpoint returns an empty list (`total: 0`). Mutually exclusive with the other `company*` filters. |
| `payload.companyLinkedinUrl` | `string` | No | — | Filter contacts by their company's LinkedIn URL. Resolved to a `companyId` against the Companies collection. If no company matches, the endpoint returns an empty list (`total: 0`). Mutually exclusive with the other `company*` filters. |
| `payload.companySalesnavUrl` | `string` | No | — | Filter contacts by their company's LinkedIn Sales Navigator URL. Resolved to a `companyId` against the Companies collection. If no company matches, the endpoint returns an empty list (`total: 0`). Mutually exclusive with the other `company*` filters. |
| `payload.withPrimaryCompany` | `boolean` | No | — | When set to `true`, only returns contacts linked to a company; when set to `false`, only returns contacts without a company. Omit for no filter. Mutually exclusive with the `company*` filters (`companyId`, `companyDomain`, `companyLinkedinUrl`, `companySalesnavUrl`). |
| `payload.fieldRejectionReason` | `"enrichment_duplicate_linkedin_url" \| "enrichment_duplicate_linkedin_url_sales_nav" \| "enrichment_duplicate_email" \| "crm_sync_duplicate_linkedin_url" \| "crm_sync_duplicate_linkedin_url_sales_nav" \| "crm_sync_invalid_linkedin_url" \| "crm_sync_invalid_url" \| "crm_sync_invalid_email" \| "crm_sync_invalid_phone" \| "crm_sync_linkedin_url_not_contact" \| "crm_sync_duplicate_contact_blocked" \| "crm_sync_duplicate_company_blocked" \| "crm_sync_company_data_rejected" \| "crm_sync_unsub_state_protected" \| "crm_sync_value_oscillating" \| "crm_sync_owner_sync_loop" \| "crm_sync_unmapped_user" \| "crm_sync_value_incompatible" \| "crm_sync_unknown_error"` | No | — | Filter contacts to those carrying a field rejection with this reason — a value lemlist refused to write, prefixed by its origin (`enrichment_*` while enriching, `crm_sync_*` during CRM sync). Returns an empty list (`total: 0`) when no contact matches. Each returned contact exposes the full detail under `fieldRejections[]` (which field, why, and `conflictingRecordId` for duplicates). Only applies to the paginated list — ignored when `idsOrEmails` is provided (that path returns the exact contacts See the live schema for the complete constraint. |
| `payload.limit` | `integer` | No | `100` | Maximum number of contacts to return (1–500). Defaults to 100. Minimum: 1. Maximum: 500. |
| `payload.offset` | `integer` | No | `0` | Number of contacts to skip for pagination. Defaults to 0. Minimum: 0. |

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

  ### Input JSON Schema

  ```json theme={null}
  {
    "type": "object",
    "description": "Retrieves contacts by IDs/emails or by CRM record ids, or searches/lists contacts by name, email, contact list, campaign membership, or company link. When using `idsOrEmails`, returns an array of matching contacts directly. When using `crmIds`, looks the contacts up by their record id in the connected CRM (HubSpot, Salesforce, or Pipedrive) and returns an array of the contacts found, each with the matched id under `crmSync.crmRecordId`. `idsOrEmails` takes precedence over `crmIds`; a lookup ignores the search filters and the pagination. When using `search`, `email`, `listId`, `notInAnyCampaign`, any of the `company*` filters, or no filter at all, returns a paginated response with `data`, `total`, `limit`, and `offset` fields. You can combine filters together to narrow results (e.g. `listId` with `search`, or `notInAnyCampaign` with `companyId`). Calling the endpoint without any filter returns all contacts of the team, paginated. A lookup returns full contacts (`Contact`); the list returns `ContactListItem` objects. The `company*` filters (`companyId`, `companyDomain`, `companyLinkedinUrl`, `companySalesnavUrl`) are mutually exclusive: use only one at a time. `companyDomain` / `companyLinkedinUrl` / `companySalesnavUrl` are resolved to a `companyId` through the Companies collection; if no matching company exists, the endpoint returns an empty list with `total: 0` (not an error), which keeps automation flows simple.",
    "properties": {
      "idsOrEmails": {
        "type": "string",
        "description": "A comma separated string of either valid contact IDs (MongoDB ObjectId) or valid email addresses. Optional — when omitted, returns the paginated list of all contacts of the team. Maximum 100 values."
      },
      "crmIds": {
        "type": "string",
        "description": "Comma-separated record ids of contacts in the CRM connected to the team (HubSpot, Salesforce, or Pipedrive); for Salesforce, the 18-character Contact or Lead id. Returns an array of the contacts found, each with the matched id under `crmSync.crmRecordId`; ids that match nothing are skipped, and the array is empty when no CRM is connected. Duplicates are removed; an empty value is ignored. Maximum 100 values (`TOO_MANY_CRM_IDS`); a value over 25 characters answers `INVALID_CRM_ID`. Ignored when `idsOrEmails` is provided."
      },
      "search": {
        "type": "string",
        "description": "Search contacts by name or other text fields. Must be at least 2 characters."
      },
      "email": {
        "type": "string",
        "description": "Search contacts by exact email address.",
        "format": "email"
      },
      "listId": {
        "type": "string",
        "description": "Filter contacts by contact list ID (`clt_xxx` format). Can be combined with `search` or `email`, or used alone to list all contacts in a list. Get valid IDs from `GET /contacts/lists`.",
        "pattern": "^clt_[a-zA-Z0-9]+$"
      },
      "notInAnyCampaign": {
        "type": "boolean",
        "description": "When set to `true`, only returns contacts that are not part of any campaign (orphan contacts). Can be used alone or combined with other filters such as `search`, `email`, or `listId`."
      },
      "companyId": {
        "type": "string",
        "description": "Filter contacts by attached company ID (`cpn_xxx` format). Use this when you already know the lemlist company id (for example after fetching `GET /companies?crmSyncStatus=unique_index_error_company`). Mutually exclusive with `companyDomain`, `companyLinkedinUrl`, and `companySalesnavUrl`.",
        "pattern": "^cpn_[a-zA-Z0-9]+$"
      },
      "companyDomain": {
        "type": "string",
        "description": "Filter contacts by their company's website domain. Resolved to a `companyId` against the Companies collection. If no company matches, the endpoint returns an empty list (`total: 0`). Mutually exclusive with the other `company*` filters."
      },
      "companyLinkedinUrl": {
        "type": "string",
        "description": "Filter contacts by their company's LinkedIn URL. Resolved to a `companyId` against the Companies collection. If no company matches, the endpoint returns an empty list (`total: 0`). Mutually exclusive with the other `company*` filters."
      },
      "companySalesnavUrl": {
        "type": "string",
        "description": "Filter contacts by their company's LinkedIn Sales Navigator URL. Resolved to a `companyId` against the Companies collection. If no company matches, the endpoint returns an empty list (`total: 0`). Mutually exclusive with the other `company*` filters."
      },
      "withPrimaryCompany": {
        "type": "boolean",
        "description": "When set to `true`, only returns contacts linked to a company; when set to `false`, only returns contacts without a company. Omit for no filter. Mutually exclusive with the `company*` filters (`companyId`, `companyDomain`, `companyLinkedinUrl`, `companySalesnavUrl`)."
      },
      "fieldRejectionReason": {
        "type": "string",
        "description": "Filter contacts to those carrying a field rejection with this reason — a value lemlist refused to write, prefixed by its origin (`enrichment_*` while enriching, `crm_sync_*` during CRM sync). Returns an empty list (`total: 0`) when no contact matches. Each returned contact exposes the full detail under `fieldRejections[]` (which field, why, and `conflictingRecordId` for duplicates). Only applies to the paginated list — ignored when `idsOrEmails` is provided (that path returns the exact contacts requested, unfiltered).",
        "enum": [
          "enrichment_duplicate_linkedin_url",
          "enrichment_duplicate_linkedin_url_sales_nav",
          "enrichment_duplicate_email",
          "crm_sync_duplicate_linkedin_url",
          "crm_sync_duplicate_linkedin_url_sales_nav",
          "crm_sync_invalid_linkedin_url",
          "crm_sync_invalid_url",
          "crm_sync_invalid_email",
          "crm_sync_invalid_phone",
          "crm_sync_linkedin_url_not_contact",
          "crm_sync_duplicate_contact_blocked",
          "crm_sync_duplicate_company_blocked",
          "crm_sync_company_data_rejected",
          "crm_sync_unsub_state_protected",
          "crm_sync_value_oscillating",
          "crm_sync_owner_sync_loop",
          "crm_sync_unmapped_user",
          "crm_sync_value_incompatible",
          "crm_sync_unknown_error"
        ]
      },
      "limit": {
        "type": "integer",
        "description": "Maximum number of contacts to return (1–500). Defaults to 100.",
        "default": 100,
        "minimum": 1,
        "maximum": 500
      },
      "offset": {
        "type": "integer",
        "description": "Number of contacts to skip for pagination. Defaults to 0.",
        "default": 0,
        "minimum": 0
      }
    },
    "required": [],
    "additionalProperties": false
  }
  ```
</details>

## Output reference

Standard tool result payload.

| Name | Type | Required | Default | Details |
| - | - | - | - | - |
| `result.data` | `array \| object` | Yes | — | Provider response payload. |
| `result.data.data` | `array` | Yes | — | — |
| `result.data.data[]._id` | `string` | No | — | Unique contact identifier |
| `result.data.data[].teamId` | `string` | No | — | Team identifier the contact belongs to |
| `result.data.data[].fullName` | `string` | No | — | Contact's calculated full name |
| `result.data.data[].email` | `string` | No | — | Contact's primary email address |
| `result.data.data[].firstName` | `string` | No | — | Contact's first name |
| `result.data.data[].lastName` | `string` | No | — | Contact's last name |
| `result.data.data[].phone` | `string` | No | — | Contact's phone number |
| `result.data.data[].jobTitle` | `string` | No | — | Contact's job title |
| `result.data.data[].linkedinUrl` | `string` | No | — | Contact's LinkedIn profile URL |
| `result.data.data[].linkedinUrlSalesNav` | `string` | No | — | Contact's LinkedIn Sales Navigator URL |
| `result.data.data[].ownerId` | `string` | No | — | ID of the user who owns this contact |
| `result.data.data[].companyId` | `string` | No | — | ID of the company the contact is attached to (`cpn_xxx`) |
| `result.data.data[].createdAt` | `string` | No | — | Contact creation timestamp |
| `result.data.data[].createdBy` | `string` | No | — | ID of the user who created the contact |
| `result.data.data[].unsubscribed` | `boolean` | No | — | Whether the contact is globally unsubscribed. When true, no outreach will be sent to this contact. |
| `result.data.data[].campaignCount` | `integer` | No | — | Number of campaigns the contact is in |
| `result.data.data[].fieldRejections` | `array` | No | — | Values lemlist refused to write on this contact, each with its reason. Empty when none. Filter the list endpoint to only flagged contacts via `GET /contacts?fieldRejectionReason=...`. |
| `result.data.data[].fieldRejections[].field` | `string` | No | — | The record field the rejected value targeted (e.g. `emails`, `linkedinUrl`, `domain`). |
| `result.data.data[].fieldRejections[].reason` | `string` | No | — | Why the value was rejected, prefixed by its origin — `enrichment_*` (raised while enriching) or `crm_sync_*` (raised during CRM sync). Same values accepted by the `fieldRejectionReason` query param. |
| `result.data.data[].fieldRejections[].source` | `string` | No | — | Where the rejection came from — an enrichment source (`lemrich`) or a CRM provider (`hubspot`, `salesforce`, `pipedrive`). |
| `result.data.data[].fieldRejections[].conflictingRecordId` | `string` | No | — | The lemlist record that already holds the value, when the rejection identifies one — use it to merge or remap before resolving the duplicate. Always a lemlist id (`ctc_…` for a contact, `cpn_…` for a company), never a CRM record id. Omitted otherwise. |
| `result.data.data[].fieldRejections[].rejectedValue` | `string` | No | — | The value that was refused. |
| `result.data.data[].fieldRejections[].rejectedAt` | `string` | No | — | When the rejection was recorded. |
| `result.data.total` | `integer` | Yes | — | — |
| `result.data.limit` | `integer` | Yes | — | — |
| `result.data.offset` | `integer` | Yes | — | — |
| `result.meta` | `object` | No | — | Additional response metadata (status, paging). |

<Info>
  This output schema is too large to embed without slowing the page. Get the complete live contract with `deepline tools get lemlist_get_contacts --json`.
</Info>

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

* [Lemlist provider guide](/docs/providers/lemlist/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)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.