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

# Graph

> Inspect the entity graph a space has built: the people, places, organizations and concepts in its memories, and which appear together.

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.

> [!TIP]
>
> Looking for charts and diagrams drawn from your memories? That is [Draw](https://docs.memory.anonalabs.com/api-reference/draw.md).

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

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

```bash cURL theme={null}
curl "https://api.anonalabs.com/v1/spaces/customer-support-bot/graph?limit=500&min_count=1" \
  -H "Authorization: Bearer anona_live_YOUR_KEY"
```

```python 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"])
```

```typescript TypeScript theme={null}
const graph = await anona.getGraph({ spaceId: "customer-support-bot" });
for (const edge of graph.edges) {
  console.log(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
}
```

```bash cURL theme={null}
curl "https://api.anonalabs.com/v1/spaces/customer-support-bot/entities?limit=100&offset=0" \
  -H "Authorization: Bearer anona_live_YOUR_KEY"
```

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

```typescript TypeScript theme={null}
const entities = await anona.listEntities({ spaceId: "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" }
  ]
}
```

```bash cURL theme={null}
curl https://api.anonalabs.com/v1/spaces/customer-support-bot/entities/e_a1b2 \
  -H "Authorization: Bearer anona_live_YOUR_KEY"
```

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

```typescript TypeScript theme={null}
const entity = await anona.getEntity({
  spaceId: "customer-support-bot",
  entityId: "e_a1b2",
});
for (const obs of entity.observations) {
  console.log(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 | `missing_auth` / `invalid_api_key` | Missing or invalid API key. |
| 403 | `space_access_denied` | You are not a member of this space. |
| 404 | `space_not_found` | The space does not exist, or the id is misspelled. |
| 404 | `graph_error` | The space exists but holds no entity with that id. This surface reports every engine-side failure as `graph_error` with the engine's own status, so the same code also appears on other `4xx` and `5xx` statuses. |
| 429 | `rate_limited` | Credit quota or rate limit exceeded. |

See the full [error reference](https://docs.memory.anonalabs.com/api-reference/errors.md).

## Next steps

> **[Retrieve API](https://docs.memory.anonalabs.com/api-reference/retrieve.md)**
>
> Query memories semantically.

> **[Reason API](https://docs.memory.anonalabs.com/api-reference/reason.md)**
>
> Synthesize an answer across memories.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.