Get Memories - Mem0
Documentation Index
Fetch the complete documentation index at: /llms.txt
Use this file to discover all available pages before exploring further.
cURL
curl -X POST 'https://api.mem0.ai/v3/memories/?page=1&page_size=50' \
-H "Authorization: Token <api-key>" \
-H "Content-Type: application/json" \
-d '{"filters": {"user_id": "alice"}}'
Python
from mem0 import MemoryClient
client = MemoryClient(api_key="your-api-key")
page = client.get_all(filters={"user_id": "alice"}, page=1, page_size=50)
# page == {"count": 123, "next": "...", "previous": None, "results": [...]}
print(page["count"], len(page["results"]))
TypeScript
import MemoryClient from "mem0ai";
const client = new MemoryClient({ apiKey: "your-api-key" });
const page = await client.getAll({
filters: { userId: "alice" },
page: 1,
pageSize: 50,
});
console.log(page.count, page.results.length);
PHP
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.mem0.ai/v3/memories/?page=1&page_size=100",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'filters' => [
'user_id' => 'alice'
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
Go
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.mem0.ai/v3/memories/?page=1&page_size=100"
payload := strings.NewReader("{\n \"filters\": {\n \"user_id\": \"alice\"\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}
Java
HttpResponse<String> response = Unirest.post("https://api.mem0.ai/v3/memories/?page=1&page_size=100")
.header("Content-Type", "application/json")
.body("{\n \"filters\": {\n \"user_id\": \"alice\"\n }\n}")
.asString();
Ruby
require 'uri'
require 'net/http'
url = URI("https://api.mem0.ai/v3/memories/?page=1&page_size=100")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"filters\": {\n \"user_id\": \"alice\"\n }\n}"
response = http.request(request)
puts response.read_body
Response Example
{
"count": 123,
"next": "https://api.mem0.ai/v3/memories/?page=2&page_size=100",
"previous": null,
"results": [
{
"id": "mem-uuid",
"memory": "User moved to San Francisco from New York in January 2026",
"metadata": {},
"categories": [
"location"
],
"created_at": "2026-01-15T10:30:00Z",
"updated_at": "2026-01-15T10:30:00Z"
}
]
}
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. The filters object supports complex logical operations (AND, OR, NOT) and comparison operators:
in: Matches any of the values specifiedgte: Greater than or equal tolte: Less than or equal togt: Greater thanlt: Less thanne: Not equal toicontains: Case-insensitive containment check*: Wildcard character that matches everything
Pass page and page_size as query parameters to paginate through results.
Query Parameters
page: integer (default: 1) - 1-indexed page number. Required range:x >= 1page_size: integer (default: 100) - Results per page. Required range:1 <= x <= 200
Body
filters: object (required) - Entity and metadata filters. Must include at least one entity ID (user_id,agent_id,app_id, orrun_id).show_expired: boolean (default: false) - When true, include memories whoseexpiration_datehas passed. Expired memories are hidden by default.
Response
count: integer (required) - Total number of memories matching the filters.next: string| null (required) - URL for the next page, or nullif this is the last page.previous: string| null (required) - URL for the previous page, or nullif this is the first page.results: object[] (required) - List of memory objects.