> ## 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: V2 Person Merges Post

> Initiate Person Merge. Affinity V2 Person Merges Post reference includes SDK V2 and CLI requests, input constraints, response fields, and Deepline cost.

Initiate Person Merge.

<Info>
  Tool ID: `affinity_v2_person_merges_post`
</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(
  'affinity_v2_person_merges_post',
  {
    "primaryPersonId": 123,
    "duplicatePersonId": 123
  },
);

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

### CLI

```bash theme={null}
deepline tools execute affinity_v2_person_merges_post --input '{
  "primaryPersonId": 123,
  "duplicatePersonId": 123
}' --json
```

## Example response

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

```json theme={null}
{
  "data": {
    "taskUrl": "https://example.com/resource"
  }
}
```

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

## Input reference

Request body for initiating a person merge

| Name                          | Type      | Required | Default | Details                                                                                                                                                                                         |
| ----------------------------- | --------- | -------- | ------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `payload.primaryPersonId`     | `integer` | Yes      | —       | The ID of the person profile that will be kept after the merge. All data from the duplicate person will be merged into this person. Format: `int64`. Minimum: 1. Maximum: 9007199254740991.     |
| `payload.duplicatePersonId`   | `integer` | Yes      | —       | The ID of the person profile that will be merged and then deleted. All data from this person will be transferred to the primary person. Format: `int64`. Minimum: 1. Maximum: 9007199254740991. |
| `payload.wait_for_completion` | `boolean` | No       | `true`  | Poll the Affinity merge task before returning. Set false to return the task handle immediately.                                                                                                 |
| `payload.poll_interval_ms`    | `integer` | No       | `1000`  | Milliseconds between merge task status polls. Minimum: 100. Maximum: 10000.                                                                                                                     |
| `payload.max_wait_ms`         | `integer` | No       | `30000` | Maximum synchronous wait before returning a running task handle. Minimum: 1000. Maximum: 30000.                                                                                                 |

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

  ### Input JSON Schema

  ```json theme={null}
  {
    "type": "object",
    "description": "Request body for initiating a person merge",
    "properties": {
      "primaryPersonId": {
        "type": "integer",
        "description": "The ID of the person profile that will be kept after the merge. All data from the duplicate person will be merged into this person.",
        "minimum": 1,
        "maximum": 9007199254740991,
        "format": "int64"
      },
      "duplicatePersonId": {
        "type": "integer",
        "description": "The ID of the person profile that will be merged and then deleted. All data from this person will be transferred to the primary person.",
        "minimum": 1,
        "maximum": 9007199254740991,
        "format": "int64"
      },
      "wait_for_completion": {
        "type": "boolean",
        "description": "Poll the Affinity merge task before returning. Set false to return the task handle immediately.",
        "default": true
      },
      "poll_interval_ms": {
        "type": "integer",
        "description": "Milliseconds between merge task status polls.",
        "default": 1000,
        "minimum": 100,
        "maximum": 10000
      },
      "max_wait_ms": {
        "type": "integer",
        "description": "Maximum synchronous wait before returning a running task handle.",
        "default": 30000,
        "minimum": 1000,
        "maximum": 30000
      }
    },
    "required": [
      "primaryPersonId",
      "duplicatePersonId"
    ],
    "additionalProperties": false
  }
  ```
</details>

## Output reference

| Name                         | Type                                     | Required | Default | Details                                                                 |
| ---------------------------- | ---------------------------------------- | -------- | ------- | ----------------------------------------------------------------------- |
| `result.data`                | `object`                                 | Yes      | —       | —                                                                       |
| `result.data.taskUrl`        | `string`                                 | Yes      | —       | Format: `uri`.                                                          |
| `result.data.taskId`         | `string`                                 | No       | —       | Affinity merge task ID.                                                 |
| `result.data.status`         | `"in-progress" \| "success" \| "failed"` | No       | —       | Current merge task status. Allowed: `in-progress`, `success`, `failed`. |
| `result.data.launcher`       | `record`                                 | No       | —       | Original Affinity merge launch response.                                |
| `result.data.task`           | `record`                                 | No       | —       | Terminal Affinity merge task response.                                  |
| `result.data.latestTask`     | `object \| null`                         | No       | —       | Latest task response observed before the sync wait ended.               |
| `result.data.asyncGetAction` | `string`                                 | No       | —       | Action to poll while the merge remains in progress.                     |
| `result.meta`                | `object`                                 | No       | —       | —                                                                       |

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

  ### Output JSON Schema

  ```json theme={null}
  {
    "type": "object",
    "properties": {
      "data": {
        "type": "object",
        "properties": {
          "taskUrl": {
            "type": "string",
            "format": "uri"
          },
          "taskId": {
            "type": "string",
            "description": "Affinity merge task ID."
          },
          "status": {
            "type": "string",
            "description": "Current merge task status.",
            "enum": [
              "in-progress",
              "success",
              "failed"
            ]
          },
          "launcher": {
            "type": "object",
            "description": "Original Affinity merge launch response.",
            "additionalProperties": true
          },
          "task": {
            "type": "object",
            "description": "Terminal Affinity merge task response.",
            "additionalProperties": true
          },
          "latestTask": {
            "type": [
              "object",
              "null"
            ],
            "description": "Latest task response observed before the sync wait ended.",
            "additionalProperties": true
          },
          "asyncGetAction": {
            "type": "string",
            "description": "Action to poll while the merge remains in progress."
          }
        },
        "required": [
          "taskUrl"
        ],
        "additionalProperties": true
      },
      "meta": {
        "type": "object",
        "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

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