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

# Delete (archive) a saved document.

> Soft-archive a saved document — it leaves the Files view but is recoverable server-side.
Presence-aware: if the document is currently open in ANOTHER session and `force` is not set,
the request FAILS honestly with HTTP 409 (`code:"document_in_use"` + `open_in_sessions:N` +
`suggested_action`) so callers can confirm "open in N other session(s) — delete anyway?" and
re-call with `force=true`. On `force=true` it archives, unlinks every session, and notifies the
other sessions (which then prompt the user to keep editing or honor the deletion).

WP8-c (C6 F22): this used to return HTTP 200 with the doc NOT archived — the blind-test agent
(and any reasonable client) read 200 as success and believed its cleanup happened; prod ended
with 36 documents, 0 archived, and 5 duplicate "Employee Handbook" entries the agent thought it
had deleted. A no-op must never wear a success status.



## OpenAPI

````yaml /openapi.json delete /v1/documents/{document_id}
openapi: 3.1.0
info:
  title: Universal Document AI API
  description: AI-powered document editing with multi-tenant organization support
  version: 2.0.0
servers: []
security: []
paths:
  /v1/documents/{document_id}:
    delete:
      tags:
        - v1
        - mcp
      summary: Delete (archive) a saved document.
      description: >-
        Soft-archive a saved document — it leaves the Files view but is
        recoverable server-side.

        Presence-aware: if the document is currently open in ANOTHER session and
        `force` is not set,

        the request FAILS honestly with HTTP 409 (`code:"document_in_use"` +
        `open_in_sessions:N` +

        `suggested_action`) so callers can confirm "open in N other session(s) —
        delete anyway?" and

        re-call with `force=true`. On `force=true` it archives, unlinks every
        session, and notifies the

        other sessions (which then prompt the user to keep editing or honor the
        deletion).


        WP8-c (C6 F22): this used to return HTTP 200 with the doc NOT archived —
        the blind-test agent

        (and any reasonable client) read 200 as success and believed its cleanup
        happened; prod ended

        with 36 documents, 0 archived, and 5 duplicate "Employee Handbook"
        entries the agent thought it

        had deleted. A no-op must never wear a success status.
      operationId: archive_document
      parameters:
        - name: document_id
          in: path
          required: true
          schema:
            type: string
            title: Document Id
        - name: force
          in: query
          required: false
          schema:
            type: boolean
            description: >-
              Confirm deletion of a doc that is open in another session. Without
              it, deleting an in-use doc fails with HTTP 409 (code
              document_in_use, open_in_sessions:N) instead of tombstoning —
              nothing is archived until you re-call with force=true.
            default: false
            title: Force
          description: >-
            Confirm deletion of a doc that is open in another session. Without
            it, deleting an in-use doc fails with HTTP 409 (code
            document_in_use, open_in_sessions:N) instead of tombstoning —
            nothing is archived until you re-call with force=true.
        - name: from_session
          in: query
          required: false
          schema:
            anyOf:
              - type: string
              - type: 'null'
            description: >-
              The caller's own session id (so it is excluded from the in-use
              check). Omit for a pure Files-view delete.
            title: From Session
          description: >-
            The caller's own session id (so it is excluded from the in-use
            check). Omit for a pure Files-view delete.
        - name: authorization
          in: header
          required: false
          schema:
            anyOf:
              - type: string
              - type: 'null'
            title: Authorization
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
      security:
        - HTTPBearer: []
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
      type: object
      required:
        - loc
        - msg
        - type
      title: ValidationError
  securitySchemes:
    HTTPBearer:
      type: http
      scheme: bearer

````