---
title: "Edit a single memory in place while preserving its ID and usefulness posterior. Modes: 'replace' overwrites entire content; 'exact' performs surgical find-and-replace of oldString→newString (fails if missing or ambiguous)"
method: POST
path: "/api/memory/edit"
tags: ["Memory"]
---

# Edit a single memory in place while preserving its ID and usefulness posterior. Modes: 'replace' overwrites entire content; 'exact' performs surgical find-and-replace of oldString→newString (fails if missing or ambiguous)

`POST /api/memory/edit`

## Request body

- object
  - `memoryId` string, uuid
  - `key` string
  - `scope` 'agent' | 'swarm'
  - `mode` 'replace' | 'exact'
  - `content` string
  - `oldString` string
  - `newString` string
  - `intent` string, required
  - `expectedVersion` integer

## Response `200`

Memory edited

## Other responses

- `400` — Validation error
- `404` — Memory not found
- `409` — Version conflict

---

[API](https://skmtc.dev/desplega-ai/apis/agent-swarm-api.md) · [All operations](https://skmtc.dev/desplega-ai/apis/agent-swarm-api/llms.txt) · [OpenAPI document](https://skmtc-service-production.skmtc.workers.dev/v1/apis/desplega-ai/agent-swarm-api/revisions/92a1dcbd2fc7/schema)
