Merge Duplicates
Merge one duplicate lead or company (a `GET /kg/duplicates` suggestion) into another (admin+; never automatic). In one transaction every child row of the duplicate (timeline, consents, calls, meetings, enrollments, drafts, replies, research, enrichment, signals, deliveries, knowledge-graph nodes, edges and facts; for companies also their leads) moves to the kept record, empty fields of the kept record are filled from it and the duplicate is deleted. Compliance keeps the stricter state: a consent revoked on either lead revokes the other's for the same channel and purpose, and suppressed addresses (or domains) suppress the kept record's. A timeline note and the audit log record it. Idempotent: repeating it answers the recorded outcome (`already_merged: true`). 404 a record is not a live one of this workspace; 409 `call_in_progress`, `privacy_request_open`, or `already_merged` into another record.
API key access
admin scope with an API key (ro_pat_...). A signed-in session uses the caller's role./api/v1/kg/mergeAccess token from /api/v1/auth/login, or an API key (ro_pat_..., RO-176) from /api/v1/workspaces/current/api-keys: the key implies its workspace and needs the route's scope. MCP connectors (/api/v1/mcp only) may use an OAuth access token (ro_oat_..., RO-284).
In: header
Header Parameters
Id of the workspace to act on (must be a member).
What a merge acts on (RO-247).
"lead" | "company"The record that is kept.
uuidThe duplicate: its data moves to the kept record and it is deleted.
uuidResponse Body
curl -X POST "http://localhost:8000/api/v1/kg/merge" \ -H "X-Workspace-Id: string" \ -H "Content-Type: application/json" \ -d '{ "kind": "lead", "survivor_id": "43b7619a-86a5-46b3-8c4e-e5d4e644b9cb", "merged_id": "2be53fee-32eb-4df8-945d-1095aae1afde" }'{
"kind": "lead",
"survivor_id": "43b7619a-86a5-46b3-8c4e-e5d4e644b9cb",
"merged_id": "2be53fee-32eb-4df8-945d-1095aae1afde",
"already_merged": true,
"moved": {
"property1": 0,
"property2": 0
},
"filled": [
"string"
],
"consents_revoked": 0,
"suppressions_added": 0,
"merged_at": "2019-08-24T14:15:22Z"
}{
"detail": [
{
"loc": [
"string"
],
"msg": "string",
"type": "string",
"input": null,
"ctx": {}
}
]
}Get Lead Memory
The lead's memory: current facts (with confidence and sources), open objections, relationships (company, sequences, touches with counts) and recent interactions. Every item cites its source (`citations`: a timeline event, call, classified reply, research run or the lead record, plus the URL for research facts); `text` is the same memory as a compact block with `[n]` markers, as the AI writer and voice agent see it. 404 if the lead is missing or deleted.
Rebuild Knowledge Graph
Queue a replay of this workspace's deterministic knowledge-graph ingestion (admin+): what the rules derived from leads and the timeline (edges, `rules@v1` facts) is deleted and folded again from the start; LLM-extracted facts are kept and nothing is re-extracted. One rebuild per workspace waits at a time: while one is queued or running, it is returned (`created: false`).