memories
Creates, updates, deletes, gets or lists a memories resource.
Overview
| Name | memories |
| Type | Resource |
| Id | anthropic.memory_stores.memories |
Fields
The following fields are returned by SELECT queries:
- get
- list
Successful response (OK)
| Name | Datatype | Description |
|---|---|---|
id | string | Unique identifier for this memory (a `mem_...` value). Stable across renames; use this ID, not the path, to read, update, or delete the memory. |
memory_store_id | string | ID of the memory store this memory belongs to (a `memstore_...` value). |
memory_version_id | string | ID of the `memory_version` representing this memory's current content (a `memver_...` value). This is the authoritative head pointer; `memory_version` objects do not carry an `is_latest` flag, so compare against this field instead. Enumerate the full history via [List memory versions](/en/api/beta/memory_stores/memory_versions/list). |
content | string | The memory's UTF-8 text content. Populated when `view=full`; `null` when `view=basic`. Maximum 100 kB (102,400 bytes). |
content_sha256 | string | Lowercase hex SHA-256 digest of the UTF-8 `content` bytes (64 characters). The server applies no normalization, so clients can compute the same hash locally for staleness checks and as the value for a `content_sha256` precondition on update. Always populated, regardless of `view`. |
content_size_bytes | integer (int32) | Size of `content` in bytes (the UTF-8 plaintext length). Always populated, regardless of `view`. |
created_at | string (date-time) | When this memory was created, in RFC 3339 format. |
path | string | Hierarchical path of the memory within the store, e.g. `/projects/foo/notes.md`. Always starts with `/`. Paths are case-sensitive and unique within a store. Maximum 1,024 bytes. |
type | string | (memory) |
updated_at | string (date-time) | When this memory was last modified, in RFC 3339 format. Use this as a cheap freshness signal; for who made the change, look up the head version's `created_by` via [List memory versions](/en/api/beta/memory_stores/memory_versions/list). |
Successful response (OK)
| Name | Datatype | Description |
|---|---|---|
id | string | Unique identifier for this memory (a `mem_...` value). Stable across renames; use this ID, not the path, to read, update, or delete the memory. |
memory_store_id | string | ID of the memory store this memory belongs to (a `memstore_...` value). |
memory_version_id | string | ID of the `memory_version` representing this memory's current content (a `memver_...` value). This is the authoritative head pointer; `memory_version` objects do not carry an `is_latest` flag, so compare against this field instead. Enumerate the full history via [List memory versions](/en/api/beta/memory_stores/memory_versions/list). |
content | string | The memory's UTF-8 text content. Populated when `view=full`; `null` when `view=basic`. Maximum 100 kB (102,400 bytes). |
content_sha256 | string | Lowercase hex SHA-256 digest of the UTF-8 `content` bytes (64 characters). The server applies no normalization, so clients can compute the same hash locally for staleness checks and as the value for a `content_sha256` precondition on update. Always populated, regardless of `view`. |
content_size_bytes | integer (int32) | Size of `content` in bytes (the UTF-8 plaintext length). Always populated, regardless of `view`. |
created_at | string (date-time) | When this memory was created, in RFC 3339 format. |
path | string | Hierarchical path of the memory within the store, e.g. `/projects/foo/notes.md`. Always starts with `/`. Paths are case-sensitive and unique within a store. Maximum 1,024 bytes. |
type | string | (memory) |
updated_at | string (date-time) | When this memory was last modified, in RFC 3339 format. Use this as a cheap freshness signal; for who made the change, look up the head version's `created_by` via [List memory versions](/en/api/beta/memory_stores/memory_versions/list). |
Methods
The following methods are available for this resource:
| Name | Accessible by | Required Params | Optional Params | Description |
|---|---|---|---|---|
get | select | memory_store_id, memory_id | view | |
list | select | memory_store_id | path_prefix, depth, view | |
create | insert | memory_store_id, path, content | view | |
update | update | memory_store_id, memory_id | view | |
delete | delete | memory_store_id, memory_id | expected_content_sha256 |
Parameters
Parameters can be passed in the WHERE clause of a query. Check the Methods section to see which parameters are required or optional for each operation.
| Name | Datatype | Description |
|---|---|---|
memory_id | string | Path parameter memory_id |
memory_store_id | string | Path parameter memory_store_id |
depth | integer (int32) | 0 (or omitted) returns all descendants below path_prefix (recursive). 1 returns immediate children only; deeper entries roll up as memory_prefix items. depth=1 behaves like ls; omitting depth behaves like find. |
expected_content_sha256 | string | Query parameter for expected_content_sha256 |
path_prefix | string | Optional path prefix filter. Must end with / (segment-aligned), e.g., /notes/. This value appears in request URLs. Do not include secrets or personally identifiable information. |
view | string | Query parameter for view |
SELECT examples
- get
- list
Successful response (OK)
SELECT
id,
memory_store_id,
memory_version_id,
content,
content_sha256,
content_size_bytes,
created_at,
path,
type,
updated_at
FROM anthropic.memory_stores.memories
WHERE memory_store_id = '{{ memory_store_id }}' -- required
AND memory_id = '{{ memory_id }}' -- required
AND view = '{{ view }}'
;
Successful response (OK)
SELECT
id,
memory_store_id,
memory_version_id,
content,
content_sha256,
content_size_bytes,
created_at,
path,
type,
updated_at
FROM anthropic.memory_stores.memories
WHERE memory_store_id = '{{ memory_store_id }}' -- required
AND path_prefix = '{{ path_prefix }}'
AND depth = '{{ depth }}'
AND view = '{{ view }}'
;
INSERT examples
- create
- Manifest
No description available.
INSERT INTO anthropic.memory_stores.memories (
path,
content,
memory_store_id,
view
)
SELECT
'{{ path }}' /* required */,
'{{ content }}' /* required */,
'{{ memory_store_id }}',
'{{ view }}'
RETURNING
id,
memory_store_id,
memory_version_id,
content,
content_sha256,
content_size_bytes,
created_at,
path,
type,
updated_at
;
# Description fields are for documentation purposes
- name: memories
props:
- name: memory_store_id
value: "{{ memory_store_id }}"
description: Required parameter for the memories resource.
- name: path
value: "{{ path }}"
description: |
Hierarchical path for the new memory, e.g. `/projects/foo/notes.md`. Must start with `/`, contain at least one non-empty segment, and be at most 1,024 bytes. Must not contain empty segments, `.` or `..` segments, control or format characters, and must be NFC-normalized. Paths are case-sensitive.
- name: content
value: "{{ content }}"
description: |
UTF-8 text content for the new memory. Maximum 100 kB (102,400 bytes). Required; pass `""` explicitly to create an empty memory.
- name: view
value: "{{ view }}"
description: Query parameter for view
description: Query parameter for view
UPDATE examples
- update
No description available.
UPDATE anthropic.memory_stores.memories
SET
content = '{{ content }}',
path = '{{ path }}',
precondition = '{{ precondition }}'
WHERE
memory_store_id = '{{ memory_store_id }}' --required
WHERE memory_id = '{{ memory_id }}' --required
AND view = '{{ view}}'
RETURNING
id,
memory_store_id,
memory_version_id,
content,
content_sha256,
content_size_bytes,
created_at,
path,
type,
updated_at;
DELETE examples
- delete
No description available.
DELETE FROM anthropic.memory_stores.memories
WHERE memory_store_id = '{{ memory_store_id }}' --required
AND memory_id = '{{ memory_id }}' --required
AND expected_content_sha256 = '{{ expected_content_sha256 }}'
;