> For the complete documentation index, see [llms.txt](https://docs.holder.xyz/holder-api/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.holder.xyz/holder-api/contacts/merging-contacts.md).

# Merging Contacts

### Endpoint

`PATCH /contacts/merge`

### Description

Merges a list of contacts into a single contact. All contacts must be connected to the current account. All contact info (i.e. id, wallet(s), tags, discord, email, phone number, etc...) will be merged.

Conflicting information (ex: id, conflicting email addresses, etc...) will be solved by overwriting the contact of lower priority with the contact info of higher priority. Priority is assigned by the order in which the contacts are provided in the `contactIds` parameter, with contacts of higher priority coming first.

### Parameters

| Parameter  | Type                     | Description                                       |
| ---------- | ------------------------ | ------------------------------------------------- |
| contactIds | `array` of type `string` | List of at least two ids of contacts to be merged |

* **Note**: The priority of a contact is determined by the order of the contact ids, with higher priority contacts coming first.

### Returns

<table><thead><tr><th width="144">Status Code</th><th>Description</th></tr></thead><tbody><tr><td>200</td><td>Contacts successfully merged</td></tr><tr><td>400</td><td><code>contactIds</code> is not an array of at least 2 strings</td></tr><tr><td>404</td><td>One of the provided contact ids is invalid and/or doesn't belong to the current account</td></tr></tbody></table>

### Examples

Given the following contacts currently exist:

```
{
	id: "0"
	email:  "bob@example.com"
},
{
	id: "1"
	phoneNumber:  "+123445678"
	discordUsername:  "example#0000"
},
{
	id: "2"
	email:  "bill@example.com"
	phoneNumber:  "+18901234"
	discordUsername:  "example2#0001"
}
```

#### Example 1:

```
{
	"contactIds": ["0", "1"]
}
```

Results in the contact:

```
{
	id: "0"
	email:  "bob@example.com"
	phoneNumber  "+12345678"
	discordUsername:  "example#0000"
}
```

#### Example 2:

```
{
	"contactIds": ["0", "1", "2"]
}
```

Results in the contact:

```
{
	id: "0"
	email:  "bob@example.com"
	phoneNumber  "+12345678"
	discordUsername:  "example#0000"
}
```

#### Example 3:

```
{
	"contactIds": ["2", "1", "0"]
}
```

Results in the contact:

```
{
	id: "2"
	email:  "bill@example.com"
	phoneNumber:  "+18901234"
	discordUsername:  "example2#0001"
}
```

#### Example 4:

```
{
	"contactIds": ["1", "0", "2"]
}
```

Results in the contact:

```
{
	id: "1"
	email:  "bob@example.com"
	phoneNumber:  "+12345678"
	discordUsername:  "example#0000"
}
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.holder.xyz/holder-api/contacts/merging-contacts.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
