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

# List patient documents

> Retrieve documents for a specific patient. Pass `external_id=<value>` to look up a single document by caller-supplied external_id (returns 404 if not found).

Use this to poll a document's extraction progress after upload: `status` moves `pending` → `processing` → `completed` (or `failed`), and `has_extracted_text`/`extracted_text_length` indicate whether extracted text is available (the text content itself is not returned).



## OpenAPI

````yaml /openapi/ext-api-v1.json get /patients/{patientId}/documents
openapi: 3.0.0
info:
  title: Healos External API
  version: 1.0.0
  description: >-
    External API for managing patients, documents, and appointments, listing
    providers, and for pulling clinical notes (with transcript and patient
    context).
servers:
  - url: https://api.healos.ai/ext-api/v1
    description: Production
  - url: http://localhost:8787/ext-api/v1
    description: Local development
security:
  - ApiKeyAuth: []
paths:
  /patients/{patientId}/documents:
    get:
      tags:
        - Documents
      summary: List patient documents
      description: >-
        Retrieve documents for a specific patient. Pass `external_id=<value>` to
        look up a single document by caller-supplied external_id (returns 404 if
        not found).


        Use this to poll a document's extraction progress after upload: `status`
        moves `pending` → `processing` → `completed` (or `failed`), and
        `has_extracted_text`/`extracted_text_length` indicate whether extracted
        text is available (the text content itself is not returned).
      parameters:
        - schema:
            type: string
            description: Patient ID
            example: '1743552000000'
          required: true
          name: patientId
          in: path
        - schema:
            type: string
            description: Look up a single document by caller-supplied external_id.
            example: PARTNER-DOC-456
          required: false
          name: external_id
          in: query
      responses:
        '200':
          description: List of documents
          content:
            application/json:
              schema:
                type: object
                properties:
                  data:
                    type: array
                    items:
                      $ref: '#/components/schemas/Document'
                required:
                  - data
        '403':
          description: Insufficient scope
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '404':
          description: Patient, document, or external_id not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '429':
          description: Rate limit exceeded
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/RateLimitError'
components:
  schemas:
    Document:
      type: object
      properties:
        id:
          type: string
          description: Document ID
          example: d4e5f6a7-b8c9-4d0e-1f2a-3b4c5d6e7f8a
        filename:
          type: string
          description: Original uploaded filename
          example: intake_form_maria_santos.pdf
        file_type:
          type: string
          enum:
            - pdf
            - image
            - docx
          description: Type of the file
        file_size:
          type: number
          description: File size in bytes
          example: 245760
        public_url:
          type: string
          nullable: true
          description: Public URL if available
        upload_date:
          type: string
          description: ISO 8601 upload timestamp
          example: '2026-03-20T11:15:00.000Z'
        status:
          type: string
          enum:
            - pending
            - processing
            - completed
            - failed
          description: Document processing status
        extracted_date:
          type: string
          nullable: true
          description: ISO 8601 timestamp when extraction completed, if available
          example: '2026-03-20T11:16:00.000Z'
        extraction_error:
          type: string
          nullable: true
          description: Last extraction error, if extraction failed
          example: No text could be extracted from the PDF
        has_extracted_text:
          type: boolean
          description: Whether extracted text is stored for this document
          example: true
        extracted_text_length:
          type: number
          description: Length of the extracted text stored for this document
          example: 2048
        external_id:
          type: string
          nullable: true
          description: Caller-supplied external identifier (immutable once set)
          example: PARTNER-DOC-456
      required:
        - id
        - filename
        - file_type
        - file_size
        - public_url
        - upload_date
        - status
        - extracted_date
        - extraction_error
        - has_extracted_text
        - extracted_text_length
        - external_id
    Error:
      type: object
      properties:
        error:
          type: string
      required:
        - error
    RateLimitError:
      type: object
      properties:
        error:
          type: string
          example: Rate limit exceeded. Please retry after the window resets.
      required:
        - error
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: X-API-Key
      description: API key obtained from /api/v1/ext-api-keys

````