Spaces method and path for this operation:
Refer to Spaces for more information.
Forgets session memories by ID for the target user. The route reports a memory of another user or another space as not_found, so it does not reveal whether the memory exists.
Requires the contextEngine:write privilege. Without user_id, the route forgets the caller's own memories, and a caller without a user profile gets a 403. Naming another user in user_id also requires contextEngine:manage_memory.
Forgetting writes a tombstone so reads stop returning the memory after the next Elasticsearch refresh, while Elasticsearch keeps its revisions until retention removes them. A read immediately after forgetting can still return the memory, and forgetting a memory right after writing it can return not_found until that write is visible. If Elasticsearch rejects a tombstone, the route returns failed with error and the caller can retry that ID.
After authorization, validation, and feature-flag checks pass, the route writes one memory_forget audit event per unique memory ID. Forgetting still works when memory is turned off.
Returns a 404 response when Context Engine is turned off in this space (contextEngine:enabled).
For more information, refer to the Context Engine documentation.
[Required authorization] Route required privileges: contextEngine:write. Extended privileges (optional, expand functionality when granted): contextEngine:manage_memory.
Body
-
The ids of the memories to forget. The route collapses duplicates.
At least
1but not more than100elements. Minimum length of each is1, maximum length of each is256. -
The Kibana user profile UID that the memories belong to. Omit this field to use the caller's user profile. Naming another user requires
contextEngine:manage_memory.Minimum length is
1, maximum length is1024.
curl \
-X POST "https://${KIBANA_URL}/api/context_engine/memory/_forget" \
-H "Authorization: ApiKey ${API_KEY}" \
-H "Content-Type: application/json" \
-H "kbn-xsrf: true" \
-d '{
"ids": ["7c1f0b2e-5a43-4b0e-9a57-2f0f6f1d3a10", "0d4e8a91-6c2b-4f3a-8d15-9b7e1c5a2f44"]
}'
POST kbn:/api/context_engine/memory/_forget
{
"ids": ["7c1f0b2e-5a43-4b0e-9a57-2f0f6f1d3a10", "0d4e8a91-6c2b-4f3a-8d15-9b7e1c5a2f44"]
}
{
"ids": [
"7c1f0b2e-5a43-4b0e-9a57-2f0f6f1d3a10",
"0d4e8a91-6c2b-4f3a-8d15-9b7e1c5a2f44"
]
}
{
"results": [
{
"id": "7c1f0b2e-5a43-4b0e-9a57-2f0f6f1d3a10",
"outcome": "forgotten"
},
{
"error": "index [.ds-.context-engine-session-memory-2026.11.16-000001] blocked by: [TOO_MANY_REQUESTS/12/disk usage exceeded flood-stage watermark, index has read-only-allow-delete block];",
"id": "0d4e8a91-6c2b-4f3a-8d15-9b7e1c5a2f44",
"outcome": "failed"
}
]
}
{
"results": [
{
"id": "7c1f0b2e-5a43-4b0e-9a57-2f0f6f1d3a10",
"outcome": "forgotten"
},
{
"id": "0d4e8a91-6c2b-4f3a-8d15-9b7e1c5a2f44",
"outcome": "not_found"
}
]
}
{
"error": "Forbidden",
"message": "Acting on the memory of another user requires the [contextEngine:manage_memory] privilege.",
"statusCode": 403
}
{
"error": "Forbidden",
"message": "The caller has no user profile, so the request cannot be attributed to a user. Log in to Kibana once to create a profile, use an API key whose owner has one, or set `user_id` if you have the `contextEngine:manage_memory` privilege.",
"statusCode": 403
}
{
"error": "Not Found",
"message": "Not Found",
"statusCode": 404
}