# merge_contacts

**Merge contacts that are one person**

Users with access to a group · destructive

Merges pairs of contacts in a directory that are the same person, up to 500 pairs a call, like the possible_duplicates [`import_contacts`](https://withopenbook.com/docs/tools/import_contacts) reports or [`search_contacts`](https://withopenbook.com/docs/tools/search_contacts) duplicates lists: keep takes each value of other’s it doesn’t have (both emails when they differ), its groups and its notes, then other goes to Recently Deleted (30 days), where the merge can be undone. Needs edit access on keep, delete access on other and add access on other’s groups. Show the user each pair and merge only the ones they say are one person; one that can’t be merged refuses the whole call, naming it.

## Parameters

| Parameter | Type | Required | Limits |
|---|---|---|---|
| `pairs` | `{ keep: string, other: string }[]` | required | at least 1, up to 500 |

## Who can use it

Users get it once they have access to a group, and each call is checked against that access. A person’s tool list only includes it when they can use it, and clients like ChatGPT see the same list.

Annotated **destructive**, so clients like ChatGPT ask the person before calling it.

## Errors

Errors carry a stable code and a message written for people. See [errors and their status codes](https://withopenbook.com/docs/api#errors).

HTTP:

```bash
curl https://api.withopenbook.com/v1/actions/merge_contacts \
  -H "Authorization: Bearer $OPENBOOK_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
  "pairs": [
    {
      "keep": "5e8b2d4f-7a1c-4e9b-8d3f-6c2a9e1b4d70",
      "other": "3d9a6f2c-8b4e-4c1a-9f7d-6e2b8a5c1f40"
    }
  ]
}'
```

MCP:

```json
{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "tools/call",
  "params": {
    "name": "merge_contacts",
    "arguments": {
      "pairs": [
        {
          "keep": "5e8b2d4f-7a1c-4e9b-8d3f-6c2a9e1b4d70",
          "other": "3d9a6f2c-8b4e-4c1a-9f7d-6e2b8a5c1f40"
        }
      ]
    }
  }
}
```

> IDs are made up. Get real ones from `my_access` and `search_contacts`, and send the person’s own OAuth token.
