> ## 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.

# Get document (chat id)

> Get a Deep Reader chat document by chat pk.

`{id}` is the Deep Reader **chat** pk. For the attachment-id surface use [Get a document](/api-reference/documents/get-attachment).


## OpenAPI

````yaml GET /api/v2/documents/{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/documents/{id}/:
    get:
      tags:
        - v2/documents
      summary: Get document
      description: >-
        GET + DELETE /api/v2/documents/{id}/ — document detail and soft delete.


        Permission: `IsDocumentOwner` — authenticated user must own the Chat.

        Soft-deleted chats are excluded by `Chat.objects` so they return 404.


        AD-441 / F3: ``OrgScopedQuerySetMixin`` narrows to the principal's org

        BEFORE ``IsDocumentOwner`` runs, so a cross-org id 404s instead of
        403ing —

        a 403 would confirm the document exists.
      operationId: v2_documents_retrieve
      parameters:
        - in: path
          name: id
          schema:
            type: integer
          required: true
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/DocumentDetail'
          description: ''
        '403':
          description: No response body
        '404':
          description: No response body
      security:
        - extractApiKey: []
        - bearerAuth: []
        - cookieAuth: []
components:
  schemas:
    DocumentDetail:
      type: object
      description: >-
        Full document projection for the document viewer.


        Extends DocumentListItemSerializer with content + extraction fields, and
        the

        schema-versioning + override surface introduced by the
        schema-versioning,

        editable-batch-grid, and per-field-translation tracks.


        Optional fields (markdown_content, extraction_result) are included only
        when

        non-empty/non-null to keep the payload lean. The legacy

        ``extraction_schema_json`` JSONField was dropped from ``ChatAttachment``
        by

        ``documents/0017_struct_versioning_backfill_and_drops`` and replaced by
        the

        ``extraction_struct_version`` FK; SPA reads ``extraction_struct``
        (below) to

        get the (slug, version_number, schema_url) triple it needs to navigate
        to

        the schema authoring UI.
      properties:
        id:
          type: integer
          readOnly: true
        title:
          type: string
          maxLength: 255
        created_at:
          type: string
          format: date-time
          readOnly: true
        status:
          type: string
          readOnly: true
        progress:
          type: integer
          readOnly: true
        stage:
          type: string
          readOnly: true
        page_count:
          type: integer
          readOnly: true
        file_type:
          type: string
          readOnly: true
        file_name:
          type: string
          readOnly: true
        completed_at:
          type:
            - string
            - 'null'
          readOnly: true
        summary:
          type:
            - string
            - 'null'
          readOnly: true
        has_extraction:
          type: boolean
          readOnly: true
        has_translation:
          type: boolean
          readOnly: true
        has_overrides:
          type: boolean
          description: >-
            True iff the doc has any user-edited cells (AD-164 editable batch
            grid).


            Surfaces an "edited" badge in the SPA list view so users can spot
            which

            docs have human corrections without opening the detail page.
          readOnly: true
        has_warnings:
          type: boolean
          description: >-
            True iff the doc has any per-page processing warnings from Lynx
            (AD-147).


            Surfaces a warning icon in the SPA list view; SPA can navigate to
            the

            viewer to see per-page detail.
          readOnly: true
        snippet:
          type:
            - string
            - 'null'
          readOnly: true
        score:
          type:
            - number
            - 'null'
          format: double
          readOnly: true
        markdown_content:
          type:
            - string
            - 'null'
          readOnly: true
        translated_versions:
          type: object
          additionalProperties: {}
          readOnly: true
        lynx_document_id:
          type:
            - string
            - 'null'
          readOnly: true
        lynx_chunk_count:
          type: integer
          readOnly: true
        extraction_result:
          readOnly: true
        extraction_struct:
          type:
            - object
            - 'null'
          additionalProperties: {}
          description: >-
            Return the (slug, version_number, schema_url) triple for the

            ``StructVersion`` that produced this extraction.


            Replaces the legacy ``extraction_schema_json`` field (dropped in

            ``documents/0017``). SPA uses this to:


            * link to the schema authoring page (``/structs/<slug>/edit/``)

            * fetch the immutable published schema JSON via
              ``/api/v2/structs/<slug>/versions/<n>/`` (already exposed by the
              structs sub-namespace, see ``deckmonkey/api_v2/structs/urls.py``)
            * show "extracted using <name> v<n>" badges in the document viewer


            Returns ``None`` when the document was processed without a schema
            (free

            transcription) or when the version reference was orphaned by hard

            delete (defensive).
          readOnly: true
        processing_warnings:
          type: array
          items:
            type: object
            additionalProperties: {}
          description: >-
            Return per-page Lynx OCR warnings for this document (AD-147).


            Each entry shaped like ``{page, code, message, severity}``. Empty
            list

            when the document processed cleanly. SPA renders these inline in the

            viewer to flag pages where OCR self-recovery had to fall back.
          readOnly: true
        overrides_count:
          type: integer
          description: |-
            Number of fields with at least one user-edit override (AD-164).

            Counts the dict keys in ``extraction_overrides`` regardless of which
            side (original / translated) was edited. SPA shows this as a small
            badge on the document detail header.
          readOnly: true
        has_translated_overrides:
          type: boolean
          description: >-
            True iff at least one override entry has a ``translated_value`` slot

            populated (AD-164 per-side editing).


            Distinct from ``has_overrides`` (any side) — useful for SPA to know

            whether translation edits exist before deciding whether to surface
            the

            translated/original toggle on the document viewer.
          readOnly: true
      required:
        - completed_at
        - created_at
        - extraction_result
        - extraction_struct
        - file_name
        - file_type
        - has_extraction
        - has_overrides
        - has_translated_overrides
        - has_translation
        - has_warnings
        - id
        - lynx_chunk_count
        - lynx_document_id
        - markdown_content
        - overrides_count
        - page_count
        - processing_warnings
        - progress
        - score
        - snippet
        - stage
        - status
        - summary
        - translated_versions
  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.

````