Get Memory Export - Mem0

Documentation Index

Fetch the complete documentation index at: /llms.txt

Use this file to discover all available pages before exploring further.

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)

JavaScript

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

curl --request POST \
  --url 'https://api.mem0.ai/v1/exports/get/' \
  --header 'Authorization: Token <api-key>' \
  --data '{
    "memory_export_id": "<memory_export_id>"
}'

Go

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

<?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;
}
?>

Java

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

Ruby

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

Response Codes

{}
{
  "message": "One of the filters: app_id, user_id, agent_id, run_id is required!"
}
{
  "error": "No memory export request found"
}

Instructions

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

Body Parameters