Skip to main content

memory_versions

Creates, updates, deletes, gets or lists a memory_versions resource.

Overview​

Namememory_versions
TypeResource
Idanthropic.memory_stores.memory_versions

Fields​

The following fields are returned by SELECT queries:

Successful response (OK)

NameDatatypeDescription
idstringUnique identifier for this version (a `memver_...` value).
memory_idstringID of the memory this version snapshots (a `mem_...` value). Remains valid after the memory is deleted; pass it as `memory_id` to [List memory versions](/en/api/beta/memory_stores/memory_versions/list) to retrieve the memory's retained versions, including the `deleted` row while the lineage is retained.
memory_store_idstringID of the memory store this version belongs to (a `memstore_...` value).
contentstringThe memory's UTF-8 text content as of this version. `null` when `view=basic`, when `operation` is `deleted`, or when `redacted_at` is set.
content_sha256stringLowercase hex SHA-256 digest of `content` as of this version (64 characters). `null` when `redacted_at` is set or `operation` is `deleted`. Populated regardless of `view` otherwise.
content_size_bytesinteger (int32)Size of `content` in bytes as of this version. `null` when `redacted_at` is set or `operation` is `deleted`. Populated regardless of `view` otherwise.
created_atstring (date-time)When this version was written, in RFC 3339 format.
â–¶created_byobjectWho performed this write: one of `session_actor`, `api_actor`, `user_actor`, or `service_account_actor`; `null` when no writer is recorded. Captured at write time and preserved through redaction. A `session_actor` is an agent writing through the store's mounted filesystem at `/mnt/memory/`. The API key that created that session is not recorded on agent writes, so attribution names who made the write, not who is ultimately responsible; look up session provenance via the [Sessions API](/en/api/beta/sessions/retrieve).
operationstringThe kind of mutation this version records: `created`, `modified`, or `deleted`. (created, modified, deleted)
pathstringThe memory's path at the time of this write. `null` if and only if `redacted_at` is set.
redacted_atstring (date-time)When this version was redacted, in RFC 3339 format, or `null` if it has not been redacted. When set, `content`, `path`, `content_size_bytes`, and `content_sha256` are all `null`. See [Redact a memory version](/en/api/beta/memory_stores/memory_versions/redact).
â–¶redacted_byobjectWho redacted this version, or `null` if it has not been redacted. In practice always an `api_actor`, `user_actor`, or `service_account_actor` (agents do not have a redact capability).
typestring (memory_version)

Methods​

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
getselectmemory_store_id, memory_version_idview, anthropic-workspace-id
listselectmemory_store_idmemory_id, session_id, api_key_id, service_account_id, operation, created_at[gte], created_at[lte], view, anthropic-workspace-id
redactexecmemory_store_id, memory_version_idanthropic-workspace-id

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.

NameDatatypeDescription
memory_store_idstringThe ID of the memory store that holds the version (memstore_...).
memory_version_idstringThe ID of the memory version to redact (memver_...).
anthropic-workspace-idstringOptional header to select the Workspace for this request. The value is a Workspace ID (for example, wrkspc_011CZkZaBF1tNoB5wlCeusgy). Only needed for credentials that can act on more than one Workspace. A credential that belongs to a specific Workspace may omit it; if sent, it must match that Workspace. (example: wrkspc_011CZkZaBF1tNoB5wlCeusgy)
api_key_idstringReturn only versions written with the API key that has this ID.
created_at[gte]string (date-time)Return versions created at or after this time (inclusive).
created_at[lte]string (date-time)Return versions created at or before this time (inclusive).
memory_idstringReturn only versions of the memory with this ID (mem_...). The filter still works after the memory is deleted. The results then include the version whose operation is deleted.
operationstringReturn only versions that record this kind of change.
service_account_idstringReturn only versions written by the service account with this ID (svac_...).
session_idstringReturn only versions written by the session with this ID.
viewstring

SELECT examples​

Successful response (OK)

SELECT
id,
memory_id,
memory_store_id,
content,
content_sha256,
content_size_bytes,
created_at,
created_by,
operation,
path,
redacted_at,
redacted_by,
type
FROM anthropic.memory_stores.memory_versions
WHERE memory_store_id = '{{ memory_store_id }}' -- required
AND memory_version_id = '{{ memory_version_id }}' -- required
AND view = '{{ view }}'
AND "anthropic-workspace-id" = '{{ anthropic-workspace-id }}'
;

Lifecycle Methods​

Successful response (OK)

EXEC anthropic.memory_stores.memory_versions.redact
@memory_store_id='{{ memory_store_id }}' --required,
@memory_version_id='{{ memory_version_id }}' --required,
@anthropic-workspace-id='{{ anthropic-workspace-id }}'
;