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

# Request a memory-space purge (step 1 of 2) [Cloud-only]

> **Permanent — there is no undo.** Step 1 of 2: asks for a purge and returns a `nonce`. Nothing is deleted yet.

- `scope: "space"` purges the whole memory space; `"app"` one app (`app_id`); `"project"` one project of one app (`app_id` + `project_id`).
- Confirm with `POST /purge/confirm` before `expires_at` (5 minutes). The nonce is single use and only valid for the same memory space and API key.

What is deleted: memories, sessions, messages, memory cells, feedback, events and (space scope only) senders and knowledge bases (`/api/v2/knowledge_bases`: categories, documents, topics), from every index. Left in object storage, no longer reachable through the API: files uploaded through `/object/sign`, and (space scope) the stored text of knowledge base topics.



## OpenAPI

````yaml /api-reference/openapi.json post /api/v2/memory/purge
openapi: 3.1.0
info:
  title: EverOS Cloud Memory API
  version: 2.0.0
  license:
    name: Apache-2.0
    identifier: Apache-2.0
  contact:
    name: EverMind AI
    email: service@evermind.ai
    url: https://github.com/EverMind-AI/everos-cloud-sdk-python
  description: >-
    Official Python client for the EverOS Cloud Memory API. Add, search,
    retrieve, and manage long-term memory for your AI applications over a typed
    interface (pydantic v2, with full type hints). Install and usage guides:
    https://github.com/EverMind-AI/everos-cloud-sdk-python
servers:
  - url: https://api.evermind.ai
    description: Production
security:
  - BearerAuth: []
paths:
  /api/v2/memory/purge:
    post:
      tags:
        - Memory
      summary: Request a memory-space purge (step 1 of 2) [Cloud-only]
      description: >-
        **Permanent — there is no undo.** Step 1 of 2: asks for a purge and
        returns a `nonce`. Nothing is deleted yet.


        - `scope: "space"` purges the whole memory space; `"app"` one app
        (`app_id`); `"project"` one project of one app (`app_id` +
        `project_id`).

        - Confirm with `POST /purge/confirm` before `expires_at` (5 minutes).
        The nonce is single use and only valid for the same memory space and API
        key.


        What is deleted: memories, sessions, messages, memory cells, feedback,
        events and (space scope only) senders and knowledge bases
        (`/api/v2/knowledge_bases`: categories, documents, topics), from every
        index. Left in object storage, no longer reachable through the API:
        files uploaded through `/object/sign`, and (space scope) the stored text
        of knowledge base topics.
      operationId: requestPurge
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/PurgeRequestInput'
        required: true
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SuccessEnvelope_PurgeRequestData_'
        '401':
          description: Missing or invalid bearer token.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/GatewayError'
        '403':
          description: >-
            Authenticated but not permitted — either rejected by the auth
            service, or the account's memory API version does not match the
            interface version implied by the path (a v1 account calling an
            /api/v2 route).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/GatewayError'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
        '429':
          description: >-
            Rate limit or quota exceeded. Besides the account-wide limits, each
            memory space may send /purge and /purge/confirm only a limited
            number of times per minute (10 each by default); wait for the
            `Retry-After` header. Requests the engine rejects do not count
            against this limit.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/GatewayError'
        '503':
          description: >-
            The gateway could not reach the authentication service. Transient —
            retry with backoff.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/GatewayError'
components:
  schemas:
    PurgeRequestInput:
      properties:
        scope:
          type: string
          enum:
            - space
            - app
            - project
          title: Scope
          description: >-
            `space` purges the whole memory space; `app` one app in it
            (`app_id`); `project` one project of one app (`app_id` +
            `project_id`).
        app_id:
          anyOf:
            - type: string
              maxLength: 128
            - type: 'null'
          title: App Id
          description: Required for `app` and `project` scope.
        project_id:
          anyOf:
            - type: string
              maxLength: 128
            - type: 'null'
          title: Project Id
          description: Required for `project` scope.
      additionalProperties: false
      type: object
      required:
        - scope
      title: PurgeRequestInput
      description: 'Step 1: ask for a purge. Nothing is deleted.'
    SuccessEnvelope_PurgeRequestData_:
      properties:
        request_id:
          type: string
          title: Request Id
          description: Request trace id (peer to data)
        data:
          $ref: '#/components/schemas/PurgeRequestData'
          description: Endpoint-defined business result
      type: object
      required:
        - request_id
        - data
      title: SuccessEnvelope[PurgeRequestData]
    GatewayError:
      type: object
      additionalProperties: true
      description: >-
        Gateway error body. NOTE: shape is not yet uniform across auth/quota/
        rate-limit paths — treat fields as best-effort. Commonly includes a
        `code`/`message` (flat) or an `error` object/string with a `message`.
      title: GatewayError
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
          description: One entry per field that failed validation.
      type: object
      title: HTTPValidationError
    PurgeRequestData:
      properties:
        nonce:
          type: string
          title: Nonce
          description: Send to /purge/confirm before `expires_at`.
        expires_at:
          type: string
          format: date-time
          title: Expires At
        scope:
          type: string
          enum:
            - space
            - app
            - project
          title: Scope
        app_id:
          anyOf:
            - type: string
            - type: 'null'
          title: App Id
        project_id:
          anyOf:
            - type: string
            - type: 'null'
          title: Project Id
        summary:
          $ref: '#/components/schemas/PurgeSummary'
      type: object
      required:
        - nonce
        - expires_at
        - scope
        - summary
      title: PurgeRequestData
      description: The nonce to confirm, and what it will purge.
    ValidationError:
      properties:
        loc:
          items:
            anyOf:
              - type: string
              - type: integer
          type: array
          title: Location
          description: Path to the offending field, from the body root.
        msg:
          type: string
          title: Message
          description: What is wrong with it.
        type:
          type: string
          title: Error Type
          description: Machine-readable validation-error kind.
      type: object
      required:
        - loc
        - msg
        - type
      title: ValidationError
    PurgeSummary:
      properties:
        mongo:
          additionalProperties:
            anyOf:
              - type: integer
              - type: 'null'
          type: object
          title: Mongo
          description: >-
            MongoDB documents per memory type (collection without the `v2_`
            prefix), the source of truth.
        mongo_total:
          anyOf:
            - type: integer
            - type: 'null'
          title: Mongo Total
          description: Sum of `mongo`; null if incomplete.
        elasticsearch_total:
          anyOf:
            - type: integer
            - type: 'null'
          title: Elasticsearch Total
          description: Elasticsearch docs (derived from MongoDB); null if not counted.
        milvus_total:
          anyOf:
            - type: integer
            - type: 'null'
          title: Milvus Total
          description: Milvus entities (derived from MongoDB); null if not counted.
        complete:
          type: boolean
          title: Complete
          description: False when any count timed out or failed.
        counted_at:
          type: string
          format: date-time
          title: Counted At
        comment:
          type: string
          title: Comment
          description: What the counts include and exclude (soft-deleted rows, feedback).
        error:
          anyOf:
            - type: string
            - type: 'null'
          title: Error
          description: >-
            Which counts did not finish and why, e.g. `milvus:episode: timed out
            after 30s`; null when `complete`.
      type: object
      required:
        - mongo
        - mongo_total
        - elasticsearch_total
        - milvus_total
        - complete
        - counted_at
        - comment
      title: PurgeSummary
      description: >-
        What the purge would delete right now, counted per store.


        A snapshot at request time: data written before the purge runs is
        deleted too.

        Counts include soft-deleted rows (the purge removes those as well), so
        they can be

        higher than what ``get`` shows. Feedback is not memory data and is not
        counted.

        A count that did not finish in time is ``null`` and ``complete`` is
        ``false``.
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer
      description: 'API key issued by EverOS, sent as `Authorization: Bearer <api_key>`.'

````

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