ackDB

Merge two duplicate entities

Combines two entities into one using a winner/loser pattern. ALL data transfers from loser to winner: identity_links, traits, contacts, events, raw_payloads, entity_content, files, and conversations. No data is lost.

The loser entity is soft-deleted (status=merged, merged_into=winnerId).

Trait conflicts resolved by Postgres - winner's existing traits take precedence on key conflict. Identity link conflicts are handled automatically (loser's duplicate links are removed).

Contacts (#325): when the same PERSON has an active contact at BOTH companies, the two edges are the same affiliation split across duplicates — they are MERGED (events re-pointed, links/traits/ownership folded onto the surviving edge), reported as contactsMerged. Everything else is simply re-parented (contactsTransferred).

post/api/v1/ackdb/entities/merge

Request

  • Base URL
    http://localhost:3009
  • Auth
    HTTP bearer

Request body

winnerIdstring required

Entity that survives the merge.

loserIdstring required

Entity that gets soft-deleted after merge.

Example request

{
  "winnerId": "01HXYZ123456789ABCDEFGH",
  "loserId": "01HABCD123456789EFGHIJK"
}

Response

Entities merged successfully

Example response

{
  "data": {
    "winnerId": "01HXYZ123456789ABCDEFGH",
    "loserId": "01HABCD123456789EFGHIJK",
    "linksTransferred": 2,
    "traitsTransferred": 3,
    "contactsTransferred": 1,
    "eventsTransferred": 42,
    "rawPayloadsTransferred": 42,
    "contentTransferred": 5,
    "conversationsTransferred": 3,
    "relationshipsRepointed": 1
  }
}

Changes

No recorded changes to this operation across all 1 revision of this API.