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

# Delete Memory

> Permanently delete a single memory by its ID.

## When to use it

* **Right-to-deletion** – remove a specific user's memory upon request
* **Cleanup** – delete outdated or incorrect memories
* **Privacy controls** – let end users delete their own data through your app

To remove documents (knowledge) instead of user memories, use [`POST /knowledge/delete_knowledge`](/api-reference/endpoint/delete-knowledge).

<Warning>
  **This operation is irreversible.** Once deleted, the memory cannot be recovered.
</Warning>

## Endpoint

* **Auth:** Bearer token
* **Idempotency:** Idempotent - re-sending for an already-deleted memory returns `200` with `user_memory_deleted: false`
* **Async:** No

## Example

<CodeGroup>
  ```bash cURL theme={"dark"}
  curl -X DELETE 'https://api.hydradb.com/memories/delete_memory?tenant_id=my_first_tenant&memory_id=1d50e5cd7c196a2bbcc1a59b037b3a44' \
    -H "Authorization: Bearer <your_api_key>"
  ```

  ```typescript TypeScript SDK theme={"dark"}
  const response = await client.upload.deleteMemory({
    tenant_id: "my_first_tenant",
    memory_id: "1d50e5cd7c196a2bbcc1a59b037b3a44"
  });
  ```

  ```python Python SDK theme={"dark"}
  response = client.upload.delete_memory(
      tenant_id="my_first_tenant",
      memory_id="1d50e5cd7c196a2bbcc1a59b037b3a44",
  )
  ```
</CodeGroup>

## Query parameters

| Name            | Type   | Required | Description                                                                                                |
| --------------- | ------ | -------- | ---------------------------------------------------------------------------------------------------------- |
| `tenant_id`     | string | Yes      | The tenant the memory belongs to.                                                                          |
| `memory_id`     | string | Yes      | The unique identifier of the memory to delete. This is the `source_id` returned when the memory was added. |
| `sub_tenant_id` | string | No       | Sub-tenant scope. If omitted, the default sub-tenant is used.                                              |

## Response

```json theme={"dark"}
{
  "success": true,
  "user_memory_deleted": true
}
```

| Field                 | Description                                          |
| --------------------- | ---------------------------------------------------- |
| `success`             | `true` if the deletion request was processed.        |
| `user_memory_deleted` | `true` if the specific memory was found and deleted. |

## Related endpoints

* **Before this:** [List data](/api-reference/endpoint/list-data) (`kind: "memories"`) – browse memories before deleting
* **Alternative:** [Delete tenant](/api-reference/endpoint/delete-tenant) – delete all memories in a tenant at once

## Errors

Common codes: `400 INVALID_PARAMETERS`, `404 MEMORY_NOT_FOUND`. See [Error Responses](/api-reference/error-responses) for the full list.


## OpenAPI

````yaml DELETE /memories/delete_memory
openapi: 3.1.0
info:
  title: HydraDB API
  description: REST APIs for the HydraDB retrieval engine
  version: 0.0.1
servers:
  - url: https://api.hydradb.com
    description: Production
    x-fern-server-name: hydradb-prod
security: []
paths:
  /memories/delete_memory:
    delete:
      tags:
        - Memories
      summary: Delete memory
      operationId: delete_memory_memories_delete_memory_delete
      parameters:
        - name: tenant_id
          in: query
          required: true
          schema:
            type: string
            title: Tenant Id
            description: Tenant ID
            example: tenant_1234
          description: Tenant ID
        - name: memory_id
          in: query
          required: true
          schema:
            type: string
            description: Unique identifier of the memory to delete
            title: Memory Id
            example: memory_1234
          description: Unique identifier of the memory to delete
        - name: sub_tenant_id
          in: query
          required: false
          schema:
            anyOf:
              - type: string
              - type: 'null'
            title: Sub Tenant Id
            description: Sub-tenant ID
            example: sub_tenant_4567
          description: Sub-tenant ID
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/DeleteUserMemoryResponse'
        '400':
          description: Bad Request - Invalid input parameters
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ActualErrorResponse'
        '401':
          description: Unauthorized - Authentication required
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ActualErrorResponse'
        '403':
          description: Forbidden - Access denied
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ActualErrorResponse'
        '404':
          description: Not Found - Resource does not exist
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ActualErrorResponse'
        '422':
          description: Unprocessable Entity - Validation failed
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ActualErrorResponse'
        '500':
          description: Internal Server Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ActualErrorResponse'
        '503':
          description: Service Unavailable
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ActualErrorResponse'
      security:
        - HTTPBearer: []
components:
  schemas:
    DeleteUserMemoryResponse:
      properties:
        success:
          type: boolean
          title: Success
          description: Indicates whether the memory deletion operation was successful
          default: true
          example: true
        user_memory_deleted:
          type: boolean
          title: User Memory Deleted
          description: Confirms whether the specific memory was successfully deleted
          example: true
      type: object
      required:
        - user_memory_deleted
      title: DeleteUserMemoryResponse
      description: Response model for deleting a user memory.
    ActualErrorResponse:
      properties:
        detail:
          $ref: '#/components/schemas/ErrorResponse'
      type: object
      required:
        - detail
      title: ActualErrorResponse
    ErrorResponse:
      properties:
        success:
          type: boolean
          title: Success
          default: false
        message:
          type: string
          minLength: 1
          title: Message
          default: Error occurred
        error_code:
          anyOf:
            - type: string
            - type: 'null'
          title: Error Code
      type: object
      title: ErrorResponse
  securitySchemes:
    HTTPBearer:
      type: http
      scheme: bearer

````