---
title: "Patch Memory"
method: PATCH
path: "/api/v1/memory/{memory_id}"
tags: ["memory"]
---

# Patch Memory

`PATCH /api/v1/memory/{memory_id}`

## Request

- Base URL: `https://memory.kagura-ai.com` (the document declares no server; this is the origin it was published from)
- URL: `https://memory.kagura-ai.com/api/v1/memory/{memory_id}`
- Auth: none declared

Partial update of a memory by UUID (Issue #439).

Accepts any subset of ``summary``/``content``/``type``/``importance``/
``tags``/``details``. Omitted fields preserve their current value;
``tags`` follows replace-all semantics. ``expected_version`` (#2043)
makes the patch conditional on the memory's current version.

Status codes:
    200: Updated successfully. Body is the full ``ReferenceResponse``.
    404: Memory does not exist OR the caller lacks access (existence
         is intentionally not leaked).
    409: ``expected_version`` is not the memory's current version
         (``details.reason`` = ``version_conflict``, ``details.
         current_version``); nothing was written (#2043).
    410: Memory was soft-deleted; the tombstone exists but the resource
         is gone. Distinguishing 410 from 404 lets clients stop retrying.
    422: Request body validation failed (empty patch, importance out of
         range, summary < 10 chars, etc.).
    429: The patched memory's post-patch size exceeds ``MAX_CONTENT_SIZE``
         (1MB) — same envelope as ``remember`` / ``update_memory``.

Permission: same envelope as ``forget`` — ``PermissionService.
can_access_memory`` (workspace member for shared, creator for private).

Embedding regeneration: triggered only when ``summary`` or ``content``
changes. Runs on the same async-task pipeline as the ``remember`` path
(``process_pending_embedding``); this PATCH does not block on embedding
completion. Neural edges anchored on this memory are invalidated when
re-embed fires.

Example:
    PATCH /api/v1/memory/550e8400-e29b-41d4-a716-446655440000
    Authorization: Bearer <session_token>
    Content-Type: application/json

    {"importance": 0.9, "tags": ["python", "auth"]}

## Path parameters

- `memory_id` string, uuid, required

## Headers

- `authorization` string, nullable

## Request body

- PatchMemoryRequest: Request schema for ``PATCH /api/v1/memory/{memory_id}`` (Issue #439). UUID-addressed partial update. ``memory_id`` is the URL path param, not a body field — there is intentionally no ``external_id`` upsert mode here (use the existing ``update_memory`` MCP tool for that). All fields are optional. Only fields explicitly provided are updated; omitted fields preserve their current value. ``tags`` follows replace-all semantics (an empty list clears tags; a non-empty list replaces the whole list). ``scope`` and ``context_id`` are intentionally excluded — they have orthogonal lifecycles handled by separate operations.
  - `summary` string, nullable
  - `content` string, nullable
  - `type` string, nullable
  - `importance` number, nullable
  - `tags` string[], nullable
  - `details` object, nullable
  - `expected_version` integer, nullable

## Response `200`

Successful Response

- ReferenceResponse: Response schema for reference() API (full details).
  - `memory_id` unknown, required
  - `summary` unknown, required
  - `context_summary` unknown, required
  - `content` unknown, required
  - `details` unknown, required
  - `type` unknown, required
  - `scope` unknown, required
  - `importance` unknown, required
  - `tags` unknown, required
  - `context` unknown, required
  - `created_at` unknown, required
  - `updated_at` unknown, required
  - `version` unknown, required
  - `historical` unknown
  - `current_version` unknown
  - `unavailable_fields` unknown
  - `client` unknown, required
  - `source_uri` unknown
  - `source_type` unknown
  - `outgoing_links` unknown
  - `outgoing_has_more` unknown
  - `incoming_links` unknown
  - `incoming_has_more` unknown
  - `supersede_candidate` unknown

## Other responses

- `422`: Validation Error

---

[API](https://skmtc.dev/kagura-ai/apis/kagura-memory-cloud.md) · [All operations](https://skmtc.dev/kagura-ai/apis/kagura-memory-cloud/llms.txt) · [OpenAPI document](https://skmtc.dev/kagura-ai/apis/kagura-memory-cloud/revisions/09f17f5ada29?raw)
