Python
# To use the Python SDK, install the package:
# pip install mem0ai
from mem0 import MemoryClient
client = MemoryClient(api_key="your_api_key")
memory_export_id = "<memory_export_id>"
response = client.get_memory_export(memory_export_id=memory_export_id)
print(response)// To use the JavaScript SDK, install the package:
// npm i mem0ai
import MemoryClient from 'mem0ai';
const client = new MemoryClient({ apiKey: "your-api-key" });
const memory_export_id = "<memory_export_id>";
// Get memory export
client.getMemoryExport({ memory_export_id })
.then(result => console.log(result))
.catch(error => console.error(error));curl --request POST \
--url 'https://api.mem0.ai/v1/exports/get/' \
--header 'Authorization: Token <api-key>' \
--data '{
"memory_export_id": "<memory_export_id>"
}'package main
import (
"fmt"
"net/http"
"io/ioutil"
)
func main() {
memory_export_id := "<memory_export_id>"
req, _ := http.NewRequest("POST", "https://api.mem0.ai/v1/exports/get/", nil)
req.Header.Add("Authorization", "Token <api-key>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := ioutil.ReadAll(res.Body)
fmt.Println(string(body))
}<?php
$curl = curl_init();
$data = json_encode(['memory_export_id' => '<memory_export_id>']);
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.mem0.ai/v1/exports/get/",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => $data,
CURLOPT_HTTPHEADER => [
"Authorization: Token <api-key>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}String data = "{\"memory_export_id\":\"<memory_export_id>\"}";
HttpResponse<String> response = Unirest.post("https://api.mem0.ai/v1/exports/get/")
.header("Authorization", "Token <api-key>")
.header("Content-Type", "application/json")
.body(data)
.asString();require 'uri'
require 'net/http'
url = URI("https://api.mem0.ai/v1/exports/get")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"memory_export_id\": \"<string>\",\n \"filters\": {\n \"user_id\": \"<string>\",\n \"agent_id\": \"<string>\",\n \"app_id\": \"<string>\",\n \"run_id\": \"<string>\",\n \"created_at\": \"<string>\",\n \"updated_at\": \"<string>\"\n },\n \"org_id\": \"<string>\",\n \"project_id\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{}{
"message": "One of the filters: app_id, user_id, agent_id, run_id is required!"
}{
"error": "No memory export request found"
}Memory Management
Get Memory Export
Retrieve the latest structured memory export after submitting an export job, with optional entity filters.
POST
/
v1
/
exports
/
get
Python
# To use the Python SDK, install the package:
# pip install mem0ai
from mem0 import MemoryClient
client = MemoryClient(api_key="your_api_key")
memory_export_id = "<memory_export_id>"
response = client.get_memory_export(memory_export_id=memory_export_id)
print(response)// To use the JavaScript SDK, install the package:
// npm i mem0ai
import MemoryClient from 'mem0ai';
const client = new MemoryClient({ apiKey: "your-api-key" });
const memory_export_id = "<memory_export_id>";
// Get memory export
client.getMemoryExport({ memory_export_id })
.then(result => console.log(result))
.catch(error => console.error(error));curl --request POST \
--url 'https://api.mem0.ai/v1/exports/get/' \
--header 'Authorization: Token <api-key>' \
--data '{
"memory_export_id": "<memory_export_id>"
}'package main
import (
"fmt"
"net/http"
"io/ioutil"
)
func main() {
memory_export_id := "<memory_export_id>"
req, _ := http.NewRequest("POST", "https://api.mem0.ai/v1/exports/get/", nil)
req.Header.Add("Authorization", "Token <api-key>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := ioutil.ReadAll(res.Body)
fmt.Println(string(body))
}<?php
$curl = curl_init();
$data = json_encode(['memory_export_id' => '<memory_export_id>']);
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.mem0.ai/v1/exports/get/",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => $data,
CURLOPT_HTTPHEADER => [
"Authorization: Token <api-key>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}String data = "{\"memory_export_id\":\"<memory_export_id>\"}";
HttpResponse<String> response = Unirest.post("https://api.mem0.ai/v1/exports/get/")
.header("Authorization", "Token <api-key>")
.header("Content-Type", "application/json")
.body(data)
.asString();require 'uri'
require 'net/http'
url = URI("https://api.mem0.ai/v1/exports/get")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"memory_export_id\": \"<string>\",\n \"filters\": {\n \"user_id\": \"<string>\",\n \"agent_id\": \"<string>\",\n \"app_id\": \"<string>\",\n \"run_id\": \"<string>\",\n \"created_at\": \"<string>\",\n \"updated_at\": \"<string>\"\n },\n \"org_id\": \"<string>\",\n \"project_id\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{}{
"message": "One of the filters: app_id, user_id, agent_id, run_id is required!"
}{
"error": "No memory export request found"
}Retrieve the latest structured memory export after submitting an export job. You can filter the export by
user_id, agent_id, app_id, run_id, created_at, or updated_at to get the most recent export matching your filters.Authorizations
API key authentication. Prefix your Mem0 API key with 'Token '. Example: 'Token your_api_key'
Body
application/json
The unique identifier of the memory export.
Filters to apply while exporting memories. Available fields are: user_id, agent_id, app_id, run_id, created_at, updated_at.
Show child attributes
Show child attributes
Filter exports by organization ID.
Filter exports by project ID.
Response
Successful export.
Export data response in an object format.
Was this page helpful?
⌘I