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

# Get Document Status History

> Retrieve the complete status history of a Document.

Returns all status transitions ordered chronologically (oldest first),
including who/what triggered each change and optional detail messages.



## OpenAPI

````yaml /openapi.json get /documents/{document_id}/status-history
openapi: 3.1.0
info:
  title: Factio SRI API
  description: >-
    Plataforma headless, multi-tenant, API-first para emitir comprobantes
    electrónicos válidos ante el SRI de Ecuador.


    ## Autenticación


    Soporta tres métodos:

    - **JWT Bearer por Google OAuth**: `/auth/google/callback`

    - **JWT Bearer por email/password**: `/auth/login`

    - **API Key**: header `X-API-Key` con clave generada en `/auth/api-keys`


    ## Multi-tenant


    El aislamiento por tenant combina PostgreSQL RLS y validaciones explícitas
    en backend. El `tenant_id` se resuelve desde el contexto de autenticación.


    ## Flujo de Emisión


    1. `POST /documents` — reserva secuencial y encola el documento (responde
    202)

    2. `GET /documents/{id}` — consulta el estado actual por polling

    3. Cuando `status = AUTHORIZED`, el campo `authorization_number` contiene la
    clave de autorización del SRI


    Documentación completa en https://docs.factioapp.com
  version: 0.1.0
servers:
  - url: http://localhost:8000
    description: Local
  - url: https://api.factioapp.com
    description: Producción
  - url: https://api.staging.factioapp.com
    description: Sandbox (datos de prueba, sin efecto fiscal real)
security: []
paths:
  /documents/{document_id}/status-history:
    get:
      tags:
        - documents
      summary: Get Document Status History
      description: |-
        Retrieve the complete status history of a Document.

        Returns all status transitions ordered chronologically (oldest first),
        including who/what triggered each change and optional detail messages.
      operationId: get_document_status_history_documents__document_id__status_history_get
      parameters:
        - name: document_id
          in: path
          required: true
          schema:
            type: string
            format: uuid
            title: Document Id
        - name: authorization
          in: header
          required: false
          schema:
            anyOf:
              - type: string
              - type: 'null'
            title: Authorization
        - name: x-api-key
          in: header
          required: false
          schema:
            anyOf:
              - type: string
              - type: 'null'
            title: X-Api-Key
        - name: x-tenant-id
          in: header
          required: false
          schema:
            anyOf:
              - type: string
              - type: 'null'
            title: X-Tenant-Id
        - name: factio_access_token
          in: cookie
          required: false
          schema:
            anyOf:
              - type: string
              - type: 'null'
            title: Factio Access Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/DocumentStatusHistoryEntryResponse'
                title: >-
                  Response Get Document Status History Documents  Document Id 
                  Status History Get
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
components:
  schemas:
    DocumentStatusHistoryEntryResponse:
      properties:
        id:
          type: string
          format: uuid
          title: Id
        tenant_id:
          type: string
          format: uuid
          title: Tenant Id
        document_id:
          type: string
          format: uuid
          title: Document Id
        previous_status:
          anyOf:
            - type: string
            - type: 'null'
          title: Previous Status
        new_status:
          type: string
          title: New Status
        changed_by_user_id:
          anyOf:
            - type: string
              format: uuid
            - type: 'null'
          title: Changed By User Id
        changed_by_worker_id:
          anyOf:
            - type: string
            - type: 'null'
          title: Changed By Worker Id
        detail:
          anyOf:
            - type: string
            - type: 'null'
          title: Detail
        created_at:
          type: string
          format: date-time
          title: Created At
        sri_messages:
          items:
            $ref: '#/components/schemas/SRIMessageSchema'
          type: array
          title: Sri Messages
          default: []
      type: object
      required:
        - id
        - tenant_id
        - document_id
        - previous_status
        - new_status
        - changed_by_user_id
        - changed_by_worker_id
        - detail
        - created_at
      title: DocumentStatusHistoryEntryResponse
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    SRIMessageSchema:
      properties:
        identifier:
          anyOf:
            - type: string
            - type: 'null'
          title: Identifier
        message:
          type: string
          title: Message
        additional_info:
          anyOf:
            - type: string
            - type: 'null'
          title: Additional Info
        message_type:
          type: string
          title: Message Type
      type: object
      required:
        - identifier
        - message
        - additional_info
        - message_type
      title: SRIMessageSchema
    ValidationError:
      properties:
        loc:
          items:
            anyOf:
              - type: string
              - type: integer
          type: array
          title: Location
        msg:
          type: string
          title: Message
        type:
          type: string
          title: Error Type
        input:
          title: Input
        ctx:
          type: object
          title: Context
      type: object
      required:
        - loc
        - msg
        - type
      title: ValidationError

````