---
title: [Endpoint name]
description: [Primary action handled by this endpoint]
icon: "bolt"
method: "POST"
path: "/v1/memories"
---
# [METHOD] [path]
| Method | Path | Auth | Rate Limit |
| --- | --- | --- | --- |
| [METHOD] | `[path]` | Bearer (`mem0-api-key`) | [X req/min] |
<Info>
Use this endpoint when [brief scenario]. Prefer [alternative endpoint] for [other scenario].
</Info>
<Warning>
[Optional: scopes, beta headers, or breaking changes.] Remove if not needed.
</Warning>
## Request
### Headers
| Name | Required | Description |
| --- | --- | --- |
| `Authorization` | Yes | `Bearer YOUR_API_KEY` |
| `Content-Type` | Yes | `application/json` |
### Body
| Field | Type | Required | Description | Example |
| --- | --- | --- | --- | --- |
| `user_id` | string | Yes | Identifier for the end user. | `"alex"` |
| `memory` | string | Yes | Content to store. | `"Prefers email follow-ups."` |
| `metadata` | object | No | Key/value pairs for filtering. | `{ "channel": "support" }` |
<CodeGroup>
```bash Shell
curl https://api.mem0.ai/v1/memories \
-H "Authorization: Bearer $MEM0_API_KEY" \
-H "Content-Type: application/json" \
-d '{ "user_id": "alex", "memory": "Prefers email follow-ups." }'
```
```python Python
import requests
resp = requests.post(
"https://api.mem0.ai/v1/memories",
headers={"Authorization": f"Bearer {API_KEY}"},
json={"user_id": "alex", "memory": "Prefers email follow-ups."},
)
resp.raise_for_status()
```
```ts TypeScript
const response = await fetch("https://api.mem0.ai/v1/memories", {
method: "POST",
headers: {
Authorization: `Bearer ${process.env.MEM0_API_KEY}`,
"Content-Type": "application/json",
},
body: JSON.stringify({ user_id: "alex", memory: "Prefers email follow-ups." }),
});
```
</CodeGroup>
<Tip>
Batch insertion? Use `/v1/memories/batch` with the same payload structure.
</Tip>
## Response
```json
{
"memory_id": "mem_123",
"created_at": "2025-02-04T12:00:00Z"
}
```
| Status | Meaning | Fix |
| --- | --- | --- |
| `201` | Memory stored successfully. | — |
| `400` | Missing required field. | Provide `user_id` and `memory`. |
| `401` | Invalid or missing API key. | Refresh key in dashboard. |
<Note>
Responses include pagination tokens when you request multiple resources. Reuse them to fetch the next page.
</Note>
## Related endpoints
- [GET /v1/memories/{memory_id}](./get-memory)
- [DELETE /v1/memories/{memory_id}](./delete-memory)
## Sample workflow
- [Build a Customer Support Agent](/cookbooks/customer-support-agent)
{/* DEBUG: verify CTA targets */}
<CardGroup cols={2}>
<Card
title="[Related concept or feature]"
description="[How this endpoint fits the model]"
icon="layers"
href="/[concept-link]"
/>
<Card
title="[Applied cookbook/integration]"
description="[What readers can build next]"
icon="rocket"
href="/[cookbook-link]"
/>
</CardGroup>