Memory

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).

API key access

Needs the leads:read scope with an API key (ro_pat_...). A signed-in session uses the caller's role.
GET/api/v1/kg/graph
AuthorizationBearer <token>

Access 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

Query Parameters

node?Node

The root: a graph node id (from a previous answer).

lead_id?Lead Id

The root: this lead's person node.

company_id?Company Id

The root: this company's node.

depth?Depth

Hops from the root.

Default1
Range1 <= value <= 3
limit?Limit

Most nodes returned.

Default60
Range1 <= value <= 200

Header Parameters

X-Workspace-Id?X-Workspace-Id

Id of the workspace to act on (must be a member).

Response Body

curl -X GET "http://localhost:8000/api/v1/kg/graph?node=497f6eca-6276-4993-bfeb-53cbbbba6f08&lead_id=497f6eca-6276-4993-bfeb-53cbbbba6f08&company_id=497f6eca-6276-4993-bfeb-53cbbbba6f08&depth=1&limit=60" \  -H "X-Workspace-Id: string"
{
  "root_id": "9b451279-6241-4fe6-9ea0-54b426fb7a24",
  "depth": 0,
  "nodes": [
    {
      "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
      "kind": "string",
      "label": "string",
      "ref_id": "58ed4a6c-926f-4b2f-b688-ecd86db2ed34",
      "lead_id": "9bddab70-98e6-43a9-8f32-c9788b9de0c0",
      "company_id": "b2e6a1c3-1a5e-44ae-a8fd-81f76fd715cf",
      "depth": 0,
      "fact_count": 0
    }
  ],
  "edges": [
    {
      "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
      "source": "07b8e003-7027-443f-88b0-24a5eb1cc68b",
      "target": "65a17d54-9c67-4477-8b80-d3f97e165aa5",
      "kind": "string",
      "weight": 0,
      "since": "2019-08-24T14:15:22Z",
      "last_at": "2019-08-24T14:15:22Z",
      "citations": [
        0
      ]
    }
  ],
  "citations": [
    {
      "n": 0,
      "type": "string",
      "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
      "at": "2019-08-24T14:15:22Z",
      "url": "string",
      "label": "string"
    }
  ],
  "truncated": true
}
{
  "detail": [
    {
      "loc": [
        "string"
      ],
      "msg": "string",
      "type": "string",
      "input": null,
      "ctx": {}
    }
  ]
}