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

# Delete memory

> Hard-delete a memory — fact, artifact, or episode.

Removes the record outright (no soft-delete / tombstone). A
deleted fact disappears from supersede chains; the revision walker
(``GET /{id}/revisions``) tolerates the missing node and simply
stops there. Idempotent: the first delete returns 204, subsequent
deletes return 404 (the record is gone, so the existence check
below fails).



## OpenAPI

````yaml https://api.staging.xtrace.ai/openapi.public.json delete /v1/memories/{memory_id}
openapi: 3.1.0
info:
  title: XTrace Vec DB
  description: XTrace API
  version: 1.0.0
servers:
  - url: https://api.production.xtrace.ai
    description: Production
security:
  - ApiKeyHeader: []
  - BearerToken: []
paths:
  /v1/memories/{memory_id}:
    delete:
      tags:
        - memories
      summary: Delete memory
      description: |-
        Hard-delete a memory — fact, artifact, or episode.

        Removes the record outright (no soft-delete / tombstone). A
        deleted fact disappears from supersede chains; the revision walker
        (``GET /{id}/revisions``) tolerates the missing node and simply
        stops there. Idempotent: the first delete returns 204, subsequent
        deletes return 404 (the record is gone, so the existence check
        below fails).
      operationId: delete_memory_v1_memories__memory_id__delete
      parameters:
        - name: memory_id
          in: path
          required: true
          schema:
            type: string
            title: Memory Id
      responses:
        '204':
          description: Deleted. Subsequent DELETEs return 404 (idempotent contract).
        '401':
          description: >-
            Authentication failed. Missing / invalid API key. Body carries
            `detail.code = "unauthorized"`.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorEnvelope'
        '404':
          description: >-
            `detail.code = "memory_not_found"` — unknown id (or already
            deleted).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorEnvelope'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
        '429':
          description: >-
            Rate-limit or daily-cap exceeded. `Retry-After` and `RateLimit-*`
            response headers indicate when to retry.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorEnvelope'
        '500':
          description: '`detail.code = "delete_failed"` — storage error removing the point.'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorEnvelope'
      x-codeSamples:
        - lang: typescript
          label: TypeScript SDK
          source: >
            import { MemoryClient } from '@xtraceai/memory';


            const client = new MemoryClient({
              apiKey: process.env.XTRACE_API_KEY!,
              orgId:  process.env.XTRACE_ORG_ID!,
            });


            // Hard delete: the point is removed outright (no tombstone).
            Afterwards

            // get returns 404 and the row is gone from list/search; a second
            delete

            // also returns 404 (idempotent by absence).

            await
            client.memories.delete('5b0d0f7d-d502-45d5-847d-e19512b5c517');
components:
  schemas:
    ErrorEnvelope:
      properties:
        detail:
          $ref: '#/components/schemas/ErrorDetail'
      type: object
      required:
        - detail
      title: ErrorEnvelope
      description: |-
        Standard error body for non-2xx responses raised by the memory
        API. Pydantic field-validation failures (422) use the FastAPI-
        default ``HTTPValidationError`` shape instead, where ``detail`` is
        an array of per-field error entries — switch on the response
        status code to pick the right shape.
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    ErrorDetail:
      properties:
        code:
          type: string
          title: Code
          description: >-
            Stable error identifier. Switch on this rather than parsing the
            message. Common values: `invalid_request`, `invalid_messages`,
            `memory_not_found`, `job_not_found`, `immutable_field`,
            `reserved_field`, `empty_text_field`, `missing_user_id`,
            `missing_conv_id`, `unsupported_include_option`, `cursor_mismatch`,
            `unauthorized`, `forbidden`, `rate_limited`, `delete_failed`,
            `search_failed`, `ingest_failed`, `server_error`.
          examples:
            - memory_not_found
        message:
          type: string
          title: Message
          description: Human-readable summary; safe to log but not safe to switch on.
          examples:
            - Memory 0fa1c0e6-... not found
      type: object
      required:
        - code
        - message
      title: ErrorDetail
      description: |-
        Inner ``detail`` block on every non-2xx response raised by a
        memory-API route handler. ``code`` is the stable identifier
        clients should switch on; ``message`` is a sanitized human-
        readable summary.
    ValidationError:
      properties:
        loc:
          items:
            anyOf:
              - type: string
              - type: integer
          type: array
          title: Location
        msg:
          type: string
          title: Message
        type:
          type: string
          title: Error Type
      type: object
      required:
        - loc
        - msg
        - type
      title: ValidationError
  securitySchemes:
    ApiKeyHeader:
      type: apiKey
      in: header
      name: x-api-key
      description: 'Long-lived org API key. Alternative: `Authorization: Bearer <key>`.'
    BearerToken:
      type: http
      scheme: bearer
      bearerFormat: Token
      description: 'Long-lived API key sent as `Authorization: Bearer <api-key>`.'

````