---
title: "Avoid and clean up duplicate contacts"
description: "How Gleap merges contacts that are the same person, how to merge earlier chats and emails when people log in, and what to do with the rest."
url: https://help.gleap.ai/fr/articles/16751964-avoid-and-clean-up-duplicate-contacts
collection: "Contacts and pipelines"
updated: 2026-11-16
language: fr
alternates: [en]
---

# Avoid and clean up duplicate contacts

How Gleap merges contacts that are the same person, how to merge earlier chats and emails when people log in, and what to do with the rest.

A duplicate contact is one person who shows up twice in **Contacts**, for example once as an anonymous guest and once as a logged-in user, or once from an email and once from your app. Gleap merges these cases for you when it can tell for sure that both are the same person. Two contacts that each have their own user ID are never merged into each other.

### What Gleap merges

<table style="min-width: 50px;"><colgroup><col style="min-width: 25px;"><col style="min-width: 25px;"></colgroup><tbody><tr><th colspan="1" rowspan="1"><p>Situation</p></th><th colspan="1" rowspan="1"><p>What happens</p></th></tr><tr><td colspan="1" rowspan="1"><p>A visitor chats, then logs in on the same device</p></td><td colspan="1" rowspan="1"><p>Your app calls <code>identify</code>, and Gleap merges the guest into the contact with that user ID. Always on.</p></td></tr><tr><td colspan="1" rowspan="1"><p>Someone emails your support address, then your server creates them</p></td><td colspan="1" rowspan="1"><p><code>POST /admin/identify</code> (or the REST API) with a new user ID and the same email takes over the contact that only has that email, with its conversations. Always on.</p></td></tr><tr><td colspan="1" rowspan="1"><p>Someone chats or emails first, then logs in to your app</p></td><td colspan="1" rowspan="1"><p>With <strong>Merge contacts by email</strong> switched on and a signed email in the login (see below), contacts without a user ID join the user if their email is proven: they emailed your support address, your server created them, or they confirmed the email with a code.</p></td></tr><tr><td colspan="1" rowspan="1"><p>A visitor confirms their email with a code in the chat</p></td><td colspan="1" rowspan="1"><p>The <strong>Verify email</strong> workflow step moves the conversation to the user with that email, if your server or a signed login proved that email. See <a target="_self" rel="noopener noreferrer nofollow" class="linktype-link link" data-linktype="link" href="https://help.gleap.ai/en/articles/16751992-confirm-a-customers-email-in-the-chat.md">Confirm a customer's email in the chat</a>.</p></td></tr><tr><td colspan="1" rowspan="1"><p>Your server decides</p></td><td colspan="1" rowspan="1"><p><code>POST /admin/contacts/merge</code> merges a contact without a user ID into a user.</p></td></tr></tbody></table>

After a merge:

-   The conversations, messages and survey responses belong to the user.
    
-   On the same device, custom data from both is combined (where both have a value, the user's value wins), visit and feedback counts are added together, and outbound history moves across, so the person doesn't get the same message twice.
    
-   In the other cases, details the user doesn't have yet, such as the company or custom data, come along from contacts your server or an email created. A website visitor brings its conversations only, unless your server merges it with the merge endpoint.
    

The merge can't be undone.

> **Info:** A merge by email always needs proof that the email belongs to the user it merges into: your server, a signed login or a code. An email someone only sent from your app without proof never pulls other contacts in, otherwise anyone could take over another person's conversations.

### Merge earlier contacts when people log in

1.  Go to **Settings → Security → Customer identity**. Signed sessions need to be on.
    
2.  Under **More settings**, switch on **Merge contacts by email**.
    
3.  Have your server put the user's email into the identity token your app passes to `setUserJwt` (see [Identify users and send attributes and events](https://help.gleap.ai/en/articles/230-identify-users-and-send-attributes-and-events.md)).
    

From then on, when a user logs in with a signed email, contacts without a user ID that have the same email join them, once per user and email, but only if that email is proven. That means the contact came from an email sent to your support address, your server created it, or it confirmed the email with a code. A guest who only typed the email in the chat is never merged, and neither is an email contact whose inbound email failed SPF or DMARC. If another contact with its own user ID has the same email, Gleap can't tell who the earlier contacts belong to and merges nothing.

> **Warning:** Only sign emails your system has confirmed, for example through a sign-up confirmation or single sign-on. Signing an address means you vouch that it belongs to this user.

### Merge from your server

Your backend can merge contacts directly, for example after a user confirmed their email in your own product:

```bash
curl -X POST https://api.gleap.io/admin/contacts/merge \
  -H "Api-Token: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "into": { "userId": "user-123" }, "from": { "email": "user@example.com" } }'
```

`from.email` merges every contact without a user ID that has this email, `from.id` one contact by its Gleap ID. Create the API key under **Settings → Developer → API keys**. The [developer docs](https://docs.gleap.ai/en/articles/708-rest) list the details.

### Prevent duplicates

1.  Call `identify` as soon as a user logs in, with the same user ID your app uses everywhere.
    
2.  Always send the email address with it.
    
3.  Use one user ID per person across web and mobile apps.
    
4.  If your server knows your users, create them with `POST /admin/identify` before they first log in.
    

Imports and changelog sign-ups reuse an existing contact with the same email address, so they don't add duplicates.

```javascript
Gleap.identify("user-123", {
  email: "user@example.com",
  name: "Ada Lovelace",
});
```

When contacts share an email address, Gleap still shows their conversations together: a contact's conversation list includes tickets from the other contacts with the same address, marked **duplicate contact**.

### Clean up an existing duplicate

There's no merge button in the dashboard. Use the merge endpoint above for contacts without a user ID. Two contacts that each have a user ID can't be merged; delete the one you don't need.

1.  Go to **Contacts** and open the contact you want to remove.
    
2.  Check its conversations. If one is about the same thing as a conversation on the contact you keep, open that ticket and choose **Merge with similar** to bring both conversations together first. The **Merge ticket** dialog shows which contacts are added to the remaining ticket, and every one of them can then see all its messages.
    
3.  In the contact's menu, choose **Export contact data** if you want a copy.
    
4.  Choose **Delete contact** and confirm.
    

![Customer identity settings with identity keys and Require a signature in a demo project.](https://staticfiles.gleap.io/p613b5dd730aed737108f87ab/EfJhN8YPpE4TxaewwNKn7MTX73vw4twOZOFpIa1mZzpVA4LjIONvx3SLElW2mVEmtzOLyeilero.png)

> **Warning:** **Delete contact** removes the contact and all associated tickets. It doesn't move anything to the other contact.

Companies can't be merged. Send the same company ID for everyone at a company, so new people always join the one you keep.

### Related

-   [Identify users and send attributes and events](https://help.gleap.ai/en/articles/230-identify-users-and-send-attributes-and-events.md)
    
-   [Confirm a customer's email in the chat](https://help.gleap.ai/en/articles/16751992-confirm-a-customers-email-in-the-chat.md)
    
-   [Group contacts into companies](https://help.gleap.ai/en/articles/343-group-contacts-into-companies.md)
    
-   [Merge two conversations: which one stays](https://help.gleap.ai/en/articles/16751959-merge-two-conversations-which-one-stays.md)
