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

# Edit Memory

> Update fields on an existing memory for the active agent.

## Overview

Updates an existing memory using a delete-and-recreate pattern on Moorcheh. The memory retains its original `id` and `created_at` timestamp, but updates its `updated_at` timestamp. You must provide at least one field to update.

## Authentication

API clients do not send an API key or `Authorization` header.

<ParamField header="X-Session-Token" type="string" required>
  Session token from [Activate Agent](/api-reference/sessions/activate-agent). Must match `agent_id`.
</ParamField>

## Path Parameters

<ParamField path="agent_id" type="string" required>
  The unique identifier of the agent.
</ParamField>

<ParamField path="memory_id" type="string" required>
  The ID of the memory to update.
</ParamField>

## Body

<ParamField body="title" type="string">
  New memory title. Max 100 characters.
</ParamField>

<ParamField body="content" type="string">
  New memory content. Max 10,000 characters. Must be a non-empty string if provided.
</ParamField>

<ParamField body="type" type="string">
  New memory type (e.g., `fact`, `preference`, `decision`, etc.).
</ParamField>

<ParamField body="confidence" type="number">
  New confidence score between 0.0 and 1.0.
</ParamField>

<ParamField body="tags" type="array">
  List of strings representing the new tags.
</ParamField>

<ParamField body="source" type="string">
  New memory source string.
</ParamField>

<RequestExample>
  ```bash cURL theme={null}
  curl -X PATCH \
    "http://localhost:8000/api/v2/agents/my-agent/memories/b7c3cf31-e537-49f1-abc4-c50ac6adeac5" \
    -H "X-Session-Token: your_session_token" \
    -H "Content-Type: application/json" \
    -d '{
      "content": "User prefers light mode (updated)",
      "confidence": 0.99
    }'
  ```
</RequestExample>

<ResponseExample>
  ```json 200 - OK theme={null}
  {
    "agent_id": "my-agent",
    "session_id": "sess_abc123",
    "namespace": "memanto_agent_my-agent",
    "memory_id": "b7c3cf31-e537-49f1-abc4-c50ac6adeac5",
    "status": "updated",
    "action": "updated",
    "updated_fields": [
      "content",
      "confidence"
    ]
  }
  ```

  ```json 400 - Bad Request theme={null}
  {
    "detail": "Provide at least one field to update."
  }
  ```

  ```json 404 - Not Found theme={null}
  {
    "detail": "Memory 'b7c3cf31-e537-49f1-abc4-c50ac6adeac5' was not found."
  }
  ```

  ```json 401 - Unauthorized (Missing Token) theme={null}
  {
    "detail": "Missing session token. Use X-Session-Token header."
  }
  ```
</ResponseExample>

## Next Steps

* [Recall](/api-reference/search/recall) to find a memory's ID before editing it
* [Delete Memory](/api-reference/data/delete-memory) to remove a memory
