> ## 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 Operational Readiness

> Get operational readiness status for the current tenant.

Checks if the tenant has all required entities configured and active:
- Principal issuer (oldest by created_at)
- Active certificate for that issuer
- Establishment (oldest by created_at)
- Emission point (oldest by created_at)

The environment is derived from the principal issuer or certificate.
The tenant is considered operational if all four entities are present and active.

All database operations use async/await for non-blocking I/O.

Args:
    db: Async database session
    tenant_id: Active tenant ID from authentication context
    current_user: Current user context from authentication

Returns:
    OperationalReadinessResponse: Aggregated readiness status with entity details



## OpenAPI

````yaml /openapi.json get /dashboard/operational-readiness
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:
  /dashboard/operational-readiness:
    get:
      tags:
        - dashboard
      summary: Get Operational Readiness
      description: >-
        Get operational readiness status for the current tenant.


        Checks if the tenant has all required entities configured and active:

        - Principal issuer (oldest by created_at)

        - Active certificate for that issuer

        - Establishment (oldest by created_at)

        - Emission point (oldest by created_at)


        The environment is derived from the principal issuer or certificate.

        The tenant is considered operational if all four entities are present
        and active.


        All database operations use async/await for non-blocking I/O.


        Args:
            db: Async database session
            tenant_id: Active tenant ID from authentication context
            current_user: Current user context from authentication

        Returns:
            OperationalReadinessResponse: Aggregated readiness status with entity details
      operationId: get_operational_readiness_dashboard_operational_readiness_get
      parameters:
        - 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:
                $ref: '#/components/schemas/OperationalReadinessResponse'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
components:
  schemas:
    OperationalReadinessResponse:
      properties:
        issuer:
          anyOf:
            - $ref: '#/components/schemas/IssuerResponse'
            - type: 'null'
        certificate:
          anyOf:
            - $ref: '#/components/schemas/CertificateResponse'
            - type: 'null'
        establishment:
          anyOf:
            - $ref: '#/components/schemas/EstablishmentResponse'
            - type: 'null'
        emission_point:
          anyOf:
            - $ref: '#/components/schemas/EmissionPointResponse'
            - type: 'null'
        environment:
          anyOf:
            - $ref: '#/components/schemas/SRIEnvironment'
            - type: 'null'
        readiness:
          $ref: '#/components/schemas/ReadinessFlags'
      type: object
      required:
        - issuer
        - certificate
        - establishment
        - emission_point
        - environment
        - readiness
      title: OperationalReadinessResponse
      description: Full operational readiness response for a tenant.
      example:
        readiness:
          has_certificate: false
          has_emission_point: false
          has_establishment: false
          has_issuer: false
          is_operational: false
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    IssuerResponse:
      properties:
        id:
          type: string
          format: uuid
          title: Id
        tenant_id:
          type: string
          format: uuid
          title: Tenant Id
        ruc:
          type: string
          title: Ruc
        razon_social:
          type: string
          title: Razon Social
        nombre_comercial:
          anyOf:
            - type: string
            - type: 'null'
          title: Nombre Comercial
        legal_representative:
          anyOf:
            - type: string
            - type: 'null'
          title: Legal Representative
        direccion_matriz:
          type: string
          title: Direccion Matriz
        tipo_contribuyente:
          type: string
          title: Tipo Contribuyente
        sri_environment:
          $ref: '#/components/schemas/SRIEnvironment'
        is_active:
          type: boolean
          title: Is Active
        created_at:
          type: string
          format: date-time
          title: Created At
        updated_at:
          type: string
          format: date-time
          title: Updated At
      type: object
      required:
        - id
        - tenant_id
        - ruc
        - razon_social
        - nombre_comercial
        - legal_representative
        - direccion_matriz
        - tipo_contribuyente
        - sri_environment
        - is_active
        - created_at
        - updated_at
      title: IssuerResponse
      description: Schema for Issuer response.
      example:
        created_at: '2024-01-01T00:00:00Z'
        direccion_matriz: Av. Principal 123 y Secundaria, Quito, Ecuador
        id: 550e8400-e29b-41d4-a716-446655440000
        is_active: true
        legal_representative: Jane Doe
        nombre_comercial: Ejemplo Corp
        razon_social: EMPRESA EJEMPLO S.A.
        ruc: '1234567890001'
        sri_environment: TEST
        tenant_id: 660e8400-e29b-41d4-a716-446655440000
        tipo_contribuyente: General
        updated_at: '2024-01-01T00:00:00Z'
    CertificateResponse:
      properties:
        id:
          type: string
          format: uuid
          title: Id
        tenant_id:
          type: string
          format: uuid
          title: Tenant Id
        issuer_id:
          type: string
          format: uuid
          title: Issuer Id
        subject_cn:
          anyOf:
            - type: string
            - type: 'null'
          title: Subject Cn
        serial_number:
          anyOf:
            - type: string
            - type: 'null'
          title: Serial Number
        valid_from:
          type: string
          format: date-time
          title: Valid From
        valid_until:
          type: string
          format: date-time
          title: Valid Until
        status:
          $ref: '#/components/schemas/CertificateStatus'
        created_at:
          type: string
          format: date-time
          title: Created At
        updated_at:
          type: string
          format: date-time
          title: Updated At
      type: object
      required:
        - id
        - tenant_id
        - issuer_id
        - subject_cn
        - serial_number
        - valid_from
        - valid_until
        - status
        - created_at
        - updated_at
      title: CertificateResponse
      description: Schema for Certificate response (without sensitive data).
      example:
        created_at: '2024-01-01T00:00:00Z'
        id: 990e8400-e29b-41d4-a716-446655440000
        issuer_id: 550e8400-e29b-41d4-a716-446655440000
        serial_number: 1234567890ABCDEF
        status: active
        subject_cn: EMPRESA EJEMPLO S.A.
        tenant_id: 660e8400-e29b-41d4-a716-446655440000
        updated_at: '2024-01-01T00:00:00Z'
        valid_from: '2024-01-01T00:00:00Z'
        valid_until: '2026-01-01T00:00:00Z'
    EstablishmentResponse:
      properties:
        id:
          type: string
          format: uuid
          title: Id
        tenant_id:
          type: string
          format: uuid
          title: Tenant Id
        issuer_id:
          type: string
          format: uuid
          title: Issuer Id
        code:
          type: string
          title: Code
        name:
          anyOf:
            - type: string
            - type: 'null'
          title: Name
        address:
          type: string
          title: Address
        is_active:
          type: boolean
          title: Is Active
        created_at:
          type: string
          format: date-time
          title: Created At
        updated_at:
          type: string
          format: date-time
          title: Updated At
      type: object
      required:
        - id
        - tenant_id
        - issuer_id
        - code
        - name
        - address
        - is_active
        - created_at
        - updated_at
      title: EstablishmentResponse
      description: Schema for Establishment response.
      example:
        address: Av. Principal 123, Quito, Ecuador
        code: '001'
        created_at: '2024-01-01T00:00:00Z'
        id: 770e8400-e29b-41d4-a716-446655440000
        is_active: true
        issuer_id: 550e8400-e29b-41d4-a716-446655440000
        name: Matriz
        tenant_id: 660e8400-e29b-41d4-a716-446655440000
        updated_at: '2024-01-01T00:00:00Z'
    EmissionPointResponse:
      properties:
        id:
          type: string
          format: uuid
          title: Id
        tenant_id:
          type: string
          format: uuid
          title: Tenant Id
        establishment_id:
          type: string
          format: uuid
          title: Establishment Id
        code:
          type: string
          title: Code
        is_active:
          type: boolean
          title: Is Active
        initial_sequential:
          type: integer
          title: Initial Sequential
        created_at:
          type: string
          format: date-time
          title: Created At
        updated_at:
          type: string
          format: date-time
          title: Updated At
      type: object
      required:
        - id
        - tenant_id
        - establishment_id
        - code
        - is_active
        - initial_sequential
        - created_at
        - updated_at
      title: EmissionPointResponse
      description: Schema for EmissionPoint response.
      example:
        code: '001'
        created_at: '2024-01-01T00:00:00Z'
        establishment_id: 770e8400-e29b-41d4-a716-446655440000
        id: 880e8400-e29b-41d4-a716-446655440000
        initial_sequential: 0
        is_active: true
        tenant_id: 660e8400-e29b-41d4-a716-446655440000
        updated_at: '2024-01-01T00:00:00Z'
    SRIEnvironment:
      type: string
      enum:
        - TEST
        - PRODUCTION
      title: SRIEnvironment
      description: SRI environment types.
    ReadinessFlags:
      properties:
        has_issuer:
          type: boolean
          title: Has Issuer
        has_certificate:
          type: boolean
          title: Has Certificate
        has_establishment:
          type: boolean
          title: Has Establishment
        has_emission_point:
          type: boolean
          title: Has Emission Point
        is_operational:
          type: boolean
          title: Is Operational
      type: object
      required:
        - has_issuer
        - has_certificate
        - has_establishment
        - has_emission_point
        - is_operational
      title: ReadinessFlags
      description: Boolean flags summarising operational readiness.
      example:
        has_certificate: true
        has_emission_point: true
        has_establishment: true
        has_issuer: true
        is_operational: true
    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
    CertificateStatus:
      type: string
      enum:
        - uploaded
        - active
        - expiring
        - expired
        - revoked
        - disabled
      title: CertificateStatus
      description: Status values for digital certificates.

````