supermemory/apps/docs/list-memories/examples/basic.mdx
Dhravya Shah 87b361c26b
Some checks failed
Publish AI SDK / publish (push) Has been cancelled
docs changes (#678)
Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-18 16:55:32 -08:00

87 lines
2 KiB
Text

---
title: "Basic Listing"
description: "Simple memory retrieval across languages"
---
Simple memory retrieval examples for getting started with the list memories endpoint.
## Basic Usage
<Tabs>
<Tab title="TypeScript">
```typescript
import Supermemory from 'supermemory';
const client = new Supermemory({
apiKey: process.env.SUPERMEMORY_API_KEY!
});
const response = await client.documents.list({ limit: 10 });
console.log(response);
```
</Tab>
<Tab title="Python">
```python
from supermemory import Supermemory
import os
client = Supermemory(api_key=os.environ.get("SUPERMEMORY_API_KEY"))
response = client.documents.list(limit=10)
print(response)
```
</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}'
```
</Tab>
</Tabs>
## With Custom Parameters
<Tabs>
<Tab title="TypeScript">
```typescript
const response = await client.documents.list({
containerTags: ["user_123"],
limit: 20,
sort: "updatedAt",
order: "desc"
});
console.log(`Found ${response.memories.length} memories`);
```
</Tab>
<Tab title="Python">
```python
response = client.documents.list(
container_tags=["user_123"],
limit=20,
sort="updatedAt",
order="desc"
)
print(f"Found {len(response.memories)} memories")
```
</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 '{
"containerTags": ["user_123"],
"limit": 20,
"sort": "updatedAt",
"order": "desc"
}'
```
</Tab>
</Tabs>
<Info>
Start with small `limit` values (10-20) when testing to avoid overwhelming responses.
</Info>