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

# Emitir DTE (PUBLISHED → DTE_SENT) (deprecada)

> Deprecada: usar POST /v1/billing/invoices/:id/publish, el orquestador canónico de emisión. Esta ruta delega en el mismo camino (PublishInvoiceUseCase.publishAndEmit) y solo expone el paso de emisión que publish ya ejecuta internamente. Se conserva como reintento cuando el auto-emit de publish falló y la factura quedó en PUBLISHED: a diferencia de publish, propaga el error de emisión.



## OpenAPI

````yaml /generated/specs/finance.json post /api/v1/billing/invoices/{id}/emit-dte
openapi: 3.0.0
info:
  title: Raul API - Finanzas
  description: >-
    Facturas, boletas, ejecuciones de billing, cuentas por pagar y medios de
    pago.
  version: 2.0.0
  contact: {}
servers:
  - url: https://api.raul.ugps.io
    description: Production
security: []
tags: []
paths:
  /api/v1/billing/invoices/{id}/emit-dte:
    post:
      tags:
        - Invoices
      summary: Emitir DTE (PUBLISHED → DTE_SENT) (deprecada)
      description: >-
        Deprecada: usar POST /v1/billing/invoices/:id/publish, el orquestador
        canónico de emisión. Esta ruta delega en el mismo camino
        (PublishInvoiceUseCase.publishAndEmit) y solo expone el paso de emisión
        que publish ya ejecuta internamente. Se conserva como reintento cuando
        el auto-emit de publish falló y la factura quedó en PUBLISHED: a
        diferencia de publish, propaga el error de emisión.
      operationId: InvoiceDteController_emitDteEndpoint
      parameters:
        - name: id
          required: true
          in: path
          description: UUID de la factura
          schema:
            type: string
        - name: Idempotency-Key
          in: header
          description: UUID v4 de intención; requerido para publicar o emitir DTE.
          required: true
          schema:
            type: string
      responses:
        '201':
          description: DTE emitido
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/InvoiceResponseDto'
        '400':
          description: Clave idempotente inválida
        '404':
          description: Factura no encontrada
        '409':
          description: Conflicto de intención idempotente
        '503':
          description: Resultado incierto; consultar DTE antes de continuar
      deprecated: true
      security:
        - bearerAuth: []
components:
  schemas:
    InvoiceResponseDto:
      type: object
      properties:
        id:
          type: string
        type:
          type: string
        status:
          type: string
        client_id:
          type: object
        receiver_rut:
          type: object
        receiver_name:
          type: string
        receiver_email:
          type: object
        receiver_address:
          type: object
        receiver_ciudad:
          type: object
        receiver_comuna:
          type: object
        receiver_giro:
          type: object
        issue_date:
          type: string
          format: date-time
        due_date:
          type: string
          format: date-time
        subtotal:
          type: number
        discount_total:
          type: number
        net_amount:
          type: number
        tax_rate:
          type: number
        tax_amount:
          type: number
        total_amount:
          type: number
        tax_amount_override:
          type: object
        total_amount_override:
          type: object
        amount_paid:
          type: number
        client_credit_balance:
          type: number
          description: >-
            Saldo a favor disponible del cliente desde sobrepagos de otras
            facturas
        uf_value_at_creation:
          type: object
        folio_prefix:
          type: object
        folio_number:
          type: object
        internal_notes:
          type: object
        public_notes:
          type: object
        concept:
          type: object
        periodo:
          type: object
        payment_terms_days:
          type: number
        credit_note_for_id:
          type: object
        credit_note_reason:
          type: object
        factura_id:
          type: object
        invoice_type:
          type: string
        parent_client_id:
          type: object
        billing_client_id:
          type: object
        oc_number:
          type: object
        hes_number:
          type: object
        requires_oc:
          type: boolean
        requires_hes:
          type: boolean
        detail_xlsx_url:
          type: object
        last_dte_error:
          type: object
        dte_retry_count:
          type: number
        dte_local_status:
          type: object
          description: local_status del DTE más reciente (estado del XML ante el SII)
        sii_status_detail:
          type: object
          description: Detalle libre devuelto por el SII para el DTE más reciente
        created_by:
          type: object
        created_at:
          type: string
          format: date-time
        updated_at:
          type: string
          format: date-time
        deleted_at:
          type: object
      required:
        - id
        - type
        - status
        - receiver_name
        - issue_date
        - due_date
        - subtotal
        - discount_total
        - net_amount
        - tax_rate
        - tax_amount
        - total_amount
        - amount_paid
        - client_credit_balance
        - payment_terms_days
        - invoice_type
        - created_at
        - updated_at
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: >-
        Token de sesión Better Auth para rutas de backoffice; las rutas de
        portal usan su token propio.

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.