---
title: "Memory"
description: "CRUD operations for facts, observations, and dreams."
---

## Facts

### List facts

```bash
curl "http://localhost:6877/facts?limit=20&offset=0" \
  -H "Authorization: Bearer $API_KEY"
```

### Get fact

```bash
curl http://localhost:6877/facts/42 \
  -H "Authorization: Bearer $API_KEY"
```

Returns the fact with its entities and linked facts.

### Update fact

```bash
curl -X PATCH http://localhost:6877/facts/42 \
  -H "Authorization: Bearer $API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"text": "Updated fact text"}'
```

### Delete fact

```bash
curl -X DELETE http://localhost:6877/facts/42 \
  -H "Authorization: Bearer $API_KEY"
```

## Observations

### List observations

```bash
curl http://localhost:6877/observations \
  -H "Authorization: Bearer $API_KEY"
```

### Get observation

```bash
curl http://localhost:6877/observations/7 \
  -H "Authorization: Bearer $API_KEY"
```

Returns the observation with its supporting facts.

### Update observation

```bash
curl -X PATCH http://localhost:6877/observations/7 \
  -H "Authorization: Bearer $API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"summary": "Updated observation"}'
```

### Delete observation

```bash
curl -X DELETE http://localhost:6877/observations/7 \
  -H "Authorization: Bearer $API_KEY"
```

## Dreams

### List dreams

```bash
curl http://localhost:6877/dreams \
  -H "Authorization: Bearer $API_KEY"
```

### Get dream

```bash
curl http://localhost:6877/dreams/3 \
  -H "Authorization: Bearer $API_KEY"
```

### Delete dream

```bash
curl -X DELETE http://localhost:6877/dreams/3 \
  -H "Authorization: Bearer $API_KEY"
```

## Stats

```bash
curl http://localhost:6877/stats \
  -H "Authorization: Bearer $API_KEY"
```

```json
{
  "fact_count": 245,
  "observation_count": 38,
  "dream_count": 5
}
```

## Purge

Delete all memory data:

```bash
curl -X POST http://localhost:6877/memory/clear \
  -H "Authorization: Bearer $API_KEY"
```

Clear only observations (keep facts):

```bash
curl -X POST http://localhost:6877/memory/observations/clear \
  -H "Authorization: Bearer $API_KEY"
```
