1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
|
---
title: "Document Operations"
sidebarTitle: "Documents"
description: "List, get, update, and delete your ingested documents"
icon: "files"
---
Manage documents after ingestion using the SDK.
## List Documents
Retrieve paginated documents with filtering.
<Tabs>
<Tab title="TypeScript">
```typescript
const documents = await client.documents.list({
limit: 10,
containerTags: ["user_123"]
});
documents.memories.forEach(d => {
console.log(d.id, d.title, d.status);
});
```
</Tab>
<Tab title="Python">
```python
documents = client.documents.list(
limit=10,
container_tags=["user_123"]
)
for doc in documents.memories:
print(doc.id, doc.title, doc.status)
```
</Tab>
<Tab title="cURL">
```bash
curl -X POST "https://api.supermemory.ai/v3/documents/list" \
-H "Authorization: Bearer $SUPERMEMORY_API_KEY" \
-H "Content-Type: application/json" \
-d '{"limit": 10, "containerTags": ["user_123"]}'
```
</Tab>
</Tabs>
**Response:**
```json
{
"memories": [
{
"id": "doc_abc123",
"title": "Meeting notes",
"status": "done",
"type": "text",
"createdAt": "2024-01-15T10:30:00Z",
"containerTags": ["user_123"],
"metadata": { "source": "slack" }
}
],
"pagination": {
"currentPage": 1,
"totalPages": 3,
"totalItems": 25
}
}
```
### Parameters
| Parameter | Type | Default | Description |
|-----------|------|---------|-------------|
| `limit` | number | 50 | Items per page (max 200) |
| `page` | number | 1 | Page number |
| `containerTags` | string[] | — | Filter by tags |
| `sort` | string | `createdAt` | Sort by `createdAt` or `updatedAt` |
| `order` | string | `desc` | `desc` (newest) or `asc` (oldest) |
<Accordion title="Pagination Example">
```typescript
async function getAllDocuments(containerTag: string) {
const all = [];
let page = 1;
while (true) {
const { memories, pagination } = await client.documents.list({
containerTags: [containerTag],
limit: 100,
page
});
all.push(...memories);
if (page >= pagination.totalPages) break;
page++;
}
return all;
}
```
</Accordion>
<Accordion title="Filter by Metadata">
```typescript
const documents = await client.documents.list({
containerTags: ["user_123"],
filters: {
AND: [
{ key: "status", value: "reviewed", negate: false },
{ key: "priority", value: "high", negate: false }
]
}
});
```
</Accordion>
---
## Get Document
Get a specific document with its processing status.
<Tabs>
<Tab title="TypeScript">
```typescript
const doc = await client.documents.get("doc_abc123");
console.log(doc.status); // "queued" | "processing" | "done" | "failed"
console.log(doc.content);
```
</Tab>
<Tab title="Python">
```python
doc = client.documents.get("doc_abc123")
print(doc.status)
print(doc.content)
```
</Tab>
<Tab title="cURL">
```bash
curl "https://api.supermemory.ai/v3/documents/doc_abc123" \
-H "Authorization: Bearer $SUPERMEMORY_API_KEY"
```
</Tab>
</Tabs>
### Processing Status
| Status | Description |
|--------|-------------|
| `queued` | Waiting to process |
| `extracting` | Extracting content (OCR, transcription) |
| `chunking` | Breaking into searchable pieces |
| `embedding` | Creating vector representations |
| `done` | Ready for search |
| `failed` | Processing failed |
<Accordion title="Poll for Completion">
```typescript
async function waitForProcessing(docId: string) {
while (true) {
const doc = await client.documents.get(docId);
if (doc.status === "done") return doc;
if (doc.status === "failed") throw new Error("Processing failed");
await new Promise(r => setTimeout(r, 2000));
}
}
```
</Accordion>
---
## Update Document
Update a document's content or metadata. Triggers reprocessing.
<Tabs>
<Tab title="TypeScript">
```typescript
await client.documents.update("doc_abc123", {
content: "Updated content here",
metadata: { version: 2, reviewed: true }
});
```
</Tab>
<Tab title="Python">
```python
client.documents.update(
"doc_abc123",
content="Updated content here",
metadata={"version": 2, "reviewed": True}
)
```
</Tab>
<Tab title="cURL">
```bash
curl -X PATCH "https://api.supermemory.ai/v3/documents/doc_abc123" \
-H "Authorization: Bearer $SUPERMEMORY_API_KEY" \
-H "Content-Type: application/json" \
-d '{"content": "Updated content here", "metadata": {"version": 2}}'
```
</Tab>
</Tabs>
---
## Delete Documents
Permanently remove documents.
<Tabs>
<Tab title="TypeScript">
```typescript
// Single delete
await client.documents.delete("doc_abc123");
// Bulk delete by IDs
await client.documents.deleteBulk({
ids: ["doc_1", "doc_2", "doc_3"]
});
// Bulk delete by container tag (delete all for a user)
await client.documents.deleteBulk({
containerTags: ["user_123"]
});
```
</Tab>
<Tab title="Python">
```python
# Single delete
client.documents.delete("doc_abc123")
# Bulk delete by IDs
client.documents.delete_bulk(ids=["doc_1", "doc_2", "doc_3"])
# Bulk delete by container tag
client.documents.delete_bulk(container_tags=["user_123"])
```
</Tab>
<Tab title="cURL">
```bash
# Single delete
curl -X DELETE "https://api.supermemory.ai/v3/documents/doc_abc123" \
-H "Authorization: Bearer $SUPERMEMORY_API_KEY"
# Bulk delete by IDs
curl -X DELETE "https://api.supermemory.ai/v3/documents/bulk" \
-H "Authorization: Bearer $SUPERMEMORY_API_KEY" \
-H "Content-Type: application/json" \
-d '{"ids": ["doc_1", "doc_2", "doc_3"]}'
```
</Tab>
</Tabs>
<Warning>
Deletes are permanent — no recovery.
</Warning>
---
## Processing Queue
Check documents currently being processed.
<Tabs>
<Tab title="TypeScript">
```typescript
const response = await client.documents.listProcessing();
console.log(`${response.documents.length} documents processing`);
```
</Tab>
<Tab title="Python">
```python
response = client.documents.list_processing()
print(f"{len(response.documents)} documents processing")
```
</Tab>
<Tab title="cURL">
```bash
curl "https://api.supermemory.ai/v3/documents/processing" \
-H "Authorization: Bearer $SUPERMEMORY_API_KEY"
```
</Tab>
</Tabs>
---
## Next Steps
- [Memory Operations](/memory-operations) — Advanced v4 memory operations
- [Search](/search) — Query your memories
- [Ingesting Content](/add-memories) — Add new content
|