> ## Documentation Index
> Fetch the complete documentation index at: https://docs.anonalabs.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Graph

> Inspect the entity graph a space has built, and see exactly what was extracted from your memories.

Nodes are entities: people, places, organizations, and concepts. An edge means two
entities were mentioned together in the same memory, weighted by how often they
co-occur. Use the graph to visualize what the memory layer knows, or to verify
extraction accuracy.

<Note>
  Edges are co-occurrence relationships, not typed or labeled predicates. They tell you
  that two entities are connected and how strongly, not the specific relationship between
  them.
</Note>

## Get the graph

```http theme={null}
GET /v1/spaces/{space_id}/graph?limit=500&min_count=1
Authorization: Bearer anona_live_YOUR_KEY
```

| Query parameter | Type    | Default | Description                                               |
| --------------- | ------- | ------- | --------------------------------------------------------- |
| `limit`         | integer | 500     | Maximum entities (nodes), 1 to 2000.                      |
| `min_count`     | integer | 1       | Only include entities mentioned at least this many times. |

**Response** `200 OK`

```json theme={null}
{
  "nodes": [
    { "id": "e_a1b2", "label": "Alice", "mention_count": 12 },
    { "id": "e_c3d4", "label": "Google", "mention_count": 8 }
  ],
  "edges": [
    {
      "source": "e_a1b2",
      "target": "e_c3d4",
      "source_label": "Alice",
      "target_label": "Google",
      "weight": 5,
      "last_co_occurred": "2026-07-14T12:34:56Z"
    }
  ],
  "total_entities": 2,
  "total_edges": 1
}
```

| Field                                           | Type           | Description                                                                    |
| ----------------------------------------------- | -------------- | ------------------------------------------------------------------------------ |
| `nodes[].id`                                    | string         | Stable entity id. Pass it to the entity detail endpoint.                       |
| `nodes[].label`                                 | string         | Entity name.                                                                   |
| `nodes[].mention_count`                         | integer        | How many memories mention this entity.                                         |
| `edges[].source` / `edges[].target`             | string         | Entity ids at each end.                                                        |
| `edges[].source_label` / `edges[].target_label` | string         | Entity names at each end, so edges are readable without joining back to nodes. |
| `edges[].weight`                                | integer        | How many memories the pair co-occurs in.                                       |
| `edges[].last_co_occurred`                      | string or null | ISO timestamp of the most recent shared memory.                                |

```python theme={null}
graph = client.get_graph(space_id="customer-support-bot")
for edge in graph["edges"]:
    print(edge["source_label"], "->", edge["target_label"], edge["weight"])
```

## List entities

```http theme={null}
GET /v1/spaces/{space_id}/entities?limit=100&offset=0
Authorization: Bearer anona_live_YOUR_KEY
```

**Response** `200 OK`

```json theme={null}
{
  "items": [
    {
      "id": "e_a1b2",
      "name": "Alice",
      "mention_count": 12,
      "first_seen": "2026-01-15T10:30:00Z",
      "last_seen": "2026-07-14T12:34:56Z"
    }
  ],
  "total": 42,
  "limit": 100,
  "offset": 0
}
```

```python theme={null}
entities = client.list_entities(space_id="customer-support-bot")
```

## Get an entity

Returns one entity plus its observations: the things the memory layer has learned about
it. This is the accuracy-verification view, showing exactly what was extracted and
attributed to each entity.

```http theme={null}
GET /v1/spaces/{space_id}/entities/{entity_id}
Authorization: Bearer anona_live_YOUR_KEY
```

**Response** `200 OK`

```json theme={null}
{
  "id": "e_a1b2",
  "name": "Alice",
  "mention_count": 12,
  "first_seen": "2026-01-15T10:30:00Z",
  "last_seen": "2026-07-14T12:34:56Z",
  "observations": [
    { "text": "Alice works at Google", "mentioned_at": "2026-01-15T10:30:00Z" },
    { "text": "Alice leads the search team", "mentioned_at": "2026-06-02T09:00:00Z" }
  ]
}
```

```python theme={null}
entity = client.get_entity(space_id="customer-support-bot", entity_id="e_a1b2")
for obs in entity["observations"]:
    print(obs["text"])
```

## How the graph is built

Every time you record a memory, the entities it mentions are extracted. Two entities
appearing in the same memory get an edge between them, and the more memories they share,
the heavier that edge. The graph is computed across the entire space, not only recent
memories.

## Error responses

| Status | Code           | Cause                                        |
| ------ | -------------- | -------------------------------------------- |
| 401    | `unauthorized` | Missing or invalid API key.                  |
| 403    | `forbidden`    | The space is not owned by your organization. |
| 404    | `not_found`    | The space or entity does not exist.          |
| 429    | `rate_limited` | Credit quota or rate limit exceeded.         |

See the full [error reference](/api-reference/errors).

## Next steps

<CardGroup cols={2}>
  <Card title="Retrieve API" icon="magnifying-glass" href="/api-reference/retrieve">
    Query memories semantically.
  </Card>

  <Card title="Reason API" icon="lightbulb" href="/api-reference/reason">
    Synthesize an answer across memories.
  </Card>
</CardGroup>
