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

# List chat documents

> List documents attached to an Extract chat.

Home uploads and linked documents (`is_linked=true`). Filter with `has_schema` and `processing_status`.


## OpenAPI

````yaml GET /api/v2/chats/{thread_id}/attachments/
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/:
    get:
      tags:
        - v2/chats
      summary: List a chat's documents
      description: >-
        Returns the documents attached to the chat — both uploaded directly
        (home) and LINKed in from another chat (``is_linked=true``). Filters:
        ``has_schema`` (bool), ``processing_status`` (pending/completed/failed),
        ``order`` (±created_at / ±file_name, default -created_at). 404 on a
        thread the caller doesn't own.
      operationId: v2_chats_attachments_list
      parameters:
        - in: query
          name: has_schema
          schema:
            type: boolean
          description: Only docs with / without a pinned schema.
        - in: query
          name: order
          schema:
            type: string
          description: 'Sort field: ±created_at / ±file_name. Default -created_at.'
        - in: query
          name: processing_status
          schema:
            type: string
          description: 'Filter by processing status: pending / completed / failed.'
        - in: path
          name: thread_id
          schema:
            type: string
          required: true
      responses:
        '200':
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/ChatAttachment'
          description: ''
        '404':
          content:
            application/json:
              schema:
                type: object
                additionalProperties: {}
          description: ''
      security:
        - extractApiKey: []
        - bearerAuth: []
        - cookieAuth: []
components:
  schemas:
    ChatAttachment:
      type: object
      description: >-
        Response shape for a single chat attachment (document).


        Used by the list endpoint, the upload response (``created`` rows), and

        anywhere the SPA renders a document chip. ``file.size`` is deliberately

        NOT surfaced — reading it hits the storage backend, which would mean one

        blocking GCS round-trip per row in a list. The SPA gets the size from
        the

        unified document-detail surface (Task 16) when it actually needs it.


        Two computed fields:
            has_schema: whether a ``StructVersion`` is pinned for schema-guided
                extraction (``extraction_struct_version`` is set).
            is_linked: whether this doc is LINKED into the chat being serialized
                (its home chat is a different chat) rather than uploaded directly.
                Computed from ``context["chat_pk"]`` — defaults to ``False`` when
                no chat context is supplied (e.g. the upload response, where every
                row is a fresh home-chat document).
      properties:
        id:
          type: integer
          readOnly: true
        file_name:
          type: string
          readOnly: true
        file_type:
          type: string
          readOnly: true
        processing_status:
          allOf:
            - $ref: '#/components/schemas/ProcessingStatusEnum'
          readOnly: true
          description: |-
            Lynx processing pipeline status: pending → completed/failed

            * `pending` - Pending
            * `completed` - Completed
            * `failed` - Failed
        processing_progress:
          type: integer
          readOnly: true
          description: Processing completion percentage 0-100
        processing_stage:
          type: string
          readOnly: true
          description: >-
            Current processing stage name, or the failure reason on a FAILED
            attachment
        page_count:
          type: integer
          readOnly: true
          description: Number of pages in the original document
        has_schema:
          type: boolean
          description: True when a schema (StructVersion) is pinned for extraction.
          readOnly: true
        extraction_struct_version_id:
          type:
            - integer
            - 'null'
          description: >-
            StructVersion that produced this attachment's extraction_result.
            NULL for non-batch attachments or pre-versioning records.
          readOnly: true
        target_language:
          type: string
          readOnly: true
          description: ISO language code for translation target (e.g. 'en', 'ar')
        is_from_kb:
          type: boolean
          readOnly: true
          description: Whether this attachment came from Knowledge Base
        kb_file_id:
          type:
            - integer
            - 'null'
          readOnly: true
          description: Original Knowledge Base file ID if from KB
        lynx_document_id:
          type:
            - string
            - 'null'
          readOnly: true
          description: Lynx document ID after processing (extraction + chunking + indexing)
        is_linked:
          type: boolean
          description: >-
            True when the doc is linked into ``context['chat_pk']`` from
            elsewhere.


            A direct (home) attachment has ``chat_id == chat_pk``; a linked-in
            doc

            keeps its original home ``chat_id`` (the link lives in

            ``ChatAttachmentLink``), so ``chat_id != chat_pk`` marks it linked.
          readOnly: true
        created_at:
          type: string
          format: date-time
          readOnly: true
      required:
        - created_at
        - extraction_struct_version_id
        - file_name
        - file_type
        - has_schema
        - id
        - is_from_kb
        - is_linked
        - kb_file_id
        - lynx_document_id
        - page_count
        - processing_progress
        - processing_stage
        - processing_status
        - target_language
    ProcessingStatusEnum:
      enum:
        - pending
        - completed
        - failed
      type: string
      description: |-
        * `pending` - Pending
        * `completed` - Completed
        * `failed` - Failed
  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.

````