Skip to main content
POST
/
v3
/
memories
/
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"}}'
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"]))
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/",
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;
}
package main

import (
"fmt"
"strings"
"net/http"
"io"
)

func main() {

url := "https://api.mem0.ai/v3/memories/"

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))

}
HttpResponse<String> response = Unirest.post("https://api.mem0.ai/v3/memories/")
.header("Content-Type", "application/json")
.body("{\n \"filters\": {\n \"user_id\": \"alice\"\n }\n}")
.asString();
require 'uri'
require 'net/http'

url = URI("https://api.mem0.ai/v3/memories/")

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
{
  "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. 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.
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
)
{
    "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"
        }
    ]
}
The response is a paginated envelope with count, next, previous, and results. Use page and page_size query params to step through results.

Query Parameters

page
integer
default:1

1-indexed page number.

Required range: x >= 1
page_size
integer
default:100

Results per page.

Required range: 1 <= x <= 200

Body

application/json
filters
object
required

Entity and metadata filters. Must include at least one entity ID (user_id, agent_id, app_id, or run_id).

show_expired
boolean
default:false

When true, include memories whose expiration_date has passed. Expired memories are hidden by default.

Response

Paginated envelope of memories.

count
integer
required

Total number of memories matching the filters.

next
string<uri> | null
required

URL for the next page, or null if this is the last page.

previous
string<uri> | null
required

URL for the previous page, or null if this is the first page.

results
object[]
required