Python
# To use the Python SDK, install the package:
# pip install mem0ai
from mem0 import MemoryClient
client = MemoryClient(api_key="your_api_key")
memory_id = "<memory_id>"
client.delete(memory_id=memory_id)// To use the JavaScript SDK, install the package:
// npm i mem0ai
import MemoryClient from 'mem0ai';
const client = new MemoryClient({ apiKey: "your-api-key" });
// Delete a specific memory
client.delete("<memory_id>")
.then(result => console.log(result))
.catch(error => console.error(error));curl --request DELETE \
--url https://api.mem0.ai/v1/memories/{memory_id}/ \
--header 'Authorization: Token <api-key>'package main
import (
"fmt"
"net/http"
"io/ioutil"
)
func main() {
url := "https://api.mem0.ai/v1/memories/{memory_id}/"
req, _ := http.NewRequest("DELETE", url, nil)
req.Header.Add("Authorization", "Token <api-key>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := ioutil.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.mem0.ai/v1/memories/{memory_id}/",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "DELETE",
CURLOPT_HTTPHEADER => [
"Authorization: Token <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}HttpResponse<String> response = Unirest.delete("https://api.mem0.ai/v1/memories/{memory_id}/")
.header("Authorization", "Token <api-key>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.mem0.ai/v1/memories/{memory_id}/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Delete.new(url)
request["Authorization"] = '<api-key>'
response = http.request(request)
puts response.read_body{
"message": "Memory deleted successfully!"
}Core Memory Operations
Delete Memory
Delete a single memory by its unique memory ID from the Mem0 platform using the DELETE endpoint.
DELETE
/
v1
/
memories
/
{memory_id}
/
Python
# To use the Python SDK, install the package:
# pip install mem0ai
from mem0 import MemoryClient
client = MemoryClient(api_key="your_api_key")
memory_id = "<memory_id>"
client.delete(memory_id=memory_id)// To use the JavaScript SDK, install the package:
// npm i mem0ai
import MemoryClient from 'mem0ai';
const client = new MemoryClient({ apiKey: "your-api-key" });
// Delete a specific memory
client.delete("<memory_id>")
.then(result => console.log(result))
.catch(error => console.error(error));curl --request DELETE \
--url https://api.mem0.ai/v1/memories/{memory_id}/ \
--header 'Authorization: Token <api-key>'package main
import (
"fmt"
"net/http"
"io/ioutil"
)
func main() {
url := "https://api.mem0.ai/v1/memories/{memory_id}/"
req, _ := http.NewRequest("DELETE", url, nil)
req.Header.Add("Authorization", "Token <api-key>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := ioutil.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.mem0.ai/v1/memories/{memory_id}/",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "DELETE",
CURLOPT_HTTPHEADER => [
"Authorization: Token <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}HttpResponse<String> response = Unirest.delete("https://api.mem0.ai/v1/memories/{memory_id}/")
.header("Authorization", "Token <api-key>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.mem0.ai/v1/memories/{memory_id}/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Delete.new(url)
request["Authorization"] = '<api-key>'
response = http.request(request)
puts response.read_body{
"message": "Memory deleted successfully!"
}Authorizations
API key authentication. Prefix your Mem0 API key with 'Token '. Example: 'Token your_api_key'
Path Parameters
The unique identifier of the memory to retrieve.
Response
204 - application/json
Successful deletion of memory.
Example:
"Memory deleted successfully!"
Was this page helpful?
⌘I