> ## Documentation Index
> Fetch the complete documentation index at: https://docs.tensorpro.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Edit a memory

> Change what a memory says. EDN saves the new text as a new USER_CONFIRMED memory and keeps the old version in the history. Returns the new memory: use its `id` from now on. USER_STATED, USER_CONFIRMED, AI_INFERRED and AI_GENERATED memories can be edited; documents and conversation turns return 409.

Use this endpoint when a user fixes a memory directly, for example in a memory settings screen. EDN never overwrites a memory: it saves the new text as a new version and keeps the old one in the history.

## What EDN does

1. Saves the new text as a new `USER_CONFIRMED` memory with a new ID.
2. Marks the old memory as replaced, so SIPs stop using it.
3. Keeps the old version in the memory's [history](https://docs.tensorpro.ai/api-reference/memory-record-history.md).

## Required headers

| Header | Value | Description |
| - | - | - |
| `Authorization` | `Bearer YOUR_API_KEY` | Your EDN API key. Create keys in the [Console](https://docs.tensorpro.ai/console/api-keys.md). See [Authentication](https://docs.tensorpro.ai/authentication.md) |
| `Content-Type` | `application/json` | The request body is JSON |

## Request

### Path parameters

| Parameter | Type | Description |
| - | - | - |
| `record_id` | string | Identifier for the current version of the memory to edit |

### Body

| Field | Type | Required | Description |
| - | - | - | - |
| `content` | string | Yes | The corrected text for the memory. 1 to 1,000 characters |

```bash cURL theme={"theme":"github-light"}
curl -X PATCH "https://api.tensorpro.ai/api/v1/memory/records/8f0d2c61-5b7e-4a39-9c1e-2d4f6a8b0e17" \
  -H "Authorization: Bearer $EDN_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "content": "Tom manages the website project."
  }'
```

```python Python theme={"theme":"github-light"}
import os
import requests

resp = requests.patch(
    "https://api.tensorpro.ai/api/v1/memory/records/8f0d2c61-5b7e-4a39-9c1e-2d4f6a8b0e17",
    headers={"Authorization": f"Bearer {os.environ['EDN_API_KEY']}"},
    json={
        "content": "Tom manages the website project."
    },
)
resp.raise_for_status()
print(resp.json())
```

```javascript JavaScript theme={"theme":"github-light"}
const resp = await fetch("https://api.tensorpro.ai/api/v1/memory/records/8f0d2c61-5b7e-4a39-9c1e-2d4f6a8b0e17", {
  method: "PATCH",
  headers: {
    Authorization: `Bearer ${process.env.EDN_API_KEY}`,
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    "content": "Tom manages the website project."
  }),
});
console.log(await resp.json());
```

## Response

```json 200 OK theme={"theme":"github-light"}
{
  "id": "1b3d5f7a-9c2e-4a6b-8d0f-2e4a6c8e0b1d",
  "content_summary": "Tom manages the website project.",
  "full_text": "Tom manages the website project.",
  "provenance": "USER_CONFIRMED",
  "domain": "factual",
  "status": "current",
  "created_at": "2026-11-11T09:12:44+00:00",
  "project_id": null,
  "session_id": "chat-42",
  "source_id": null,
  "supersedes": "8f0d2c61-5b7e-4a39-9c1e-2d4f6a8b0e17",
  "superseded_by": null,
  "event_date": null,
  "document_date": "2026-11-10T04:43:25+00:00"
}
```

Returns the new version of the memory, with the same fields as [Get a memory](https://docs.tensorpro.ai/api-reference/get-memory-record.md). The most useful ones:

| Field | Type | Description |
| - | - | - |
| `id` | string | Identifier for the new version. Use it from now on |
| `provenance` | string | Always `USER_CONFIRMED` |
| `status` | string | Always `current` |
| `supersedes` | string | Identifier for the version you edited |

## Important behavior

* **The edited memory gets a new ID.** The old ID still works with [Get a memory](https://docs.tensorpro.ai/api-reference/get-memory-record.md) and history.

* **Only current versions can be edited.** Editing a replaced or deleted version returns `404`.

* **`USER_STATED`, `USER_CONFIRMED`, `AI_INFERRED` and `AI_GENERATED` memories can be edited.** Documents (`DOCUMENT_VERIFIED`) and conversation turns (`ROUND`) return `409`.

## Errors

| Status | Code | When |
| - | - | - |
| `401` | `UNAUTHORIZED` | The API key is missing, invalid or revoked |
| `404` | `NOT_FOUND` | The memory doesn't exist, was deleted, was already replaced, or isn't yours |
| `409` | `CONFLICT` | The memory is a document, a conversation turn or system-derived, so it can't be edited |
| `422` | `VALIDATION_ERROR` | `content` is missing, empty or longer than 1,000 characters |
| `429` | `RATE_LIMITED` | Per-minute limit reached. Retry after `Retry-After` seconds |
| `500` | `INTERNAL_ERROR` | Something failed on EDN's side. Retry later |

See [Error handling](https://docs.tensorpro.ai/reference/errors.md).

```json 200 theme={"theme":"github-light"}
{
  "id": "1b3d5f7a-9c2e-4a6b-8d0f-2e4a6c8e0b1d",
  "content_summary": "Tom manages the website project.",
  "full_text": "Tom manages the website project.",
  "provenance": "USER_CONFIRMED",
  "domain": "factual",
  "status": "current",
  "created_at": "2026-11-11T09:12:44+00:00",
  "project_id": null,
  "session_id": "chat-42",
  "source_id": null,
  "supersedes": "8f0d2c61-5b7e-4a39-9c1e-2d4f6a8b0e17",
  "superseded_by": null,
  "event_date": null,
  "document_date": "2026-11-10T04:43:25+00:00"
}
```


## OpenAPI

````yaml patch /api/v1/memory/records/{record_id}
openapi: 3.1.0
info:
  title: EDN Memory Engine
  version: 0.1.0
servers:
  - description: EDN evaluation endpoint
    url: https://api.tensorpro.ai
security:
  - EDNApiKey: []
paths:
  /api/v1/memory/records/{record_id}:
    patch:
      summary: Edit a memory
      description: >-
        Change what a memory says. EDN saves the new text as a new
        USER_CONFIRMED memory and keeps the old version in the history. Returns
        the new memory: use its `id` from now on. USER_STATED, USER_CONFIRMED,
        AI_INFERRED and AI_GENERATED memories can be edited; documents and
        conversation turns return 409.
      operationId: edit_memory_record_api_v1_memory_records__record_id__patch
      parameters:
        - description: The ID of the memory (the record_id returned when it was saved).
          in: path
          name: record_id
          required: true
          schema:
            description: The ID of the memory (the record_id returned when it was saved).
            title: Record Id
            type: string
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/EditRecordRequest'
        required: true
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/MemoryRecordDetail'
          description: Successful Response
        '401':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
          description: The API key is missing, invalid, revoked or expired.
        '404':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
          description: The resource does not exist or does not belong to you.
        '409':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
          description: The request conflicts with the resource's current state.
        '422':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ValidationErrorResponse'
          description: A request field is missing or invalid. errors lists each problem.
        '429':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
          description: >-
            A rate limit or your daily quota was reached. Wait for the number of
            seconds in the Retry-After header, then retry.
          headers:
            Retry-After:
              description: Seconds to wait before retrying.
              schema:
                type: integer
components:
  schemas:
    EditRecordRequest:
      properties:
        content:
          description: >-
            The corrected text for this memory, up to 1,000 characters. EDN
            saves it as a new USER_CONFIRMED version and keeps the old one in
            the record's history.
          examples:
            - Tom manages the website project.
          maxLength: 1000
          minLength: 1
          title: Content
          type: string
      required:
        - content
      title: EditRecordRequest
      type: object
    MemoryRecordDetail:
      properties:
        content_summary:
          description: What the memory says, as used in the SIP.
          title: Content Summary
          type: string
        created_at:
          description: When this version was created (ISO 8601, UTC).
          title: Created At
          type: string
        document_date:
          anyOf:
            - type: string
            - type: 'null'
          description: When the information was recorded (ISO 8601, UTC).
          title: Document Date
        domain:
          description: The memory's category.
          enum:
            - technical
            - professional-context
            - communication-style
            - factual
          title: Domain
          type: string
        event_date:
          anyOf:
            - type: string
            - type: 'null'
          description: When the event it describes happened, if known (ISO 8601, UTC).
          title: Event Date
        full_text:
          description: >-
            The memory's complete text. For a saved conversation turn this is
            the full exchange; otherwise it matches content_summary.
          title: Full Text
          type: string
        id:
          description: The memory's ID (same as record_id elsewhere).
          title: Id
          type: string
        project_id:
          anyOf:
            - type: string
            - type: 'null'
          description: The project it belongs to, or null for general memory.
          title: Project Id
        provenance:
          description: Where the memory came from.
          enum:
            - USER_STATED
            - USER_CONFIRMED
            - DOCUMENT_VERIFIED
            - AI_INFERRED
            - AI_GENERATED
            - SYSTEM_DERIVED
            - ROUND
          title: Provenance
          type: string
        session_id:
          anyOf:
            - type: string
            - type: 'null'
          description: The session it was saved in.
          title: Session Id
        source_id:
          anyOf:
            - type: string
            - type: 'null'
          description: The project document it came from, or null if not from a document.
          title: Source Id
        status:
          description: >-
            current: the latest version, used in SIPs. replaced: a newer version
            (an edit, correction or confirmation) took its place. deleted:
            removed (only seen in history).
          enum:
            - current
            - replaced
            - deleted
          title: Status
          type: string
        superseded_by:
          anyOf:
            - type: string
            - type: 'null'
          description: The ID of the newer version that replaced this one, or null.
          title: Superseded By
        supersedes:
          anyOf:
            - type: string
            - type: 'null'
          description: The ID of the earlier version this one replaced, or null.
          title: Supersedes
      required:
        - id
        - content_summary
        - full_text
        - provenance
        - domain
        - status
        - created_at
      title: MemoryRecordDetail
      type: object
    ErrorResponse:
      properties:
        code:
          description: >-
            A stable error code, e.g. NOT_FOUND. Also sent in the
            X-EDN-Error-Code header.
          title: Code
          type: string
        detail:
          description: What went wrong, in plain language.
          title: Detail
          type: string
      required:
        - detail
        - code
      title: ErrorResponse
      type: object
    ValidationErrorResponse:
      properties:
        code:
          description: >-
            A stable error code, e.g. NOT_FOUND. Also sent in the
            X-EDN-Error-Code header.
          title: Code
          type: string
        detail:
          description: What went wrong, in plain language.
          title: Detail
          type: string
        errors:
          description: One entry per invalid field.
          items:
            $ref: '#/components/schemas/FieldError'
          title: Errors
          type: array
      required:
        - detail
        - code
        - errors
      title: ValidationErrorResponse
      type: object
    FieldError:
      properties:
        field:
          description: The request field with the problem, e.g. session_id.
          title: Field
          type: string
        message:
          description: What is wrong with it.
          title: Message
          type: string
      required:
        - field
        - message
      title: FieldError
      type: object
  securitySchemes:
    EDNApiKey:
      description: >-
        Your EDN API key, sent as `Bearer YOUR_API_KEY`. Create keys in the
        Console.
      scheme: bearer
      type: http

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.