Python
# To use the Python SDK, install the package:
# pip install mem0ai
from mem0 import MemoryClient
client = MemoryClient(api_key="your_api_key")
# Submit feedback for a memory
feedback = client.feedback(memory_id="memory_id", feedback="POSITIVE")
print(feedback)// To use the JavaScript SDK, install the package:
// npm install mem0ai
import MemoryClient from 'mem0ai';
const client = new MemoryClient({ apiKey: 'your-api-key'});
client.feedback({
memory_id: "your-memory-id",
feedback: "NEGATIVE",
feedback_reason: "I don't like this memory because it is not relevant."
})curl --request POST \
--url https://api.mem0.ai/v1/feedback/ \
--header 'Authorization: Token <api-key>' \
--header 'Content-Type: application/json' \
--data '{"memory_id": "memory_id", "feedback": "POSITIVE"}'<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.mem0.ai/v1/feedback/",
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([
'memory_id' => '<string>',
'feedback_reason' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Authorization: <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;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.mem0.ai/v1/feedback/"
payload := strings.NewReader("{\n \"memory_id\": \"<string>\",\n \"feedback_reason\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "<api-key>")
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/v1/feedback/")
.header("Authorization", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"memory_id\": \"<string>\",\n \"feedback_reason\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.mem0.ai/v1/feedback/")
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_id\": \"<string>\",\n \"feedback_reason\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"feedback_reason": "<string>"
}Memory Management
Feedback
Submit positive or negative feedback on memory results to help improve memory accuracy and relevance.
POST
/
v1
/
feedback
/
Python
# To use the Python SDK, install the package:
# pip install mem0ai
from mem0 import MemoryClient
client = MemoryClient(api_key="your_api_key")
# Submit feedback for a memory
feedback = client.feedback(memory_id="memory_id", feedback="POSITIVE")
print(feedback)// To use the JavaScript SDK, install the package:
// npm install mem0ai
import MemoryClient from 'mem0ai';
const client = new MemoryClient({ apiKey: 'your-api-key'});
client.feedback({
memory_id: "your-memory-id",
feedback: "NEGATIVE",
feedback_reason: "I don't like this memory because it is not relevant."
})curl --request POST \
--url https://api.mem0.ai/v1/feedback/ \
--header 'Authorization: Token <api-key>' \
--header 'Content-Type: application/json' \
--data '{"memory_id": "memory_id", "feedback": "POSITIVE"}'<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.mem0.ai/v1/feedback/",
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([
'memory_id' => '<string>',
'feedback_reason' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Authorization: <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;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.mem0.ai/v1/feedback/"
payload := strings.NewReader("{\n \"memory_id\": \"<string>\",\n \"feedback_reason\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "<api-key>")
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/v1/feedback/")
.header("Authorization", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"memory_id\": \"<string>\",\n \"feedback_reason\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.mem0.ai/v1/feedback/")
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_id\": \"<string>\",\n \"feedback_reason\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"feedback_reason": "<string>"
}Authorizations
API key authentication. Prefix your Mem0 API key with 'Token '. Example: 'Token your_api_key'
Body
application/json
Was this page helpful?
⌘I