555e282cc4
pi-agent-plugin checks / lint (push) Has been cancelled
pi-agent-plugin checks / test (20) (push) Has been cancelled
pi-agent-plugin checks / test (22) (push) Has been cancelled
pi-agent-plugin checks / build (push) Has been cancelled
TypeScript SDK CI / check_changes (push) Has been cancelled
TypeScript SDK CI / changelog_check (push) Has been cancelled
ci / changelog_check (push) Has been cancelled
ci / check_changes (push) Has been cancelled
ci / build_mem0 (3.10) (push) Has been cancelled
ci / build_mem0 (3.11) (push) Has been cancelled
ci / build_mem0 (3.12) (push) Has been cancelled
CLI Node CI / lint (push) Has been cancelled
CLI Node CI / test (20) (push) Has been cancelled
CLI Node CI / test (22) (push) Has been cancelled
CLI Node CI / build (push) Has been cancelled
CLI Python CI / lint (push) Has been cancelled
CLI Python CI / test (3.10) (push) Has been cancelled
CLI Python CI / test (3.11) (push) Has been cancelled
CLI Python CI / test (3.12) (push) Has been cancelled
CLI Python CI / build (push) Has been cancelled
openclaw checks / lint (push) Has been cancelled
openclaw checks / test (20) (push) Has been cancelled
openclaw checks / test (22) (push) Has been cancelled
openclaw checks / build (push) Has been cancelled
opencode-plugin checks / build (push) Has been cancelled
TypeScript SDK CI / build_ts_sdk (20) (push) Has been cancelled
TypeScript SDK CI / build_ts_sdk (22) (push) Has been cancelled
TypeScript SDK CI / integration_ts_sdk (20) (push) Has been cancelled
TypeScript SDK CI / integration_ts_sdk (22) (push) Has been cancelled
74 lines
2.2 KiB
Plaintext
74 lines
2.2 KiB
Plaintext
---
|
|
title: "Get Memories"
|
|
description: "Retrieve memories with paginated results and advanced filtering using logical operators like AND, OR, NOT, and comparison queries."
|
|
openapi: post /v3/memories/
|
|
---
|
|
|
|
List memories scoped by filters with paginated results. Entity IDs (`user_id`, `agent_id`, `app_id`, `run_id`) **must** be passed inside the `filters` object: top-level entity IDs are rejected with 400.
|
|
|
|
Expired memories are hidden by default. Pass `show_expired: true` to include memories whose `expiration_date` has passed.
|
|
|
|
Python uses `show_expired`; TypeScript uses `showExpired`.
|
|
|
|
The `filters` object supports complex logical operations (AND, OR, NOT) and comparison operators:
|
|
|
|
- `in`: Matches any of the values specified
|
|
- `gte`: Greater than or equal to
|
|
- `lte`: Less than or equal to
|
|
- `gt`: Greater than
|
|
- `lt`: Less than
|
|
- `ne`: Not equal to
|
|
- `icontains`: Case-insensitive containment check
|
|
- `*`: Wildcard character that matches everything
|
|
|
|
Pass `page` and `page_size` as query parameters to paginate through results.
|
|
|
|
<CodeGroup>
|
|
```python Code
|
|
memories = client.get_all(
|
|
filters={
|
|
"AND": [
|
|
{
|
|
"user_id": "alex"
|
|
},
|
|
{
|
|
"created_at": {"gte": "2024-07-01", "lte": "2024-07-31"}
|
|
}
|
|
]
|
|
},
|
|
show_expired=False,
|
|
page=1,
|
|
page_size=50
|
|
)
|
|
```
|
|
|
|
```python Output
|
|
{
|
|
"count": 2,
|
|
"next": null,
|
|
"previous": null,
|
|
"results": [
|
|
{
|
|
"id": "f4cbdb08-7062-4f3e-8eb2-9f5c80dfe64c",
|
|
"memory": "Alex is planning a trip to San Francisco from July 1st to July 10th",
|
|
"expiration_date": null,
|
|
"created_at": "2024-07-01T12:00:00Z",
|
|
"updated_at": "2024-07-01T12:00:00Z"
|
|
},
|
|
{
|
|
"id": "a2b8c3d4-5e6f-7g8h-9i0j-1k2l3m4n5o6p",
|
|
"memory": "Alex prefers vegetarian restaurants",
|
|
"expiration_date": null,
|
|
"created_at": "2024-07-05T15:30:00Z",
|
|
"updated_at": "2024-07-05T15:30:00Z"
|
|
}
|
|
]
|
|
}
|
|
```
|
|
|
|
</CodeGroup>
|
|
|
|
<Info>
|
|
The response is a paginated envelope with `count`, `next`, `previous`, and `results`. Use `page` and `page_size` query params to step through results.
|
|
</Info>
|