curl -X DELETE 'https://api.memchat.io/memories/mem_123abc' \
-H 'X-API-Key: YOUR_API_KEY'
import requests
url = "https://api.memchat.io/memories/mem_123abc"
headers = {
"X-API-Key": "YOUR_API_KEY"
}
response = requests.delete(url, headers=headers)
result = response.json()
const response = await fetch('https://api.memchat.io/memories/mem_123abc', {
method: 'DELETE',
headers: {
'X-API-Key': 'YOUR_API_KEY',
},
});
const result = await response.json();
{
"success": true,
"memory_id": "mem_123abc",
"deleted_at": "2024-01-15T16:45:00Z",
"cascade_deletions": {
"profile_updates": 2,
"derived_insights": 1,
"embeddings": 1
},
"backup_id": "backup_456def"
}
Memory Management
Delete Memory
Permanently delete a memory entry and its associated embeddings
DELETE
/
memories
/
{memory_id}
curl -X DELETE 'https://api.memchat.io/memories/mem_123abc' \
-H 'X-API-Key: YOUR_API_KEY'
import requests
url = "https://api.memchat.io/memories/mem_123abc"
headers = {
"X-API-Key": "YOUR_API_KEY"
}
response = requests.delete(url, headers=headers)
result = response.json()
const response = await fetch('https://api.memchat.io/memories/mem_123abc', {
method: 'DELETE',
headers: {
'X-API-Key': 'YOUR_API_KEY',
},
});
const result = await response.json();
{
"success": true,
"memory_id": "mem_123abc",
"deleted_at": "2024-01-15T16:45:00Z",
"cascade_deletions": {
"profile_updates": 2,
"derived_insights": 1,
"embeddings": 1
},
"backup_id": "backup_456def"
}
Permanently removes a memory entry from the user’s memory store. This action cannot be undone.
This operation is irreversible. Once a memory is deleted, it cannot be recovered.
curl -X DELETE 'https://api.memchat.io/memories/mem_123abc' \
-H 'X-API-Key: YOUR_API_KEY'
import requests
url = "https://api.memchat.io/memories/mem_123abc"
headers = {
"X-API-Key": "YOUR_API_KEY"
}
response = requests.delete(url, headers=headers)
result = response.json()
const response = await fetch('https://api.memchat.io/memories/mem_123abc', {
method: 'DELETE',
headers: {
'X-API-Key': 'YOUR_API_KEY',
},
});
const result = await response.json();
Path Parameters
string
required
The unique identifier of the memory to delete
Query Parameters
boolean
default:"false"
Whether to cascade delete related data (e.g., derived insights, profile updates)
boolean
default:"true"
Whether to create a backup before deletion (for compliance/audit purposes)
Response
boolean
Indicates if the deletion was successful
string
ID of the deleted memory
string
ISO 8601 timestamp when the memory was deleted
object
string
ID of the backup created (if backup=true)
{
"success": true,
"memory_id": "mem_123abc",
"deleted_at": "2024-01-15T16:45:00Z",
"cascade_deletions": {
"profile_updates": 2,
"derived_insights": 1,
"embeddings": 1
},
"backup_id": "backup_456def"
}
Error Responses
object
Memory not found
{
"error": "Memory not found",
"code": "MEMORY_NOT_FOUND",
"memory_id": "mem_123abc"
}
object
Unauthorized access
{
"error": "Invalid or expired token",
"code": "UNAUTHORIZED"
}
object
Access denied - memory belongs to another user
{
"error": "Access denied",
"code": "FORBIDDEN"
}
object
Cannot delete - memory is being processed
{
"error": "Memory is currently being processed and cannot be deleted",
"code": "DELETION_CONFLICT",
"processing_status": "embedding_generation"
}
object
Internal server error during deletion
{
"error": "Failed to delete memory",
"code": "DELETION_FAILED",
"retry_after": 30
}
Batch Deletion
For deleting multiple memories at once, use the batch endpoint:POST /memories/batch-delete
{
"memory_ids": ["mem_123abc", "mem_456def", "mem_789ghi"],
"cascade": true,
"backup": true
}
Recovery Options
While deleted memories cannot be restored through the API, backups are created for compliance purposes:- Backups: Available for 30 days for compliance/audit purposes
- Contact Support: For accidental deletions, contact support with the backup_id
- Data Export: Consider using the data export feature before bulk deletions
Impact on User Profile
Deleting memories may affect:- Profile Bio: Auto-generated bio may be updated
- Category Profiles: Statistics and insights for the memory’s category
- Derived Insights: Any insights based on the deleted memory
- Search Results: Memory will no longer appear in search results
cascade=true parameter to automatically clean up related data, or cascade=false to preserve derived insights for analysis.
