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

# Update User Memory

> Update a memory for a specific member (admin)

Replaces the content of a memory belonging to a specific member.

<Note>
  This endpoint requires admin privileges.
</Note>

<ParamField header="Authorization" type="string" required>
  Bearer token obtained from the authenticate endpoint. The authenticated user must be an admin.
</ParamField>

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

<ParamField body="member_id" type="string" required>
  ID of the member who owns this memory.
</ParamField>

<ParamField body="content" type="string" required>
  The new memory content.
</ParamField>

## Response

Returns the updated memory object.

<ResponseField name="id" type="string">
  Unique memory ID (UUID).
</ResponseField>

<ResponseField name="organization_id" type="string">
  Organization this memory belongs to.
</ResponseField>

<ResponseField name="member_id" type="string">
  Member this memory belongs to.
</ResponseField>

<ResponseField name="content" type="string">
  The updated memory content.
</ResponseField>

<ResponseField name="created_at" type="string">
  ISO 8601 timestamp when the memory was created.
</ResponseField>

<ResponseField name="updated_at" type="string">
  ISO 8601 timestamp when the memory was last updated.
</ResponseField>

<RequestExample>
  ```bash cURL theme={"theme":{"light":"github-light","dark":"github-dark"}}
  curl -X PATCH https://api.trellis.sh/v1/admin/user-memories/a1b2c3d4-e5f6-7890-abcd-ef1234567890 \
    -H "Authorization: Bearer YOUR_TOKEN" \
    -H "Content-Type: application/json" \
    -d '{
      "member_id": "member_01HX...",
      "content": "Focus on APAC and EMEA regions for sales queries"
    }'
  ```

  ```python Python theme={"theme":{"light":"github-light","dark":"github-dark"}}
  import requests

  memory_id = "a1b2c3d4-e5f6-7890-abcd-ef1234567890"

  response = requests.patch(
      f"https://api.trellis.sh/v1/admin/user-memories/{memory_id}",
      headers={
          "Authorization": "Bearer YOUR_TOKEN",
          "Content-Type": "application/json",
      },
      json={
          "member_id": "member_01HX...",
          "content": "Focus on APAC and EMEA regions for sales queries",
      },
  )

  memory = response.json()
  ```

  ```javascript JavaScript theme={"theme":{"light":"github-light","dark":"github-dark"}}
  const memoryId = "a1b2c3d4-e5f6-7890-abcd-ef1234567890";

  const response = await fetch(
    `https://api.trellis.sh/v1/admin/user-memories/${memoryId}`,
    {
      method: "PATCH",
      headers: {
        Authorization: "Bearer YOUR_TOKEN",
        "Content-Type": "application/json",
      },
      body: JSON.stringify({
        member_id: "member_01HX...",
        content: "Focus on APAC and EMEA regions for sales queries",
      }),
    }
  );

  const memory = await response.json();
  ```
</RequestExample>

<ResponseExample>
  ```json 200 theme={"theme":{"light":"github-light","dark":"github-dark"}}
  {
    "id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
    "organization_id": "org_01HX...",
    "member_id": "member_01HX...",
    "content": "Focus on APAC and EMEA regions for sales queries",
    "created_at": "2025-03-01T10:00:00+00:00",
    "updated_at": "2025-03-20T09:15:00+00:00"
  }
  ```

  ```json 401 theme={"theme":{"light":"github-light","dark":"github-dark"}}
  {
    "detail": "Missing Authorization header"
  }
  ```

  ```json 403 theme={"theme":{"light":"github-light","dark":"github-dark"}}
  {
    "detail": "Admin privileges required"
  }
  ```

  ```json 404 theme={"theme":{"light":"github-light","dark":"github-dark"}}
  {
    "detail": "User memory not found"
  }
  ```
</ResponseExample>
