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

# Update Memory

> PATCH /v1/memories/:id — Update a memory in-place.

<Snippet file="snippets/x402-callout.mdx" />

**Price:** \$0.005 USDC

Update one or more fields on an existing memory. If `content` is changed, the embedding and full-text search vector are regenerated automatically. All other fields (metadata, importance, etc.) are updated without re-embedding.

## Path Parameters

<ParamField path="id" type="string" required>
  UUID of the memory to update.
</ParamField>

## Request Body

At least one field must be provided. Only provided fields are updated — omitted fields are left unchanged.

<ParamField body="content" type="string">
  New memory text. Max 8,192 characters. Triggers re-embedding.
</ParamField>

<ParamField body="metadata" type="object">
  Replace metadata entirely. Max 4 KB, 20 keys, 3 levels deep.

  <Expandable title="Nested fields">
    <ParamField body="metadata.tags" type="string[]">
      Tags for filtering. Max 10 tags, 64 characters each.
    </ParamField>
  </Expandable>
</ParamField>

<ParamField body="importance" type="number">
  Float between 0 and 1.
</ParamField>

<ParamField body="memory_type" type="string">
  One of: `correction`, `preference`, `decision`, `project`, `observation`, `general`.
</ParamField>

<ParamField body="namespace" type="string">
  Move memory to a different namespace. Max 255 characters.
</ParamField>

<ParamField body="pinned" type="boolean">
  Pin or unpin a memory. Pinned memories are exempt from type-based decay.
</ParamField>

<ParamField body="expires_at" type="string | null">
  ISO 8601 date string to set a TTL, or `null` to clear expiration. Must be in the future.
</ParamField>

<ParamField body="immutable" type="boolean">
  Set to `true` to lock the memory permanently. Once immutable, the memory cannot be updated or deleted. This is a one-way operation.
</ParamField>

<Warning>
  Immutable memories cannot be updated or deleted. Attempting either returns **409 Conflict**. If you need to update a memory, do so *before* setting `immutable: true`.
</Warning>

## Response (200)

Returns the full updated memory object.

<ResponseField name="id" type="string">
  UUID of the memory.
</ResponseField>

<ResponseField name="content" type="string">
  Memory content.
</ResponseField>

<ResponseField name="metadata" type="object">
  Memory metadata.
</ResponseField>

<ResponseField name="importance" type="number">
  Importance score.
</ResponseField>

<ResponseField name="memory_type" type="string">
  Memory type.
</ResponseField>

<ResponseField name="namespace" type="string">
  Memory namespace.
</ResponseField>

<ResponseField name="expires_at" type="string | null">
  Expiration date or `null`.
</ResponseField>

<ResponseField name="updated_at" type="string">
  Timestamp of this update.
</ResponseField>

<Info>
  Update does **not** run deduplication — you explicitly chose this memory ID, so the content is stored as-is. Relations, access history, and decay state are preserved.
</Info>

## Errors

| Status | Description                                                  |
| ------ | ------------------------------------------------------------ |
| 404    | Memory not found (or deleted, or belongs to another wallet). |
| 409    | Memory is immutable and cannot be modified.                  |
| 422    | Invalid UUID format, empty body, or field validation failed. |

## Example

<CodeGroup>
  ```bash curl theme={null}
  curl -X PATCH https://api.memoclaw.com/v1/memories/550e8400-e29b-41d4-a716-446655440000 \
    -H "Content-Type: application/json" \
    -d '{
      "content": "User prefers 2-space indentation (not tabs)",
      "importance": 0.95,
      "expires_at": "2026-06-01T00:00:00Z"
    }'
  ```

  ```javascript JavaScript theme={null}
  const response = await fetch(
    "https://api.memoclaw.com/v1/memories/550e8400-e29b-41d4-a716-446655440000",
    {
      method: "PATCH",
      headers: { "Content-Type": "application/json" },
      body: JSON.stringify({
        content: "User prefers 2-space indentation (not tabs)",
        importance: 0.95,
        expires_at: "2026-06-01T00:00:00Z",
      }),
    }
  );

  const data = await response.json();
  ```

  ```python Python theme={null}
  from memoclaw import MemoClaw

  client = MemoClaw()
  result = client.update(
      "550e8400-e29b-41d4-a716-446655440000",
      content="User prefers 2-space indentation (not tabs)",
      importance=0.95,
      expires_at="2026-06-01T00:00:00Z",
  )
  ```
</CodeGroup>

```json Response theme={null}
{
  "id": "550e8400-e29b-41d4-a716-446655440000",
  "content": "User prefers 2-space indentation (not tabs)",
  "metadata": { "tags": ["preferences", "code-style"] },
  "importance": 0.95,
  "memory_type": "preference",
  "namespace": "default",
  "expires_at": "2026-06-01T00:00:00Z",
  "updated_at": "2026-02-11T15:30:00Z",
  "created_at": "2026-02-10T12:00:00Z",
  "access_count": 3
}
```
