---
title: "Update a memory block."
method: PUT
path: "/memory_blocks/{memory_block_id}"
tags: ["Memory Blocks"]
---

# Update a memory block.

`PUT /memory_blocks/{memory_block_id}`

## Request

- Base URL: `https://h2ogpte.genai.h2o.ai/api/v1`
- URL: `https://h2ogpte.genai.h2o.ai/api/v1/memory_blocks/{memory_block_id}`
- Auth: HTTP bearer
- TypeScript: <https://skmtc.dev/h2o/apis/h2ogpte-rest-api/docs/memory_blocks/:memory_block_id/put.ts> (a function with typed inputs; its response is checked against the schema)

Updates the name, content, and/or system prompt amendment of a memory block.

## Path parameters

- `memory_block_id` string, required

## Request body

- MemoryBlockUpdateRequest
  - `name` string: New name for the memory block.
  - `content` string: Updated content of the memory block.
  - `system_prompt_amendment` string: Updated system prompt amendment.
  - `injection_mode` 'system_prompt' | 'user_instruction' | 'agent_file' | 'agent_tool': Where memory content is injected. 'system_prompt' adds it to the LLM system prompt; 'user_instruction' prepends it to the user message; 'agent_file' makes it only available as AGENTS.md in agent mode; 'agent_tool' exposes content lazily via the read_memory_block / update_memory_block tools (no pre-injection).
  - `access_mode` 'read' | 'write' | 'read_write': Controls whether the LLM/agent can read the memory, write to it, or both.
  - `max_content_length` integer: Maximum number of characters allowed in memory content. Set to 0 for unlimited.

## Response `204`

Successful operation

## Other responses

- `400`: Bad request
- `401`: Unauthorized - Invalid or missing API key
- `403`: Forbidden
- `404`: Not found
- `409`: Conflict
- `default`: Unexpected error

---

[API](https://skmtc.dev/h2o/apis/h2ogpte-rest-api.md) - [All operations](https://skmtc.dev/h2o/apis/h2ogpte-rest-api/llms.txt) - [OpenAPI document](https://skmtc.dev/h2o/apis/h2ogpte-rest-api/revisions/a82a117320f4?raw)
