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

# Memories API: Manage Hosted Agent Memory

> Read, search, edit, and restore a hosted agent's memory files with the OneCLI API. Every change keeps a revision history.

Memories are files a hosted agent keeps between conversations, such as notes, preferences, and facts it learned. Every edit appends a revision, so you can see how a memory changed and roll it back.

Use these endpoints to review what an agent remembers, correct it, or scrub sensitive text. Keep real credentials out of memory and store them as secrets instead. See [How it works](https://onecli.sh/docs/how-it-works.md).

## Related guides

* [How it works: the gateway injects credentials](https://onecli.sh/docs/how-it-works.md)
* [Agent access: grant credentials to agents](https://onecli.sh/docs/guides/agent-access.md)

## Endpoints

| Endpoint | Method and path | What it does |
| - | - | - |
| [List or search an agent's memories](https://onecli.sh/docs/api-reference/memories/list-or-search-an-agents-memories.md) | `GET /agents/{agentId}/memories` | List every memory a hosted agent keeps, or run a full-text search and get ranked hits with a snippet each. |
| [Create a memory](https://onecli.sh/docs/api-reference/memories/create-a-memory.md) | `POST /agents/{agentId}/memories` | Add a memory file to a hosted agent so it starts every future conversation with that knowledge. |
| [Get a memory](https://onecli.sh/docs/api-reference/memories/get-a-memory.md) | `GET /agents/{agentId}/memories/{memoryId}` | Fetch one of a hosted agent's memories with its full content, title, and description. |
| [Update a memory](https://onecli.sh/docs/api-reference/memories/update-a-memory.md) | `PATCH /agents/{agentId}/memories/{memoryId}` | Edit a hosted agent's memory content, title, or description. |
| [Delete a memory](https://onecli.sh/docs/api-reference/memories/delete-a-memory.md) | `DELETE /agents/{agentId}/memories/{memoryId}` | Permanently delete a hosted agent's memory and its whole revision history. |
| [List a memory's revisions](https://onecli.sh/docs/api-reference/memories/list-a-memorys-revisions.md) | `GET /agents/{agentId}/memories/{memoryId}/revisions` | List a memory's revision history, newest first, to see how the agent's knowledge changed over time. |
| [Get a revision](https://onecli.sh/docs/api-reference/memories/get-a-revision.md) | `GET /agents/{agentId}/memories/{memoryId}/revisions/{revisionId}` | Fetch one past revision of a hosted agent's memory with its full content. |
| [Restore a revision](https://onecli.sh/docs/api-reference/memories/restore-a-revision.md) | `POST /agents/{agentId}/memories/{memoryId}/revisions/{revisionId}/restore` | Roll a hosted agent's memory back to an earlier revision. |
| [Redact a revision](https://onecli.sh/docs/api-reference/memories/redact-a-revision.md) | `POST /agents/{agentId}/memories/{memoryId}/revisions/{revisionId}/redact` | Scrub the content of an old memory revision in place, for example after someone pasted a secret into the agent's memory. |

## Next steps

* [API overview](https://onecli.sh/docs/api-reference.md): base URLs, authentication, and pagination
* [Errors](https://onecli.sh/docs/api-reference/errors.md): status codes and the error format
* [Editions](https://onecli.sh/docs/api-reference/editions.md): which endpoints each edition serves


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.