Delete Memory

Updated at:

Delete a specified memory node

Deletes a specified memory node.

WarningDeletion is irreversible. Proceed with caution.

Method and endpoint

DELETE https://{WorkspaceId}.cn-beijing.maas.aliyuncs.com/api/v2/apps/memory/memory_nodes/{memory_node_id}

Replace {WorkspaceId} with your actual workspace ID.

Request parameters

ParameterTypeRequiredLocationDescription
memory_node_idstringYesPathMemory node ID
memory_library_idstringNoQueryMemory library ID. If omitted, the default memory library is used

Response

FieldTypeDescription
request_idstringRequest ID

Request example

curl --location --request DELETE 'https://{WorkspaceId}.cn-beijing.maas.aliyuncs.com/api/v2/apps/memory/memory_nodes/42dfc089dfa7409889966960a95c3b7e?memory_library_id=memory_library_001' \
  --header "Authorization: Bearer $DASHSCOPE_API_KEY"
from agentscope_runtime.tools.modelstudio_memory import (
    DeleteMemory, DeleteMemoryInput,
)
import asyncio

async def main():
    delete_memory = DeleteMemory()
    try:
        await delete_memory.arun(DeleteMemoryInput(
            user_id="user_001",
            memory_node_id="MEMORY_NODE_ID"
        ))
        print("Memory deleted successfully")
    finally:
        await delete_memory.close()

asyncio.run(main())

Response example

{
  "request_id": "a1b2c3d4-5678-90ab-cdef-1234567890ab"
}

ImportantFor user profile APIs, see Create Profile Schema.