Forget session memories
- Base URL
-
https://{kibana_url}
- POST /api/context_engine/memory/_forget
- POST /s/{space_id}/api/context_engine/memory/_forget
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 privileges
contextEngine:write. Extended privileges (optional, expand functionality when granted): contextEngine:manage_memory
Path parameters
-
space_idstringoptional -
An identifier for the space. If
space_idis not provided in the URL, the default space is used. Refer to Spaces for more information.
Responses
The outcome for every requested memory.
-
resultsobject[] · max items: 100required -
One result per unique id, in request order.
-
outcomeenumrequired -
What happened to the memory:
forgottenif a tombstone was written,already_forgottenif it was already tombstoned,not_foundif it does not exist or belongs to another user or space, orfailedif Elasticsearch rejected the tombstone. -
Values:
forgottenalready_forgottennot_foundfailed
user_id is missing and the caller has no user profile, or user_id names another user and the caller lacks contextEngine:manage_memory.