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

> Canonical library list. Each row is a ChatAttachment.

Canonical library list. Each row is a `ChatAttachment` — this id is what the unified viewer and the other `/attachments/{att_id}/` routes use.

The list is the caller's organization, plus (on a personal credential only) documents the caller still owns after an org move. An API key stays inside the key's tenant.

<Note>
  `GET /api/v2/documents/` is the older **chat-centric** list (`{id}` = Deep Reader chat pk). Prefer this attachment list unless you are driving that older surface.
</Note>


## OpenAPI

````yaml GET /api/v2/documents/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/documents/attachments/:
    get:
      tags:
        - v2/documents
      summary: List documents (unified, att-centric)
      description: >-
        Paginated list of every document (``ChatAttachment``) visible to the
        caller - own uploads, org-shared, and linked - across all chats and
        batches. Distinct from the chat-pk-centric Deep Reader list at ``GET
        /api/v2/documents/``.
      operationId: v2_documents_attachments_list
      parameters:
        - in: query
          name: from_batch
          schema:
            type: integer
          description: Only docs belonging to this batch id.
        - in: query
          name: from_chat
          schema:
            type: integer
          description: Only docs whose home chat is this id.
        - in: query
          name: has_schema
          schema:
            type: boolean
          description: Filter by whether a schema is pinned.
        - in: query
          name: order
          schema:
            type: string
          description: Sort field (whitelisted).
        - in: query
          name: page
          schema:
            type: integer
          description: 1-based page number.
        - in: query
          name: page_size
          schema:
            type: integer
          description: Items per page (1-100, default 24).
        - in: query
          name: processing_status
          schema:
            type: string
            enum:
              - all
              - completed
              - failed
              - pending
          description: Filter by status. Omit for 'completed'; pass 'all' to disable.
        - in: query
          name: q
          schema:
            type: string
          description: Case-insensitive file-name substring match.
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AttachmentDocumentListResponse'
          description: ''
      security:
        - extractApiKey: []
        - bearerAuth: []
        - cookieAuth: []
components:
  schemas:
    AttachmentDocumentListResponse:
      type: object
      description: Paginated envelope for the document-library list endpoint.
      properties:
        documents:
          type: array
          items:
            $ref: '#/components/schemas/AttachmentDocumentListItem'
        page:
          type: integer
        page_size:
          type: integer
        total:
          type: integer
        has_more:
          type: boolean
      required:
        - documents
        - has_more
        - page
        - page_size
        - total
    AttachmentDocumentListItem:
      type: object
      description: |-
        List-item projection of a ``ChatAttachment`` (unified document).

        Recency-first document-library rows. Deliberately omits ``file.size``
        (reading it hits the storage backend — one blocking GCS round-trip per
        row) and the heavy content fields (markdown / extraction_result), which
        only the detail surface carries.

        Computed fields:
            has_schema: a ``StructVersion`` is pinned (schema-guided extraction).
            has_extraction: ``extraction_result`` is populated.
            has_translation: at least one translated version exists.
            has_warnings: Lynx emitted processing warnings.
      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)
        document_summary:
          type:
            - string
            - 'null'
          readOnly: true
          description: Cached document summary from Lynx processing
        has_extraction:
          type: boolean
          description: True when schema-guided extraction produced a result.
          readOnly: true
        has_translation:
          type: boolean
          description: True when at least one translated version exists.
          readOnly: true
        has_warnings:
          type: boolean
          description: True when Lynx emitted any processing warnings.
          readOnly: true
        home_chat_id:
          type: integer
          readOnly: true
        created_at:
          type: string
          format: date-time
          readOnly: true
        completed_at:
          type:
            - string
            - 'null'
          format: date-time
          readOnly: true
          description: When Lynx processing finished (set on COMPLETED/FAILED transitions).
      required:
        - completed_at
        - created_at
        - document_summary
        - extraction_struct_version_id
        - file_name
        - file_type
        - has_extraction
        - has_schema
        - has_translation
        - has_warnings
        - home_chat_id
        - id
        - is_from_kb
        - 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.

````