Skip to main content
DELETE
/
user_memory
/
delete_user_memory
Delete User Memory
curl --request DELETE \
  --url https://api.usecortex.ai/user_memory/delete_user_memory \
  --header 'Authorization: Bearer <token>'
{
  "success": true,
  "user_memory_deleted": true
}
Hit the Try it button to try this API now in our playground. It’s the best way to check the full request and response in one place, customize your parameters, and generate ready-to-use code snippets.

Sample Request

curl --request DELETE \
  --url 'https://api.usecortex.ai/user_memory/delete_user_memory?tenant_id=tenant_1234&memory_id=memory_1234&sub_tenant_id=sub_tenant_4567' \
  --header 'Authorization: Bearer YOUR_API_KEY'

Overview

The Delete User Memory endpoint allows you to remove specific memories from a user’s memory profile. This is useful for maintaining data quality, removing outdated information, or giving users control over their stored personal data.

Functionality

  • Targeted Deletion: Removes a specific memory using its unique memory ID
  • User Context Validation: Ensures the memory belongs to the authenticated user
  • Immediate Removal: Permanently deletes the memory from the vector store
  • Confirmation Response: Returns clear success/failure status for the deletion operation
  • Tenant Isolation: Operates within the specified tenant/sub-tenant context

Use Cases

  • Data Cleanup: Remove outdated or incorrect memories
  • Privacy Compliance: Allow users to delete their personal data
  • Memory Management: Maintain high-quality memory profiles by removing irrelevant information
  • Error Correction: Delete memories that were added incorrectly
  • User Control: Give users the ability to manage their own memory data

Finding Memory IDs

To delete a memory, you first need to find its ID using the List User Memories endpoint:
# First, list all memories to find the ID
curl -X GET "https://api.cortex.com/user_memory/list_user_memories?tenant_id=company_123&sub_tenant_id=marketing_team" \
  -H "Authorization: Bearer YOUR_API_KEY"

# Response will include source_id for each memory
{
  "success": true,
  "user_memories": [
    {
      "source_id": "mem_001_abc123",  # This is the memory_id to use
      "source_content": "User prefers detailed technical explanations..."
    }
  ]
}

# Then delete using the source_id
curl -X DELETE "https://api.cortex.com/user_memory/delete_user_memory?tenant_id=company_123&sub_tenant_id=marketing_team&memory_id=mem_001_abc123" \
  -H "Authorization: Bearer YOUR_API_KEY"

Important Notes

Permanent Deletion: Once a memory is deleted, it cannot be recovered. Make sure you have the correct memory ID before proceeding with deletion.
Memory ID Source: Memory IDs (source_id) can be obtained from the List User Memories endpoint or from the response of Add User Memory and Generate User Memory endpoints.
Best Practices:
  • Always verify the memory content before deletion using the List endpoint
  • Consider implementing user confirmation for memory deletion
  • Log deletion activities for audit purposes
  • Provide users with a way to review their memories before deletion
Pro Tip: For bulk memory management, you can combine this API with the List API to create a memory management interface that allows users to review and selectively delete their memories.

Response Fields

FieldTypeDescription
successbooleanIndicates whether the operation was successful
user_memory_deletedbooleanConfirms whether the specific memory was successfully deleted

Parameters

ParameterTypeRequiredDescription
tenant_idstringYesPrimary organizational identifier
sub_tenant_idstringYesSecondary organizational identifier
memory_idstringYesUnique identifier of the memory to delete

Error Responses

All endpoints return consistent error responses following the standard format. For detailed error information, see our Error Responses documentation.

Authorizations

Authorization
string
header
required

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

Query Parameters

tenant_id
string
required

Unique identifier for the tenant/organization

Example:

"tenant_1234"

memory_id
string
required

Unique identifier of the memory to delete

Example:

"memory_1234"

sub_tenant_id
string
default:""

Optional sub-tenant identifier used to organize data within a tenant. If omitted, the default sub-tenant created during tenant setup will be used.

Example:

"sub_tenant_4567"

Response

Successful Response

Response model for deleting a user memory.

success
boolean
required

Indicates whether the memory deletion operation was successful

Example:

true

user_memory_deleted
boolean
required

Confirms whether the specific memory was successfully deleted

Example:

true

I