> ## Documentation Index
> Fetch the complete documentation index at: https://www.sapientpriors.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Forget something a user said

> Delete every memory made from a specific turn and check adjacent turns that echoed it

## Example use case

A prospect accidentally pastes a personal phone number into your sales agent, or a teammate posts an unapproved figure into the team assistant. You need to erase what the agent learned from that message without losing the rest of the agent's memory.

## Setup

Call with a key whose role may delete memories: a service account with the Project admin role, or an Agent admin of this agent. Omit `X-SP-End-User`:

1. Locate the turn with [GET`/v2/agents/{agent_id}/memories`](https://www.sapientpriors.com/docs/api-reference/v2/memories/list-memories), filtering by `thread_id` or `speaker_id` and following `next_cursor` until you find its `turn_id`.
2. Forget the turn with [DELETE`/v2/agents/{agent_id}/memories/{turn_id}`](https://www.sapientpriors.com/docs/api-reference/v2/memories/forget-a-memory), URL-encoding `turn_id` because an id can contain `/` or `#`.

Priors returns `204` and deletes every memory made from that turn. The turn record remains in conversation history with `state: "forgotten"` so resumes never re-learn it.

## Benefit with Priors

* **Surgical removal:** erase one mistaken or sensitive turn without resetting weeks of accumulated context.
* **Works anytime:** forgetting works both while the thread is active and after the thread has been deleted.

## What goes wrong

> [!WARNING]
>
> Forgetting one turn deletes only memories made from that exact turn. If the same fact was repeated in another user message or echoed in a learned agent reply (`learn_reply: true`), those other turns still hold their memories until forgotten too. Calling `DELETE` while a turn is still `learning` or on a document piece (`file_piece: true`) returns `409 conflict`.

## Recommendation

When erasing sensitive or erroneous content, inspect surrounding turns in the same thread (including the agent's reply) via [GET`.../memories?thread_id={thread_id}`](https://www.sapientpriors.com/docs/api-reference/v2/memories/list-memories) and forget every turn that echoed the fact. If the turn came from an uploaded file, delete the file instead.

## Calls used

* Guides: [Memories](https://www.sapientpriors.com/docs/concepts/memories.md), [Your data](https://www.sapientpriors.com/docs/data.md)
* API reference: [List memories](https://www.sapientpriors.com/docs/api-reference/v2/memories/list-memories.md), [Forget a memory](https://www.sapientpriors.com/docs/api-reference/v2/memories/forget-a-memory.md)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.