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

# Ceder una factura a factoring

> Crear factoring/AEC para una factura elegible. Los DTEs con odoo_move_id positivo no admiten nuevas cesiones; cero o ausencia de ID siguen el flujo SII. DTEs SII-directos generan el AEC nativo y lo envían al RTC del SII (requiere `cesionario` y `email_cedente`).



## OpenAPI

````yaml /generated/specs/finance.json post /api/v1/billing/invoices/{id}/factoring
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}/factoring:
    post:
      tags:
        - Invoices
      summary: Ceder una factura a factoring
      description: >-
        Crear factoring/AEC para una factura elegible. Los DTEs con odoo_move_id
        positivo no admiten nuevas cesiones; cero o ausencia de ID siguen el
        flujo SII. DTEs SII-directos generan el AEC nativo y lo envían al RTC
        del SII (requiere `cesionario` y `email_cedente`).
      operationId: InvoiceFactoringController_createFactoring
      parameters:
        - name: id
          required: true
          in: path
          description: UUID de la factura
          schema:
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateInvoiceFactoringDto'
      responses:
        '201':
          description: Resultado de la cesión a factoring
          content:
            application/json:
              schema:
                type: object
                properties:
                  outcome:
                    type: string
                    enum:
                      - created
                      - already_factored
                      - reconciliation_required
                  factoring:
                    $ref: '#/components/schemas/InvoiceFactoringSummaryDto'
      security:
        - bearerAuth: []
components:
  schemas:
    CreateInvoiceFactoringDto:
      type: object
      properties:
        partner_id:
          type: number
          description: >-
            Campo histórico opcional; se acepta por compatibilidad y se ignora
            al crear la cesión.
        partner_name:
          type: string
          description: >-
            Nombre histórico opcional; se acepta por compatibilidad y se ignora
            al crear la cesión.
        cesionario:
          description: >-
            Datos del cesionario para cesión SII-directa (DTEs emitidos sin
            Odoo)
          allOf:
            - $ref: '#/components/schemas/FactoringCesionarioDto'
        monto_cesion:
          type: number
          description: Monto cedido en CLP; default = total del DTE
        ultimo_vencimiento:
          type: string
          description: >-
            Fecha de pago acordada (UltimoVencimiento), YYYY-MM-DD; default =
            due_date de la factura
        email_cedente:
          type: string
          description: >-
            Email del cedente para la carátula y notificación del RTC
            (emailNotif)
        email_deudor:
          type: string
          description: Email del deudor (eMailDeudor)
    InvoiceFactoringSummaryDto:
      type: object
      properties:
        status:
          type: string
          enum:
            - processing
            - yielded
            - reconciliation_required
        partner_id:
          type: object
        partner_name:
          type: object
        yielded_at:
          type: object
        aec_attachment_id:
          type: object
        aec_attachment_name:
          type: object
        aec_entry_id:
          type: object
        aec_entry_name:
          type: object
        synced_at:
          type: string
        provider:
          type: string
          enum:
            - sii_direct
            - odoo
        aec_track_id:
          type: object
        rtc_estado:
          type: object
        rtc_glosa:
          type: object
        has_aec_xml:
          type: boolean
      required:
        - status
        - synced_at
    FactoringCesionarioDto:
      type: object
      properties:
        rut:
          type: string
          description: RUT del cesionario, ej 77078244-9
        razon_social:
          type: string
          description: Razón social del cesionario
        direccion:
          type: string
          description: Dirección (min 5, max 60 según Cesion_v10.xsd)
        email:
          type: string
          description: Email del cesionario (min 6, max 40)
      required:
        - rut
        - razon_social
        - direccion
        - email
  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.