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

# Delete Memory

> Remove a specific memory by ID

## `memory.delete`

Permanently deletes a memory from the database.

## Parameters

<ParamField body="id" type="string" required>
  UUID of the memory to delete
</ParamField>

## Response

<ResponseField name="success" type="boolean">
  Returns `true` if the memory was successfully deleted
</ResponseField>

## Examples

<CodeGroup>
  ```typescript TypeScript theme={null}
  await client.memory.delete.mutate({
    id: '550e8400-e29b-41d4-a716-446655440000',
  });

  console.log('Memory deleted');
  ```

  ```bash cURL theme={null}
  curl -X POST 'https://api.usesatori.sh/trpc/memory.delete' \
    -H 'x-api-key: sk_satori_...' \
    -H 'Content-Type: application/json' \
    -d '{"id":"550e8400-e29b-41d4-a716-446655440000"}'
  ```
</CodeGroup>

<ResponseExample>
  ```json Success (200) theme={null}
  {
    "success": true
  }
  ```

  ```json Error (404) theme={null}
  {
    "error": {
      "message": "Memory not found",
      "code": "NOT_FOUND"
    }
  }
  ```
</ResponseExample>

<Warning>
  Deletion is permanent and cannot be undone. Make sure you have the correct memory ID before deleting.
</Warning>

## Use Cases

<AccordionGroup>
  <Accordion title="User-requested deletion">
    ```typescript theme={null}
    // User says "forget that I like TypeScript"
    const memories = await client.memory.search.query({
      userId: 'user-123',
      query: 'TypeScript preference',
      threshold: 0.9,
    });

    if (memories.length > 0) {
      await client.memory.delete.mutate({
        id: memories[0].id,
      });
    }
    ```
  </Accordion>

  <Accordion title="GDPR compliance">
    ```typescript theme={null}
    // Delete all memories for a user
    const memories = await client.memory.getAll.query({
      userId: 'user-123',
    });

    for (const memory of memories) {
      await client.memory.delete.mutate({
        id: memory.id,
      });
    }
    ```
  </Accordion>

  <Accordion title="Memory cleanup">
    ```typescript theme={null}
    // Delete old memories
    const memories = await client.memory.getAll.query({
      userId: 'user-123',
    });

    const sixMonthsAgo = Date.now() - 6 * 30 * 24 * 60 * 60 * 1000;

    for (const memory of memories) {
      if (new Date(memory.createdAt).getTime() < sixMonthsAgo) {
        await client.memory.delete.mutate({ id: memory.id });
      }
    }
    ```
  </Accordion>
</AccordionGroup>

## Related Endpoints

<CardGroup cols={2}>
  <Card title="Get All Memories" icon="list" href="/api-reference/memory/get-all">
    Find memories to delete
  </Card>

  <Card title="Search Memories" icon="magnifying-glass" href="/api-reference/memory/search">
    Find specific memories to delete
  </Card>
</CardGroup>
