Returns the caller org's knowledge as a node/edge graph shaped for a…
Returns the caller org's knowledge as a node/edge graph shaped for a force-directed renderer: pages, memories and synced sources as nodes; the page parent…
GET /v1/knowledge/graph
| Address | https://api.hanzo.ai/v1/knowledge/graph |
| Method | GET |
| Operation | get_knowledge_graph |
| Auth | Authorization: Bearer $HANZO_API_KEY |
Returns the caller org's knowledge as a node/edge graph shaped for a force-directed renderer: pages, memories and synced sources as nodes; the page parent tree, the wikilinks between pages, and each source's connector provenance as edges. Wikilink targets are resolved HERE by title or slug, so a rename never needs an edge rewrite and a link that matches no page renders as its own "unresolved" node instead of vanishing. ?project= narrows it. A store outage degrades to an honest empty graph, never a 5xx.
Request
1 field.
| Field | In | Type | Required | Description |
|---|---|---|---|---|
project | query | string | — | Project narrows the graph to one project scope. |
Response
| Status | Body | Meaning |
|---|---|---|
200 | graphOut | ok |
200 body — 11 fields.
| Field | In | Type | Always | Description |
|---|---|---|---|---|
degraded | body | boolean | — | Degraded is true when the store was unreachable and this graph is honestly empty rather than wrong. |
edges | body | graphEdge[] | — | Edges are the parent tree, the resolved wikilinks and the connector provenance. |
edges[].from | body | string | — | From is the id of the node the edge starts at: the child page for a parent edge, the page holding the wikilink for a link edge, the kb-source for a provenance… |
edges[].kind | body | string | — | parent | link | provenance |
edges[].to | body | string | — | To is the id of the node the edge points at: the parent page, the linked page, the kb-connector. |
nodes | body | graphNode[] | — | Nodes are the pages, memories, sources, connectors and unresolved link targets. |
nodes[].id | body | string | — | "<doctype>:<name>" — globally unique, click-to-open key |
nodes[].name | body | string | — | the document name (empty for synthetic nodes) |
nodes[].project | body | string | — | Project is the project scope the underlying document was saved under. |
nodes[].title | body | string | — | display label |
nodes[].type | body | string | — | kb-page | kb-memory | kb-source | kb-connector | unresolved |
Failure carries the platform error shape — see Errors.
Examples
hanzo has no subcommand for this operation — the CLI serves only what cloud's live route table confirms. Use HTTP or an SDK.
import { Configuration, KnowledgeApi } from 'hanzoai';
const api = new KnowledgeApi(new Configuration({ accessToken: process.env.HANZO_API_KEY }));
const { data } = await api.getKnowledgeGraph();from hanzoai.cloud import ApiClient, Configuration
from hanzoai.cloud.api import KnowledgeApi
client = ApiClient(Configuration(access_token=os.environ["HANZO_API_KEY"]))
result = KnowledgeApi(client).get_knowledge_graph()cfg := cloud.NewConfiguration()
cfg.AddDefaultHeader("Authorization", "Bearer "+os.Getenv("HANZO_API_KEY"))
client := cloud.NewAPIClient(cfg)
resp, _, err := client.KnowledgeAPI.GetKnowledgeGraph(context.Background()).Execute()
if err != nil {
return err
}use hanzo_cloud::apis::{configuration::Configuration, knowledge_api};
let mut cfg = Configuration::new();
cfg.bearer_access_token = std::env::var("HANZO_API_KEY").ok();
let result = knowledge_api::get_knowledge_graph(&cfg, Default::default()).await?;import ai.hanzo.cloud.ApiClient;
import ai.hanzo.cloud.api.KnowledgeApi;
ApiClient client = new ApiClient();
client.setRequestInterceptor(b -> b.header("Authorization", "Bearer " + System.getenv("HANZO_API_KEY")));
var result = new KnowledgeApi(client).getKnowledgeGraph();The method above is the one at the current release of the document. [email protected] (npm) and [email protected] (PyPI) were generated from an earlier release, where this operation carried a different id, so it spells the method differently — regenerating the clients is what makes the two agree. SDKs →
curl https://api.hanzo.ai/v1/knowledge/graph \
-H "Authorization: Bearer $HANZO_API_KEY"The door reaches knowledge through the knowledge tool, which names its 9 operations with its own verbs — this one among them, under a name only the door declares. describe explains any of them:
curl -X POST https://api.hanzo.ai/v1/mcp \
-H "Content-Type: application/json" \
-d '{
"jsonrpc": "2.0",
"id": 1,
"method": "tools/call",
"params": {
"name": "describe",
"arguments": {
"op": "list_kb_connectors"
}
}
}'How is this guide?