---
title: "customerMerge"
description: "Merges two customers."
doc_type: graphql
doc_category: adminGraphQL
doc_version: v20270301
source_url:
  html: 'https://developer.shopline.com/docs/admin-graph-ql-api/customers/mutations/customer-merge'
  md: 'https://developer.shopline.com/docs/admin-graph-ql-api/customers/mutations/customer-merge.md'
---
# customerMerge

Merges two customers.

- **Required Scopes:** `write_customers`
- **API Version:** v20270301
- **API Type:** Admin
- **API Protocol:** GraphQL
- **Operation Type:** Mutation

## Type Signature

`CustomerMergePayload`

## Required Permissions

* `write_customers`

An access token is required to call this API. Refer to [Authorization](https://developer.shopline.com/docs/apps/api-instructions-for-use/graph-ql-admin-api/overview.md) for more information about how to obtain the token.

## Arguments

* `customerOneId`

  [ID!](https://developer.shopline.com/docs/admin-graph-ql-api/common/scalars/id.md)

  The ID of the first customer to be merged

* `customerTwoId`

  [ID!](https://developer.shopline.com/docs/admin-graph-ql-api/common/scalars/id.md)

  The ID of the second customer to be merged

* `overrideFields`

  [CustomerMergeOverrideFieldsInput](https://developer.shopline.com/docs/admin-graph-ql-api/customers/inputs/customer-merge-override-fields-input.md)

  The fields to override the default customer merge rules.

## Returns

* `resultingCustomerId`

  [ID](https://developer.shopline.com/docs/admin-graph-ql-api/common/scalars/id.md)

  Customer ID retained after customer merge

* `userErrors`

  [[CustomerMergeUserError]](https://developer.shopline.com/docs/admin-graph-ql-api/customers/objects/customer-merge-user-error.md)

  List of errors that occurred while performing mutation

## Code Example

```graphql
mutation customerMerge($customerOneId: ID! $customerTwoId: ID! $overrideFields: CustomerMergeOverrideFieldsInput ) {
	customerMerge(customerOneId: $customerOneId, customerTwoId: $customerTwoId, overrideFields: $overrideFields ) 
		 {
			# CustomerMergePayload fields
		}
		
	}

```

## Variables

```json
{
  "customerOneId": {},
  "customerTwoId": {},
  "overrideFields": {
    "customerIdOfDefaultAddressToKeep": "",
    "customerIdOfEmailToKeep": "",
    "customerIdOfFirstNameToKeep": "",
    "customerIdOfLastNameToKeep": "",
    "customerIdOfPhoneNumberToKeep": {},
    "note": "",
    "tags": {}
  }
}
```

## Error Handling

For detailed information about common codes, see [Status and error codes](https://developer.shopline.com/docs/apps/api-instructions-for-use/graph-ql-admin-api/overview.md#status-and-error-codes).

