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.
API key access
leads:read scope with an API key (ro_pat_...). A signed-in session uses the caller's role./api/v1/leads/{lead_id}/memoryAccess 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
Path Parameters
uuidQuery Parameters
Token cap of text (estimated as characters / 4).
60050 <= value <= 4000Rank the facts by closeness to this text (RO-227; only with fact embeddings on and an embedding provider, see query_ranked).
Header Parameters
Id of the workspace to act on (must be a member).
Response Body
curl -X GET "http://localhost:8000/api/v1/leads/497f6eca-6276-4993-bfeb-53cbbbba6f08/memory?max_tokens=600&q=string" \ -H "X-Workspace-Id: string"{
"subject_type": "lead",
"subject_id": "80e197be-61ad-4068-b4ff-a483fb5c18f9",
"subject_label": "string",
"as_of": "2019-08-24T14:15:22Z",
"facts": [
{
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
"subject": "string",
"subject_type": "lead",
"predicate": "string",
"value": "string",
"object_kind": "string",
"confidence": 0,
"observed_at": "2019-08-24T14:15:22Z",
"evidence": "string",
"evidence_count": 1,
"citations": [
0
]
}
],
"objections": [
{
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
"subject": "string",
"subject_type": "lead",
"predicate": "string",
"value": "string",
"object_kind": "string",
"confidence": 0,
"observed_at": "2019-08-24T14:15:22Z",
"evidence": "string",
"evidence_count": 1,
"citations": [
0
]
}
],
"relationships": [
{
"kind": "string",
"direction": "out",
"node_kind": "string",
"node_label": "string",
"node_ref_id": "f91546fb-2e3a-4e81-8845-f69266de54ef",
"weight": 0,
"since": "2019-08-24T14:15:22Z",
"last_at": "2019-08-24T14:15:22Z",
"citations": [
0
]
}
],
"recent_interactions": [
{
"type": "string",
"channel": "string",
"occurred_at": "2019-08-24T14:15:22Z",
"summary": "string",
"lead_id": "9bddab70-98e6-43a9-8f32-c9788b9de0c0",
"citations": [
0
]
}
],
"citations": [
{
"n": 0,
"type": "string",
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
"at": "2019-08-24T14:15:22Z",
"url": "string",
"label": "string"
}
],
"text": "string",
"token_estimate": 0,
"truncated": true,
"has_knowledge": true,
"query_ranked": false
}{
"detail": [
{
"loc": [
"string"
],
"msg": "string",
"type": "string",
"input": null,
"ctx": {}
}
]
}Get Kg Graph
The nodes and **current** edges within `depth` hops of a root (give exactly one of `node`, `lead_id` and `company_id`), most recently touched first, at most `limit` nodes (`truncated` says the limit cut it). Every edge cites the source that created or last touched it; each node has its count of current facts. To expand a node, ask again with it as `node`. 404 if the root is not in this workspace's graph (or its lead/company is deleted).
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.