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

# Corregir un borrador

> Cambia los datos, el CUIT o el punto de venta de un borrador que espera revisión. Con una API key, environment solo se acepta si coincide con el de la key.



## OpenAPI

````yaml /openapi.json patch /documents/drafts/{draftId}
openapi: 3.1.0
info:
  title: Facturear API
  description: >-
    API para emitir facturas electrónicas de ARCA (Argentina) desde tu sistema:
    facturas, notas de crédito y débito, lotes, PDF y XML, envío por email,
    borradores desde documentos, webhooks y reportes. Autenticación con API Key
    en el header x-api-key: la key de testing opera en homologación y la de
    producción emite comprobantes reales.
  version: 1.0.0
  contact:
    name: Facturear Support
    email: support@facture.ar
    url: https://facture.ar
  license:
    name: MIT
    url: https://opensource.org/licenses/MIT
servers:
  - url: https://www.facture.ar/api
    description: Servidor de producción
security:
  - apiKey: []
tags:
  - name: CUITs
    description: CUITs emisores, sus defaults, puntos de venta y diseño
  - name: Facturas
    description: Emitir, listar y consultar facturas, su PDF y XML, y enviarlas por email
  - name: Lotes
    description: 'El resultado de cada emisión: toda factura se procesa en un lote'
  - name: Borradores
    description: >-
      Facturas propuestas desde documentos, planillas o datos, para revisar y
      emitir
  - name: Plantillas
    description: Cómo se lee y se factura cada tipo de documento, y facturas recurrentes
  - name: Importar desde ARCA
    description: Traer a Facturear los comprobantes que ARCA ya autorizó
  - name: Webhooks
    description: Notificaciones a tu sistema cuando pasa algo con tus facturas
  - name: Reportes
    description: Libro IVA Ventas
  - name: Utilidades
    description: Parámetros de ARCA
paths:
  /documents/drafts/{draftId}:
    patch:
      tags:
        - Borradores
      summary: Corregir un borrador
      description: >-
        Cambia los datos, el CUIT o el punto de venta de un borrador que espera
        revisión. Con una API key, environment solo se acepta si coincide con el
        de la key.
      parameters:
        - name: draftId
          in: path
          description: ID del borrador
          required: true
          schema:
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                data:
                  $ref: '#/components/schemas/DraftData'
                cuitId:
                  type:
                    - string
                    - 'null'
                ptoVta:
                  type:
                    - integer
                    - 'null'
                  minimum: 1
                environment:
                  type: string
                  enum:
                    - production
                    - homologation
      responses:
        '200':
          description: Borrador actualizado
          content:
            application/json:
              schema:
                type: object
                properties:
                  draft:
                    $ref: '#/components/schemas/Draft'
        '400':
          description: Datos inválidos o el borrador ya no se puede editar
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
components:
  schemas:
    DraftData:
      type: object
      description: Los datos de la factura propuesta
      required:
        - lines
      properties:
        receiver:
          type: object
          properties:
            name:
              type:
                - string
                - 'null'
              maxLength: 200
            docType:
              type:
                - string
                - 'null'
              description: CUIT, CUIL o DNI; null = consumidor final sin identificar
            docNumber:
              type:
                - string
                - 'null'
              description: CUIT, CUIL o DNI, con o sin guiones
            condicionIva:
              type:
                - integer
                - 'null'
              description: >-
                Condición frente al IVA del receptor (código de ARCA). Si falta,
                se busca en el padrón
            email:
              type:
                - string
                - 'null'
              format: email
              description: Si está, se le manda la factura
            address:
              type:
                - string
                - 'null'
              maxLength: 300
        concepto:
          type: integer
          enum:
            - 1
            - 2
            - 3
          default: 1
          description: 1 productos, 2 servicios, 3 productos y servicios
        serviceFrom:
          type:
            - string
            - 'null'
          format: date
          description: AAAA-MM-DD, servicios
        serviceTo:
          type:
            - string
            - 'null'
          format: date
          description: AAAA-MM-DD, servicios
        paymentDue:
          type:
            - string
            - 'null'
          format: date
          description: Vencimiento del pago, AAAA-MM-DD
        pricesIncludeIva:
          type: boolean
          default: true
          description: Los precios de las líneas incluyen IVA
        lines:
          type: array
          maxItems: 200
          items:
            type: object
            required:
              - description
              - unitPrice
            properties:
              description:
                type: string
                maxLength: 200
              quantity:
                type: number
                exclusiveMinimum: 0
                default: 1
              unitPrice:
                type:
                  - number
                  - 'null'
                minimum: 0
                description: null si el documento no trae precio
              ivaRate:
                type: number
                enum:
                  - 0
                  - 2.5
                  - 5
                  - 10.5
                  - 21
                  - 27
                default: 21
                description: Alícuota de IVA en porcentaje
        documentTotal:
          type:
            - number
            - 'null'
          description: Total impreso en el documento, para controlar las líneas
        currency:
          type: string
          minLength: 3
          maxLength: 3
          default: ARS
          description: Moneda ISO 4217
        documentDate:
          type:
            - string
            - 'null'
          format: date
          description: >-
            Fecha del documento, AAAA-MM-DD. La factura se emite con la fecha
            del día
        reference:
          type:
            - string
            - 'null'
          maxLength: 100
          description: Número de remito, pedido o referencia
        description:
          type:
            - string
            - 'null'
          maxLength: 500
          description: Texto libre que va en la factura
    Draft:
      type: object
      description: >-
        Un borrador de factura armado desde un documento, una planilla, datos
        enviados por API o una plantilla recurrente
      properties:
        id:
          type: string
        status:
          type: string
          enum:
            - extracting
            - review
            - queued
            - invoiced
            - error
            - discarded
          description: >-
            extracting: leyéndose; review: espera revisión; queued: enviado a
            ARCA; invoiced: facturado; error: no se pudo leer o emitir;
            discarded: descartado
        mode:
          type: string
          enum:
            - manual
            - automatic
          description: 'automatic: se emite solo si no hay observaciones'
        source:
          type: string
          enum:
            - upload
            - google_drive
            - zapier
            - api
            - recurring
            - mcp
            - whatsapp
        sourceRef:
          type:
            - string
            - 'null'
        fileName:
          type:
            - string
            - 'null'
        mimeType:
          type:
            - string
            - 'null'
        hasFile:
          type: boolean
        templateId:
          type:
            - string
            - 'null'
        templateName:
          type:
            - string
            - 'null'
        cuitId:
          type:
            - string
            - 'null'
        ptoVta:
          type:
            - integer
            - 'null'
        environment:
          type: string
          enum:
            - production
            - homologation
        data:
          oneOf:
            - $ref: '#/components/schemas/DraftData'
            - type: 'null'
        total:
          type:
            - number
            - 'null'
          description: Total calculado con las líneas; null si falta algún precio
        voucherLetter:
          type:
            - string
            - 'null'
          enum:
            - A
            - B
            - C
            - null
        confidence:
          type:
            - number
            - 'null'
          description: Confianza de la lectura con IA, de 0 a 1
        issues:
          type: array
          description: Observaciones que hay que revisar
          items:
            type: object
            properties:
              code:
                type: string
                enum:
                  - no_cuit
                  - no_lines
                  - missing_price
                  - invalid_amount
                  - total_mismatch
                  - invalid_document
                  - unidentified_receiver
                  - foreign_currency
                  - low_confidence
                  - possible_duplicate
                  - ai_note
                  - ai_info
              message:
                type: string
        errorMessage:
          type:
            - string
            - 'null'
        invoice:
          type:
            - object
            - 'null'
          description: La factura emitida desde el borrador
          properties:
            id:
              type: string
            voucherNumber:
              type: integer
            ptoVta:
              type:
                - integer
                - 'null'
            invoiceType:
              type:
                - integer
                - 'null'
            status:
              type: string
            amount:
              type: number
        emailStatus:
          type:
            - string
            - 'null'
          description: Estado del envío de la factura por email
        url:
          type: string
          description: Link al borrador en el dashboard
        createdAt:
          type: string
          format: date-time
        updatedAt:
          type: string
          format: date-time
    Error:
      type: object
      description: >-
        Error de la API. Los errores de autenticación (401), validación (400),
        CUIT inexistente (404), conflicto (409) e internos (500) vienen como
        application/problem+json (RFC 9457) con code, message y resolution.
        Otros errores vienen como JSON con error y, a veces, details y code. En
        los dos casos está el campo error.
      required:
        - error
      properties:
        error:
          type: string
          description: Mensaje de error
        code:
          type: string
          description: >-
            Código estable: unauthorized, invalid_request, cuit_not_found,
            conflict, internal_error, o códigos propios como
            SUBSCRIPTION_LIMIT_EXCEEDED
        message:
          type: string
          description: Qué pasó (problem+json)
        resolution:
          type: string
          description: Qué hacer para resolverlo (problem+json)
        type:
          type: string
          format: uri
          description: URI del tipo de problema (problem+json)
        title:
          type: string
          description: Título corto del problema (problem+json)
        status:
          type: integer
          description: Código HTTP (problem+json)
        detail:
          type: string
          description: Igual que message (problem+json)
        details:
          description: 'Detalle del error: un texto, o la lista de errores de validación'
  securitySchemes:
    apiKey:
      type: apiKey
      in: header
      name: x-api-key
      description: >-
        API Key para autenticación. Formato: test_sk_xxx para testing,
        prod_sk_xxx para producción.

````

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