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

# Unlink a chat document

> Unlink or remove a document from an Extract chat.

Removes a link, or the home attachment when this chat owns it. Does not revoke source visibility elsewhere.


## OpenAPI

````yaml DELETE /api/v2/chats/{thread_id}/attachments/{id}/
openapi: 3.1.0
info:
  title: Abacus Docs API
  version: 1.0.0
  description: |
    REST + SSE surface for Abacus Docs on the same host as the web app
    (`https://abacusdocs.com`). Paths are `/api/v2/…`.

    Authenticate with an organisation API key (`sk-abacus-*`) as a Bearer
    token, or an Auth0 access token. Cross-tenant reads return **404**, not
    403. Page-based lists use `?page=` and `?page_size=`.

    Extraction, reprocess, schema tests, and chat turns spend credits.
    See the help centre Credits pages for rates.
  contact:
    name: Abacus Docs
    url: https://abacusdocs.com/contact
servers:
  - url: https://abacusdocs.com
    description: Production (Extract)
security: []
paths:
  /api/v2/chats/{thread_id}/attachments/{id}/:
    delete:
      tags:
        - v2/chats
      summary: Remove a document from a chat (smart delete)
      description: >-
        Smart delete: if the document's home chat is THIS chat, the document is
        deleted. For a Deep Reader (`document-intelligence`) chat the chat IS
        the document, so the chat is soft-deleted + its share links revoked (the
        attachment row is preserved for audit); for any other workflow the
        attachment row is hard-deleted in place and the chat survives. Lynx ES
        chunks and the stored file blob are cleaned up either way. If the
        document is only LINKed into this chat, just the link row is removed —
        the document survives in its home chat. 404 when the document is neither
        a home doc nor linked into this chat. 409 when a Deep Reader Q&A worker
        is mid-answer (the delete refuses rather than race it). Returns 204.
      operationId: v2_chats_attachments_destroy
      parameters:
        - in: path
          name: id
          schema:
            type: integer
          required: true
        - in: path
          name: thread_id
          schema:
            type: string
          required: true
      responses:
        '204':
          description: No response body
        '404':
          content:
            application/json:
              schema:
                type: object
                additionalProperties: {}
          description: ''
        '409':
          content:
            application/json:
              schema:
                type: object
                additionalProperties: {}
          description: ''
      security:
        - extractApiKey: []
        - bearerAuth: []
        - cookieAuth: []
components:
  securitySchemes:
    extractApiKey:
      type: http
      scheme: bearer
      bearerFormat: API Key
      description: |
        Organisation API key from Settings → API / `/api/keys/`. The secret is
        shown once. Send `Authorization: Bearer sk-abacus-…`. One active key
        per organisation. Ingest (`/api/v2/ingest/*`) refuses API keys — that
        surface is Auth0-only with `ingest:read` / `ingest:write` scopes.
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT
      description: >
        Auth0 access token for a signed-in user. Send `Authorization: Bearer
        <token>`.

        The SPA and desktop agent use this. Prefer an organisation API key for

        server-to-server integrations.
    cookieAuth:
      type: apiKey
      in: cookie
      name: sessionid
      description: |
        Django session cookie from a browser login. Present so the web app can
        call `/api/v2` without a header. Do not rely on this for integrations.

````