docs/doc/developer/api/memories.mdx
response = requests.get(
"https://api.omi.me/v1/dev/user/memories",
headers={"Authorization": f"Bearer {API_KEY}"},
params={"limit": 50, "categories": "interesting"}
)
memories = response.json()
```
response = requests.post(
"https://api.omi.me/v1/dev/user/memories",
headers={
"Authorization": f"Bearer {API_KEY}",
"Content-Type": "application/json"
},
json={
"content": "User prefers dark mode in all applications",
"category": "system",
"tags": ["preferences", "ui"]
}
)
memory = response.json()
```
Each memory object accepts the same fields as the single create endpoint.
response = requests.post(
"https://api.omi.me/v1/dev/user/memories/batch",
headers={
"Authorization": f"Bearer {API_KEY}",
"Content-Type": "application/json"
},
json={
"memories": [
{"content": "User prefers async communication over meetings", "category": "system"},
{"content": "User speaks fluent Japanese and French", "category": "interesting"}
]
}
)
result = response.json()
print(f"Created {result['created_count']} memories")
```
At least one field must be provided.
response = requests.patch(
"https://api.omi.me/v1/dev/user/memories/mem_xyz789",
headers={
"Authorization": f"Bearer {API_KEY}",
"Content-Type": "application/json"
},
json={
"content": "User strongly prefers dark mode in all applications",
"visibility": "private"
}
)
memory = response.json()
```
response = requests.delete(
"https://api.omi.me/v1/dev/user/memories/mem_xyz789",
headers={"Authorization": f"Bearer {API_KEY}"}
)
result = response.json()
if result["success"]:
print("Memory deleted successfully")
```
For notes, meeting summaries, or imported text content, use the Conversations API instead — it automatically extracts memories and action items. </Info>
Import known facts and preferences about the user:
<Tabs> <Tab title="Python"> ```python import requestsAPI_KEY = "omi_dev_your_api_key"
# Facts about the user from another system
user_facts = [
{"content": "User is vegetarian", "category": "system"},
{"content": "User's dog is named Luna", "category": "interesting"},
{"content": "User works at Acme Corp as lead engineer", "category": "system"},
{"content": "User ran a marathon in under 4 hours", "category": "interesting"}
]
# Create batch
response = requests.post(
"https://api.omi.me/v1/dev/user/memories/batch",
headers={"Authorization": f"Bearer {API_KEY}", "Content-Type": "application/json"},
json={"memories": user_facts}
)
print(f"Added {response.json()['created_count']} facts about the user")
```
// Facts about the user from another system
const userFacts = [
{ content: "User is vegetarian", category: "system" },
{ content: "User's dog is named Luna", category: "interesting" },
{ content: "User works at Acme Corp as lead engineer", category: "system" },
{ content: "User ran a marathon in under 4 hours", category: "interesting" }
];
// Create batch
const response = await fetch(
"https://api.omi.me/v1/dev/user/memories/batch",
{
method: "POST",
headers: {
Authorization: `Bearer ${API_KEY}`,
"Content-Type": "application/json"
},
body: JSON.stringify({ memories: userFacts })
}
);
const result = await response.json();
console.log(`Added ${result.created_count} facts about the user`);
```