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

# Delete Memory

> Delete any version in the memory version history.

**Path Parameters:**
- `custom_user_id` (str): Unique identifier for the user
- `memory_id` (str): Memory UUID (can be any version in the chain)

**Query Parameters:**
- `delete_previous_versions` (bool): Delete this version + all previous (true) or just this version (false). Default: false

**Returns:**
- HTTP 204 No Content on success

**Deletion Modes:**

**Mode 1: Single Version Deletion (delete_previous_versions=false, default)**
- Deletes only the specified version (can be any version in the chain)
- If deleting latest version: previous version becomes new latest (resurrected)
- If deleting middle version: next version links to previous version (relinks chain)
- If deleting first version with no next: complete deletion
- Connections on latest version are preserved/transferred appropriately

**Mode 2: Delete Version + All Previous (delete_previous_versions=true)**
- Deletes the specified version AND all its previous versions
- If deleting latest: deletes entire history
- If deleting middle version N: deletes N and all versions before it (N-1, N-2, etc.)
- Version N+1 becomes orphaned (prev_version_id = None)

**Examples:**
```
Chain: v1 ← v2 ← v3 ← v4 (latest)

Delete v4 (latest) with delete_previous_versions=false:
    Result: v1 ← v2 ← v3 (latest, resurrected)

Delete v2 (middle) with delete_previous_versions=false:
    Result: v1 ← v3 ← v4 (latest) [v2 removed from chain]

Delete v2 (middle) with delete_previous_versions=true:
    Result: v3 ← v4 (latest) [v1 and v2 deleted, v3 orphaned]
```



## OpenAPI

````yaml https://api.recallrai.com/api/openapi.json delete /api/v1/users/{custom_user_id}/memory/{memory_id}
openapi: 3.1.0
info:
  title: api-backend
  description: This powers the Recallr AI API Backend
  version: 0.1.0
servers:
  - url: https://api.recallrai.com
    description: Production server
security: []
paths:
  /api/v1/users/{custom_user_id}/memory/{memory_id}:
    delete:
      tags:
        - Memories
      summary: Delete Memory
      description: >-
        Delete any version in the memory version history.


        **Path Parameters:**

        - `custom_user_id` (str): Unique identifier for the user

        - `memory_id` (str): Memory UUID (can be any version in the chain)


        **Query Parameters:**

        - `delete_previous_versions` (bool): Delete this version + all previous
        (true) or just this version (false). Default: false


        **Returns:**

        - HTTP 204 No Content on success


        **Deletion Modes:**


        **Mode 1: Single Version Deletion (delete_previous_versions=false,
        default)**

        - Deletes only the specified version (can be any version in the chain)

        - If deleting latest version: previous version becomes new latest
        (resurrected)

        - If deleting middle version: next version links to previous version
        (relinks chain)

        - If deleting first version with no next: complete deletion

        - Connections on latest version are preserved/transferred appropriately


        **Mode 2: Delete Version + All Previous
        (delete_previous_versions=true)**

        - Deletes the specified version AND all its previous versions

        - If deleting latest: deletes entire history

        - If deleting middle version N: deletes N and all versions before it
        (N-1, N-2, etc.)

        - Version N+1 becomes orphaned (prev_version_id = None)


        **Examples:**

        ```

        Chain: v1 ← v2 ← v3 ← v4 (latest)


        Delete v4 (latest) with delete_previous_versions=false:
            Result: v1 ← v2 ← v3 (latest, resurrected)

        Delete v2 (middle) with delete_previous_versions=false:
            Result: v1 ← v3 ← v4 (latest) [v2 removed from chain]

        Delete v2 (middle) with delete_previous_versions=true:
            Result: v3 ← v4 (latest) [v1 and v2 deleted, v3 orphaned]
        ```
      operationId: delete_memory_api_v1_users__custom_user_id__memory__memory_id__delete
      parameters:
        - name: custom_user_id
          in: path
          required: true
          schema:
            type: string
            title: Custom user ID
        - name: memory_id
          in: path
          required: true
          schema:
            type: string
            title: Memory ID
        - name: delete_previous_versions
          in: query
          required: false
          schema:
            type: boolean
            description: >-
              Delete this version and all previous versions (true) or just this
              version (false)
            default: false
            title: Delete Previous Versions
          description: >-
            Delete this version and all previous versions (true) or just this
            version (false)
        - name: X-Recallr-Project-Id
          in: header
          required: true
          schema:
            type: string
            format: uuid
            title: X-Recallr-Project-Id
        - name: X-Recallr-Api-Key
          in: header
          required: true
          schema:
            type: string
            title: X-Recallr-Api-Key
      responses:
        '204':
          description: Memory deleted successfully
        '401':
          description: Authentication required
        '404':
          description: Memory not found
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
        '500':
          description: Internal server error
components:
  schemas:
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    ValidationError:
      properties:
        loc:
          items:
            anyOf:
              - type: string
              - type: integer
          type: array
          title: Location
        msg:
          type: string
          title: Message
        type:
          type: string
          title: Error Type
        input:
          title: Input
        ctx:
          type: object
          title: Context
      type: object
      required:
        - loc
        - msg
        - type
      title: ValidationError

````