---
title: "Target contact operations"
slug: "target-contact-operations"
abstract: "Overview of target contact operations used in contact merges."
---
# Target contact operations

xConnect is able to merge multiple contacts into a single contact. The tracker can identify if two contacts are the same visitor and run the `MergeContacts` operation to merge their behavioral data under the single target contact.

![Map of known and unknown contacts to merge using MergeInfo facet data.](https://doc.sitecore.com/api/markdown-image/xp/en/developers/105/sitecore-experience-platform/images/MergeContacts-Chain102plus.png)

xConnect can find and load the target contacts using the `MergeInfo` facet data. This facet contains the target contact identifier, but it requires additional requests to xConnect.

There are two operations for targeting contacts for merges.

<details>
<summary><h2>The GetTargetContact operation</h2></summary>

The xConnect Client API includes the asynchronous operation `GetTargetContactAsync` and the synchronous operation `GetTargetContact`, which allows you to get the target contact even if the source contact ID is specified.

Example:

```csharp
var expandOptions = new ContactExpandOptions(
  AddressList.DefaultFacetKey,
  PersonalInformation.DefaultFacetKey,
  Classification.DefaultFacetKey);

var executionOptions = new ContactExecutionOptions(expandOptions);

var actualContact = await _client.GetTargetContactAsync(sourceContact.Id.Value, executionOptions);
```

</details>

<details>
<summary><h2>The GetDeviceProfileAsync operation</h2></summary>

The `GetDeviceProfileAsync` operation loads the device profile by the specified device profile reference. This operation has options to specify whether to load the last known contact together with the device.

The `DeviceProfileExecutionOptions` class includes the `LoadTargetContact` option, which specifies whether the device profile must load the last known contact by the assigned contact ID or the target contact instead.

```csharp
var expandOptions = new DeviceProfileExpandOptions
{
   ContactExpandOptions = new ContactExpandOptions()
};

var executionOptions = new DeviceProfileExecutionOptions(expandOptions)
{
   LoadTargetContact = loadTargetContact
};

DeviceProfile savedDeviceProfile = await _client.GetDeviceProfileAsync(
   new DeviceProfileReference(deviceProfile.Id.Value), executionOptions);
```

</details>