> ## 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 up to 10 duplicate Lemlist contacts into one. Includes SDK V2 guidance, input constraints, response fields, and Deepline credit cost.

Merge up to 10 duplicate Lemlist contacts into one.

> [!NOTE]
>
> Tool ID: `lemlist_post_contacts_merge`

## Run this action

Use the TypeScript SDK for one call. Use `ctx.tools.execute(...)` inside a Play for durable calls, scheduled calls, or CSV processing.

```ts theme={"languages":{"custom":["/languages/deepline-prompt.json"]}}
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={"languages":{"custom":["/languages/deepline-prompt.json"]}}
deepline tools execute lemlist_post_contacts_merge --input '{
  "primaryId": "primary_123",
  "secondaryIds": [
    "secondary_123"
  ]
}' --json
```

## Example response

The SDK returns this shape at `result.toolResponse.raw`. The example values illustrate the response.

```json theme={"languages":{"custom":["/languages/deepline-prompt.json"]}}
{
  "data": {
    "success": true,
    "primaryId": "primary_123",
    "merged": true,
    "mergedIds": [
      "merged_123"
    ],
    "remainingIds": [
      "remaining_123"
    ]
  }
}
```

Use `deepline describe 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={"languages":{"custom":["/languages/deepline-prompt.json"]}}
  {
    "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={"languages":{"custom":["/languages/deepline-prompt.json"]}}
  {
    "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](https://deepline.com/docs/providers/lemlist/guide.md)
* [SDK V2 quickstart](https://deepline.com/docs/sdk-v2/quickstart.md)
* [SDK reference](https://deepline.com/docs/sdk-v2/sdk-reference.md)
* [Run tools across a CSV](https://deepline.com/docs/sdk-v2/batch-csv.md)


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