# List graph — GET /v1/knowledge/graph

URL: https://docs.hanzo.ai/docs/openapi/knowledge/get-knowledge-graph

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

`GET /v1/knowledge/graph`

> [Knowledge →](https://docs.hanzo.ai/docs/openapi/knowledge) · [All API references →](https://docs.hanzo.ai/docs/openapi) · [Get started →](https://docs.hanzo.ai/docs/guides)

|               |                                           |
| ------------- | ----------------------------------------- |
| **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`     | knowledge.graphOut | ok      |
| `default` | problem-details    | refused |

`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 | knowledge.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 edge. |
| `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 | knowledge.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](https://docs.hanzo.ai/docs/errors).

## Examples

**CLI**

```bash
hanzo knowledge graph
```

**SDK**

**.ts**

```ts
import { Configuration, KnowledgeApi } from 'hanzoai';

const api = new KnowledgeApi(new Configuration({ accessToken: process.env.HANZO_API_KEY }));
const { data } = await api.getKnowledgeGraph();
```

**.py**

```python
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()
```

**.go**

```go
cfg := hanzoai.NewConfiguration()
cfg.AddDefaultHeader("Authorization", "Bearer "+os.Getenv("HANZO_API_KEY"))
client := hanzoai.NewAPIClient(cfg)

resp, _, err := client.KnowledgeAPI.GetKnowledgeGraph(context.Background()).Execute()
if err != nil {
	return err
}
```

**.rs**

```rust
use hanzo_client::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?;
```

**.java**

```java
import ai.hanzo.cloud.ApiClient;
import ai.hanzo.cloud.api.KnowledgeApi;

ApiClient client = new ApiClient();
client.setBearerToken(System.getenv("HANZO_API_KEY"));

var result = new KnowledgeApi(client).getKnowledgeGraph();
```

**HTTP**

```bash
curl https://api.hanzo.ai/v1/knowledge/graph \
  -H "Authorization: Bearer $HANZO_API_KEY"
```

**MCP**

Tool `knowledge`, op `get_knowledge_graph` — POST the JSON-RPC envelope to `https://api.hanzo.ai/v1/mcp`.

```bash
curl -X POST https://api.hanzo.ai/v1/mcp \
  -H "Authorization: Bearer $HANZO_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
       "jsonrpc": "2.0",
       "id": 1,
       "method": "tools/call",
       "params": {
         "name": "knowledge",
         "arguments": {
           "op": "get_knowledge_graph",
           "input": {}
         }
       }
     }'
```

---

[Knowledge API](https://docs.hanzo.ai/docs/openapi/knowledge) · [All Hanzo APIs](https://docs.hanzo.ai/docs/openapi) · [Interactive reference](https://docs.hanzo.ai/docs/openapi/reference)
