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

# Update Memory

> This endpoint updates a memory

### Body

<ParamField body="id" type="string">
  This is the unique identifier for the memory.
</ParamField>

<ParamField body="memory" type="string">
  This is the content of the memory.
</ParamField>

<ParamField body="memory_type" type="string">
  This is the type of memory (e.g., short-term, long-term).
</ParamField>

<ParamField body="user_id" type="string">
  This is the unique identifier for the user associated with the memory.
</ParamField>

<ParamField body="agent_id" type="string">
  This is the unique identifier for the agent that created the memory.
</ParamField>

<ParamField body="created_at" type="string">
  This is the timestamp when the memory was created.
</ParamField>

### Response

<ResponseField name="id" type="string">
  The unique identifier for the memory.
</ResponseField>

<ResponseField name="memory" type="string">
  The content of the memory that was stored.
</ResponseField>

<ResponseField name="memory_type" type="string">
  The type of memory (e.g., short-term, long-term).
</ResponseField>

<ResponseField name="user_id" type="string">
  The unique identifier for the user associated with the memory.
</ResponseField>

<ResponseField name="agent_id" type="string">
  The unique identifier for the agent that created the memory.
</ResponseField>

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

<RequestExample>
  ```bash cURL theme={null}
  curl --location --request PUT 'https://api.stateset.com/v1/memory' \
  --header 'Content-Type: application/json' \
  --header 'Authorization: Token <token>' \
  --data-raw '{
      "id": "1234abcd-5678-efgh-9101-ijklmnopqrst",
      "memory": "User prefers to receive notifications via email.",
      "memory_type": "long-term",
      "user_id": "user_1234abcd",
      "agent_id": "agent_5678efgh"
  }'
  ```

  ```graphQL GraphQL theme={null}
  mutation UpdateMemory(
      $memory: memories_update_input!
      ) {
      update_memories (
        objects: [$memory]
        ) {    
        returning {
          id
          memory
          memory_type
          user_id
          agent_id
          created_at
        }
      }
    }`;
  ```

  ```js Node.js theme={null}
  const memory = await stateset.memory.update({
    "id": "1234abcd-5678-efgh-9101-ijklmnopqrst",
    "memory": "User prefers to receive notifications via email.",
    "memory_type": "long-term",
    "user_id": "user_1234abcd",
    "agent_id": "agent_5678efgh"
  })
  ```
</RequestExample>

<ResponseExample>
  ```json Response theme={null}
  {
      "memory": {
          "id": "1234abcd-5678-efgh-9101-ijklmnopqrst",
          "memory": "User prefers to receive notifications via email.",
          "memory_type": "long-term",
          "user_id": "user_1234abcd",
          "agent_id": "agent_5678efgh",
          "created_at": "2024-08-25T10:00:00Z"
      }
  }
  ```
</ResponseExample>
