> ## 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: Post Contacts Merge

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

Merge Contacts.

<Info>
  Tool ID: `lemlist_post_contacts_merge`
</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_post_contacts_merge',
  {
    "primaryId": "primary_123",
    "secondaryIds": [
      "secondary_123"
    ]
  },
);

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

### CLI

```bash theme={null}
deepline tools execute lemlist_post_contacts_merge --input '{
  "primaryId": "primary_123",
  "secondaryIds": [
    "secondary_123"
  ]
}' --json
```

## Example response

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

```json theme={null}
{
  "data": {
    "success": true,
    "primaryId": "primary_123",
    "merged": true,
    "mergedIds": [
      "merged_123"
    ],
    "remainingIds": [
      "remaining_123"
    ]
  }
}
```

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

## Input reference

Merges up to 10 lemlist contacts into one. The survivor (`primaryId`) keeps its id and every value it holds; its empty fields are filled from the other contacts, which are then deleted. Everything attached to a deleted contact (leads in campaigns, activities, tasks, list memberships, inbox conversations) is moved to the survivor. When a CRM is connected, the survivor keeps its CRM link (or adopts the first linked record's when it has none) and receives the merged values there; lemlist never merges or deletes anything in the CRM itself, so the other records' CRM entries stay in the CRM, unlinked from lemlist — merge them CRM-side too, or a CRM import may recreate the duplicate. The contacts are folded into the survivor one at a time and the run **stops at the first failure**: `mergedIds` lists what went through, `remainingIds` what still exists. A first-fold failure returns an error See the live schema below for the complete notes.

| Name | Type | Required | Default | Details |
| - | - | - | - | - |
| `payload.primaryId` | `string` | Yes | — | The surviving contact. A lemlist contact id (`ctc_xxx`) or one of the contact's email addresses. |
| `payload.secondaryIds` | `array` | Yes | — | The contacts folded into the survivor then deleted, 9 at most. A lemlist contact id (`ctc_xxx`) or one of the contact's email addresses. Must not contain `primaryId`, and each contact is listed once. Minimum items: 1. Maximum items: 9. |

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

  ### Input JSON Schema

  ```json theme={null}
  {
    "type": "object",
    "description": "Merges up to 10 lemlist contacts into one. The survivor (`primaryId`) keeps its id and every value it holds; its empty fields are filled from the other contacts, which are then deleted. Everything attached to a deleted contact (leads in campaigns, activities, tasks, list memberships, inbox conversations) is moved to the survivor. When a CRM is connected, the survivor keeps its CRM link (or adopts the first linked record's when it has none) and receives the merged values there; lemlist never merges or deletes anything in the CRM itself, so the other records' CRM entries stay in the CRM, unlinked from lemlist — merge them CRM-side too, or a CRM import may recreate the duplicate. The contacts are folded into the survivor one at a time and the run **stops at the first failure**: `mergedIds` lists what went through, `remainingIds` what still exists. A first-fold failure returns an error instead — nothing was written. **Email addresses:** the survivor keeps its own; a loser's addresses are dropped, unless the survivor has none (then it takes the first loser's). **No undo:** deleted contacts are gone.",
    "properties": {
      "primaryId": {
        "type": "string",
        "description": "The surviving contact. A lemlist contact id (`ctc_xxx`) or one of the contact's email addresses."
      },
      "secondaryIds": {
        "type": "array",
        "description": "The contacts folded into the survivor then deleted, 9 at most. A lemlist contact id (`ctc_xxx`) or one of the contact's email addresses. Must not contain `primaryId`, and each contact is listed once.",
        "minItems": 1,
        "maxItems": 9,
        "items": {
          "type": "string"
        }
      }
    },
    "required": [
      "primaryId",
      "secondaryIds"
    ],
    "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` | Yes | — | — |
| `result.data.primaryId` | `string` | Yes | — | ID of the surviving lemlist contact — resolved from the email when one was given. |
| `result.data.merged` | `boolean` | Yes | — | `true` once at least one contact was folded into the survivor. |
| `result.data.mergedIds` | `array` | Yes | — | IDs of the contacts folded into the survivor and deleted, in fold order. |
| `result.data.remainingIds` | `array` | Yes | — | IDs of the contacts NOT merged because an earlier fold failed. Empty when everything went through. |
| `result.data.rejectedFields` | `array` | No | — | Fields whose adopted value was refused by a uniqueness rule (kept survivor-side). Only present when it happened. |
| `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"
          },
          "primaryId": {
            "type": "string",
            "description": "ID of the surviving lemlist contact — resolved from the email when one was given."
          },
          "merged": {
            "type": "boolean",
            "description": "`true` once at least one contact was folded into the survivor."
          },
          "mergedIds": {
            "type": "array",
            "description": "IDs of the contacts folded into the survivor and deleted, in fold order.",
            "items": {
              "type": "string"
            }
          },
          "remainingIds": {
            "type": "array",
            "description": "IDs of the contacts NOT merged because an earlier fold failed. Empty when everything went through.",
            "items": {
              "type": "string"
            }
          },
          "rejectedFields": {
            "type": "array",
            "description": "Fields whose adopted value was refused by a uniqueness rule (kept survivor-side). Only present when it happened.",
            "items": {
              "type": "string"
            }
          }
        },
        "required": [
          "success",
          "primaryId",
          "merged",
          "mergedIds",
          "remainingIds"
        ],
        "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

* [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.