Skip to main content
PATCH
Update a Memory

Headers

kimi-api-version
enum<string>

API version for this request, in YYYY-MM-DD form. Send 2026-09-01-beta for the version documented here. Required outside /v1/files*: a missing header there is rejected with 400 invalid_request_error; on /v1/files* its absence selects the compatibility behavior. An unknown value is rejected with 400 invalid_request_error on every endpoint. API versions served by the platform. New dated versions are added as they ship; a version is removed after its announced Sunset date.

Available options:
2026-09-01-beta

Path Parameters

id
string
required

Memory Store ID.

memory_id
string
required

Memory file ID.

Body

application/json

Path and replacement content for the memory file. Include its current content hash to detect concurrent changes.

Partial-update body for updating a memory file: content, path, or both. content_sha256 is an optimistic-concurrency check on the current file content.

path
string

New path, up to 900 UTF-8 bytes. Validated with the same strict rules as creation.

Required string length: 1 - 900
Example:

"README.md"

content
string

Replacement content, base64-encoded, up to 20 MiB decoded.

Example:

"V29ybGQ="

content_sha256
string

Optional optimistic-concurrency check: echo the memory's current content_sha256. The update fails with 409 when it does not match.

Pattern: ^[0-9a-f]{64}$
Example:

"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"

Response

The file after the update, with its content and new hash.

A file in a Memory Store.

The id stays stable across renames, and deleting the file keeps its ID and version history readable.

id
string
required

Memory file ID. Unchanged when the file is renamed.

Example:

"mem_01h455vb4pex5vsknk084sn02q"

memory_store_id
string
required

ID of the Memory Store containing this file.

Example:

"mstr_01h455vb4pex5vsknk084sn02q"

path
string
required

Path relative to the Memory Store root.

Example:

"README.md"

content_sha256
string
required

SHA-256 hash of the decoded content. Pass it back in updates as an optimistic-concurrency check.

Example:

"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"

content_size_bytes
integer<int64>
required

Size of the decoded content in bytes.

Example:

5

created_at
string<date-time>
required

Time when the file was created.

Example:

"2026-01-01T00:00:00Z"

updated_at
string<date-time>
required

Time when the file content or path was last updated.

Example:

"2026-01-01T00:00:00Z"

content
string

Base64-encoded file content. Returned by create, get, and update. Omitted from list responses. An empty value represents an empty file.

Example:

"SGVsbG8="