Skip to content
Docs
API 1.0.0 · 22 Nov 2026

Search the docs

    Română

    Find and merge duplicates

    Find the earlier lead that a new lead repeats, merge the two and keep everything written on either.

    On this page

    A company that writes twice makes two leads. They are duplicates while both are open leads of the same company. You keep the older lead, and the newer one is merged into it: the newer is removed, and its activities and tasks move to the older.

    Find the duplicates of a lead

    Ask for the duplicates of the newer lead. The answer lists the earlier leads of the same company, the oldest first. The first is the one to keep.

    curl

    curl "$RDC_BASE_URL/crm/v1/deals/d4a1f7c8-3e90-4b56-a2d1-8c7e0b9f6a44/duplicates?limit=20" \
      -H "Authorization: Bearer $RDC_TOKEN"

    JavaScript

    const response = await fetch(`${process.env.RDC_BASE_URL}/crm/v1/deals/d4a1f7c8-3e90-4b56-a2d1-8c7e0b9f6a44/duplicates?limit=20`, {
      method: 'GET',
      headers: {
        Authorization: `Bearer ${process.env.RDC_TOKEN}`,
      },
    });
    const result = await response.json();

    Python

    import os
    import requests
    
    response = requests.request(
        'GET',
        f'{os.environ["RDC_BASE_URL"]}/crm/v1/deals/d4a1f7c8-3e90-4b56-a2d1-8c7e0b9f6a44/duplicates?limit=20',
        headers={
            'Authorization': f'Bearer {os.environ["RDC_TOKEN"]}',
        },
    )
    result = response.json()

    PHP

    <?php
    
    $curl = curl_init(getenv('RDC_BASE_URL') . '/crm/v1/deals/d4a1f7c8-3e90-4b56-a2d1-8c7e0b9f6a44/duplicates?limit=20');
    curl_setopt_array($curl, [
        CURLOPT_CUSTOMREQUEST => 'GET',
        CURLOPT_RETURNTRANSFER => true,
        CURLOPT_HTTPHEADER => [
            'Authorization: Bearer ' . getenv('RDC_TOKEN'),
        ],
    ]);
    $result = json_decode(curl_exec($curl), true);
    curl_close($curl);

    C#

    using System.Net.Http.Headers;
    
    var client = new HttpClient();
    var request = new HttpRequestMessage(HttpMethod.Get, $"{Environment.GetEnvironmentVariable("RDC_BASE_URL")}/crm/v1/deals/d4a1f7c8-3e90-4b56-a2d1-8c7e0b9f6a44/duplicates?limit=20");
    request.Headers.Authorization = new AuthenticationHeaderValue("Bearer", Environment.GetEnvironmentVariable("RDC_TOKEN"));
    var response = await client.SendAsync(request);
    var result = await response.Content.ReadAsStringAsync();

    Response 200

    {
      "items": [
        {
          "id": "92b6d0f5-1c48-4a3e-8d27-e5f9a4c0b742",
          "number": "DL-1042",
          "companyId": "ffc05e95-9bb4-41f8-8389-0047121e711a",
          "company": "Market Trei Brazi SRL",
          "name": "Frozen goods trial",
          "owner": "ana-rusu",
          "value": "47600.00",
          "currency": "RON",
          "stage": "lead",
          "reason": null,
          "expectedClose": "2026-12-15",
          "order": null,
          "externalId": null,
          "customFields": {},
          "revision": 2
        }
      ],
      "nextCursor": null
    }

    Merge

    Send the merge to the lead that stays, DL-1042, with the id of the duplicate, DL-1044, and the revision of the lead that stays.

    curl

    curl -X POST "$RDC_BASE_URL/crm/v1/deals/92b6d0f5-1c48-4a3e-8d27-e5f9a4c0b742/merge" \
      -H "Authorization: Bearer $RDC_TOKEN" \
      -H "Content-Type: application/json" \
      -d '{
      "operationId": "f11c6469-c5bf-4ecc-a73e-d73a674eeaf4",
      "expectedRevision": 2,
      "duplicateDealId": "d4a1f7c8-3e90-4b56-a2d1-8c7e0b9f6a44"
    }'

    JavaScript

    const response = await fetch(`${process.env.RDC_BASE_URL}/crm/v1/deals/92b6d0f5-1c48-4a3e-8d27-e5f9a4c0b742/merge`, {
      method: 'POST',
      headers: {
        Authorization: `Bearer ${process.env.RDC_TOKEN}`,
        'Content-Type': 'application/json',
      },
      body: JSON.stringify({
        "operationId": "f11c6469-c5bf-4ecc-a73e-d73a674eeaf4",
        "expectedRevision": 2,
        "duplicateDealId": "d4a1f7c8-3e90-4b56-a2d1-8c7e0b9f6a44"
      }),
    });
    const result = await response.json();

    Python

    import os
    import requests
    
    response = requests.request(
        'POST',
        f'{os.environ["RDC_BASE_URL"]}/crm/v1/deals/92b6d0f5-1c48-4a3e-8d27-e5f9a4c0b742/merge',
        headers={
            'Authorization': f'Bearer {os.environ["RDC_TOKEN"]}',
        },
        json={
            'operationId': 'f11c6469-c5bf-4ecc-a73e-d73a674eeaf4',
            'expectedRevision': 2,
            'duplicateDealId': 'd4a1f7c8-3e90-4b56-a2d1-8c7e0b9f6a44',
        },
    )
    result = response.json()

    PHP

    <?php
    
    $body = <<<'JSON'
    {
      "operationId": "f11c6469-c5bf-4ecc-a73e-d73a674eeaf4",
      "expectedRevision": 2,
      "duplicateDealId": "d4a1f7c8-3e90-4b56-a2d1-8c7e0b9f6a44"
    }
    JSON;
    
    $curl = curl_init(getenv('RDC_BASE_URL') . '/crm/v1/deals/92b6d0f5-1c48-4a3e-8d27-e5f9a4c0b742/merge');
    curl_setopt_array($curl, [
        CURLOPT_CUSTOMREQUEST => 'POST',
        CURLOPT_RETURNTRANSFER => true,
        CURLOPT_HTTPHEADER => [
            'Authorization: Bearer ' . getenv('RDC_TOKEN'),
            'Content-Type: application/json',
        ],
        CURLOPT_POSTFIELDS => $body,
    ]);
    $result = json_decode(curl_exec($curl), true);
    curl_close($curl);

    C#

    using System.Net.Http.Headers;
    
    var client = new HttpClient();
    var request = new HttpRequestMessage(HttpMethod.Post, $"{Environment.GetEnvironmentVariable("RDC_BASE_URL")}/crm/v1/deals/92b6d0f5-1c48-4a3e-8d27-e5f9a4c0b742/merge");
    request.Headers.Authorization = new AuthenticationHeaderValue("Bearer", Environment.GetEnvironmentVariable("RDC_TOKEN"));
    request.Content = new StringContent("""
    {
      "operationId": "f11c6469-c5bf-4ecc-a73e-d73a674eeaf4",
      "expectedRevision": 2,
      "duplicateDealId": "d4a1f7c8-3e90-4b56-a2d1-8c7e0b9f6a44"
    }
    """, System.Text.Encoding.UTF8, "application/json");
    var response = await client.SendAsync(request);
    var result = await response.Content.ReadAsStringAsync();

    Response 202

    {
      "operationId": "f11c6469-c5bf-4ecc-a73e-d73a674eeaf4",
      "status": "accepted",
      "aggregateRevision": 3
    }

    After the merge

    • The lead that stays has one more revision.
    • The duplicate no longer exists: reading it answers 404 with deal_not_found.
    • What was written on the duplicate is on the lead that stays.

    curl

    curl "$RDC_BASE_URL/crm/v1/deals/92b6d0f5-1c48-4a3e-8d27-e5f9a4c0b742" \
      -H "Authorization: Bearer $RDC_TOKEN"

    JavaScript

    const response = await fetch(`${process.env.RDC_BASE_URL}/crm/v1/deals/92b6d0f5-1c48-4a3e-8d27-e5f9a4c0b742`, {
      method: 'GET',
      headers: {
        Authorization: `Bearer ${process.env.RDC_TOKEN}`,
      },
    });
    const result = await response.json();

    Python

    import os
    import requests
    
    response = requests.request(
        'GET',
        f'{os.environ["RDC_BASE_URL"]}/crm/v1/deals/92b6d0f5-1c48-4a3e-8d27-e5f9a4c0b742',
        headers={
            'Authorization': f'Bearer {os.environ["RDC_TOKEN"]}',
        },
    )
    result = response.json()

    PHP

    <?php
    
    $curl = curl_init(getenv('RDC_BASE_URL') . '/crm/v1/deals/92b6d0f5-1c48-4a3e-8d27-e5f9a4c0b742');
    curl_setopt_array($curl, [
        CURLOPT_CUSTOMREQUEST => 'GET',
        CURLOPT_RETURNTRANSFER => true,
        CURLOPT_HTTPHEADER => [
            'Authorization: Bearer ' . getenv('RDC_TOKEN'),
        ],
    ]);
    $result = json_decode(curl_exec($curl), true);
    curl_close($curl);

    C#

    using System.Net.Http.Headers;
    
    var client = new HttpClient();
    var request = new HttpRequestMessage(HttpMethod.Get, $"{Environment.GetEnvironmentVariable("RDC_BASE_URL")}/crm/v1/deals/92b6d0f5-1c48-4a3e-8d27-e5f9a4c0b742");
    request.Headers.Authorization = new AuthenticationHeaderValue("Bearer", Environment.GetEnvironmentVariable("RDC_TOKEN"));
    var response = await client.SendAsync(request);
    var result = await response.Content.ReadAsStringAsync();

    Response 200

    {
      "id": "92b6d0f5-1c48-4a3e-8d27-e5f9a4c0b742",
      "number": "DL-1042",
      "companyId": "ffc05e95-9bb4-41f8-8389-0047121e711a",
      "company": "Market Trei Brazi SRL",
      "name": "Frozen goods trial",
      "owner": "ana-rusu",
      "value": "47600.00",
      "currency": "RON",
      "stage": "lead",
      "reason": null,
      "expectedClose": "2026-12-15",
      "order": null,
      "externalId": null,
      "customFields": {},
      "revision": 3
    }

    curl

    curl "$RDC_BASE_URL/crm/v1/activities?dealId=92b6d0f5-1c48-4a3e-8d27-e5f9a4c0b742" \
      -H "Authorization: Bearer $RDC_TOKEN"

    JavaScript

    const response = await fetch(`${process.env.RDC_BASE_URL}/crm/v1/activities?dealId=92b6d0f5-1c48-4a3e-8d27-e5f9a4c0b742`, {
      method: 'GET',
      headers: {
        Authorization: `Bearer ${process.env.RDC_TOKEN}`,
      },
    });
    const result = await response.json();

    Python

    import os
    import requests
    
    response = requests.request(
        'GET',
        f'{os.environ["RDC_BASE_URL"]}/crm/v1/activities?dealId=92b6d0f5-1c48-4a3e-8d27-e5f9a4c0b742',
        headers={
            'Authorization': f'Bearer {os.environ["RDC_TOKEN"]}',
        },
    )
    result = response.json()

    PHP

    <?php
    
    $curl = curl_init(getenv('RDC_BASE_URL') . '/crm/v1/activities?dealId=92b6d0f5-1c48-4a3e-8d27-e5f9a4c0b742');
    curl_setopt_array($curl, [
        CURLOPT_CUSTOMREQUEST => 'GET',
        CURLOPT_RETURNTRANSFER => true,
        CURLOPT_HTTPHEADER => [
            'Authorization: Bearer ' . getenv('RDC_TOKEN'),
        ],
    ]);
    $result = json_decode(curl_exec($curl), true);
    curl_close($curl);

    C#

    using System.Net.Http.Headers;
    
    var client = new HttpClient();
    var request = new HttpRequestMessage(HttpMethod.Get, $"{Environment.GetEnvironmentVariable("RDC_BASE_URL")}/crm/v1/activities?dealId=92b6d0f5-1c48-4a3e-8d27-e5f9a4c0b742");
    request.Headers.Authorization = new AuthenticationHeaderValue("Bearer", Environment.GetEnvironmentVariable("RDC_TOKEN"));
    var response = await client.SendAsync(request);
    var result = await response.Content.ReadAsStringAsync();

    Response 200

    {
      "items": [
        {
          "id": "93846527-0ceb-46a7-acbc-cde9b3e05233",
          "companyId": "ffc05e95-9bb4-41f8-8389-0047121e711a",
          "dealId": "92b6d0f5-1c48-4a3e-8d27-e5f9a4c0b742",
          "kind": "note",
          "text": "Second request from the website form, from the same company.",
          "by": "ana-rusu",
          "at": "2026-11-23T05:50:00Z",
          "minutes": null,
          "due": null,
          "done": true,
          "doneAt": null
        },
        {
          "id": "08a63cbd-6e91-4c33-8022-fa751306b7d1",
          "companyId": "ffc05e95-9bb4-41f8-8389-0047121e711a",
          "dealId": "92b6d0f5-1c48-4a3e-8d27-e5f9a4c0b742",
          "kind": "task",
          "text": "Qualify the request.",
          "by": "ana-rusu",
          "at": "2026-11-22T19:41:00Z",
          "minutes": null,
          "due": "2026-11-24",
          "done": false,
          "doneAt": null
        },
        {
          "id": "154e81b6-8f4d-464a-9c00-b1a36701fb16",
          "companyId": "ffc05e95-9bb4-41f8-8389-0047121e711a",
          "dealId": "92b6d0f5-1c48-4a3e-8d27-e5f9a4c0b742",
          "kind": "note",
          "text": "Request from the website form: a trial with frozen goods for the shops.",
          "by": "ana-rusu",
          "at": "2026-11-22T19:40:00Z",
          "minutes": null,
          "due": null,
          "done": true,
          "doneAt": null
        }
      ],
      "nextCursor": null
    }

    What is refused

    CodeWhen
    not_a_leadOne of the two deals is no longer a lead.
    other_companyThe two deals belong to different companies.
    same_dealThe duplicate is the lead that stays.
    revision_conflictThe lead that stays changed after you read it.

    A merge cannot be undone through the API. Check the list of duplicates before you send it.