Skip to main content
DELETE
/
v1
/
memories
/
Python
# To use the Python SDK, install the package:
# pip install mem0ai

from mem0 import MemoryClient
client = MemoryClient(api_key="your_api_key")

# Delete all memories for a specific user
client.delete_all(user_id="<user_id>")

# Delete all memories for every user in the project (wildcard)
client.delete_all(user_id="*")

# Full project wipe: all four filters must be explicitly set to "*"
client.delete_all(user_id="*", agent_id="*", app_id="*", run_id="*")

# NOTE: Calling delete_all() with no filters raises a validation error.
# At least one filter is required to prevent accidental data loss.
// To use the JavaScript SDK, install the package:
// npm i mem0ai

import MemoryClient from 'mem0ai';
const client = new MemoryClient({ apiKey: "your-api-key" });

// Delete all memories for a specific user
client.deleteAll({ user_id: "<user_id>" })
.then(result => console.log(result))
.catch(error => console.error(error));

// Delete all memories for every user in the project (wildcard)
client.deleteAll({ user_id: "*" })
.then(result => console.log(result))
.catch(error => console.error(error));

// Full project wipe: all four filters must be explicitly set to "*"
client.deleteAll({ user_id: "*", agent_id: "*", app_id: "*", run_id: "*" })
.then(result => console.log(result))
.catch(error => console.error(error));
# Delete memories for a specific user
curl --request DELETE \
--url 'https://api.mem0.ai/v1/memories/?user_id=<user_id>' \
--header 'Authorization: Token <api-key>'

# Delete memories for all users (wildcard)
curl --request DELETE \
--url 'https://api.mem0.ai/v1/memories/?user_id=*' \
--header 'Authorization: Token <api-key>'

# Full project wipe: all four filters must be set to *
curl --request DELETE \
--url 'https://api.mem0.ai/v1/memories/?user_id=*&agent_id=*&app_id=*&run_id=*' \
--header 'Authorization: Token <api-key>'
package main

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

func main() {

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

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/",
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/")
.header("Authorization", "Token <api-key>")
.asString();
require 'uri'
require 'net/http'

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

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": "Memories deleted successfully!"
}

Authorizations

Authorization
string
header
required

API key authentication. Prefix your Mem0 API key with 'Token '. Example: 'Token your_api_key'

Query Parameters

user_id
string

Filter by user ID. Pass * to delete memories for all users.

agent_id
string

Filter by agent ID. Pass * to delete memories for all agents.

app_id
string

Filter by app ID. Pass * to delete memories for all apps.

run_id
string

Filter by run ID. Pass * to delete memories for all runs.

metadata
object

Filter memories by metadata (JSON string).

org_id
string

Filter memories by organization ID.

project_id
string

Filter memories by project ID.

Response

204 - application/json

Successful deletion of memories.

message
string
Example:

"Memories deleted successfully!"