ES | EN

Examples by country

➕ Create new documents

Postman collection

To help you with your integration, download our Postman Collection here: https://github.com/koyweforest/api-billing-postman

To help with testing, you can use the following information when issuing documents

account_id RUT legal_name activity postalcode
423 76399932-7

Invoice (Factura electrónica)

In order to create a new chilean invoice, you need to use the /documents endpoint with the proper parameters.

{
  "header": {
    "account_id": 423,
    "document_type_id": "2",
    "received_issued_flag": 1,
    "issue_date": "2025-01-07",
    "issuer_tax_id_code": "76399932-7",
    "issuer_tax_id_type": "CL-RUT",
    "issuer_legal_name": "<string>",
    "issuer_address": "<string>",
    "issuer_district": "<string>",
    "issuer_city": "<string>",
    "issuer_country_id": "253",
    "issuer_phone": "<string>",
    "issuer_activity": "<string>",
    "receiver_tax_id_code": "76399932-7",
    "receiver_tax_id_type": "CL-RUT",
    "receiver_legal_name": "ESCUELA KEMPER URGATE",
    "receiver_address": "<string>",
    "receiver_district": "<string>",
    "receiver_city": "<string>",
    "receiver_country_id": "253",
    "receiver_phone": "<string>",
    "receiver_activity": "<string>",
    "payment_conditions": "0",
    "currency_id": 39

  },
  "details": [
    {
      "quantity": 1,
      "sku": "aa111",
      "line_description": "Prueba Koywe",
      "unit_measure": "UN",
      "unit_price": 1500,
      "long_description": "Esta es una linea de prueba",
      "modifier_amount": -100,
      "total_taxes": 266,
      "modifier_percentage": 0,
      "total_amount_line": 1624,
      "taxes": [
        {
          "tax_type_id": "387",
          "tax_percentage": 19,
          "tax_amount": 266
        }
      ]
    }
  ],
  "totals": {
    "net_amount": 1400,
    "taxes_amount": 266,
    "total_amount": 1666
  }
}

Invoice with transfer copy (Factura electrónica con copia cedible)

To create a Chilean electronic invoice and receive the transfer copy (copia cedible) PDF in the response, use the /documents endpoint with options.pdf_transfer_copy: 1. The response will include in electronic_document the field document_transfer_copy_pdf (base64).

{
  "options": {
    "pdf_transfer_copy": 1
  },
  "header": {
    "account_id": 423,
    "document_type_id": "2",
    "received_issued_flag": 1,
    "issue_date": "2025-01-07",
    "issuer_tax_id_code": "76399932-7",
    "issuer_tax_id_type": "CL-RUT",
    "issuer_legal_name": "Laura",
    "issuer_address": "Gregorio",
    "issuer_district": "Centro",
    "issuer_city": "Santiadfo",
    "issuer_country_id": "253",
    "issuer_phone": "442020550",
    "issuer_activity": "Venta",
    "receiver_tax_id_code": "76399932-7",
    "receiver_tax_id_type": "CL-RUT",
    "receiver_legal_name": "ESCUELA KEMPER URGATE",
    "receiver_address": "Camacho",
    "receiver_district": "Superior",
    "receiver_city": "Iquique",
    "receiver_country_id": "253",
    "receiver_phone": "442020551",
    "receiver_activity": "Venta Mayor",
    "payment_conditions": "0",
    "currency_id": 39
  },
  "details": [
    {
      "quantity": 1,
      "sku": "aa111",
      "line_description": "Prueba Koywe",
      "unit_measure": "UN",
      "unit_price": 1500,
      "long_description": "Esta es una linea de prueba",
      "modifier_amount": -100,
      "total_taxes": 266,
      "modifier_percentage": 0,
      "total_amount_line": 1624,
      "taxes": [
        {
          "tax_type_id": "387",
          "tax_percentage": 19,
          "tax_amount": 266
        }
      ]
    }
  ],
  "totals": {
    "net_amount": 1400,
    "taxes_amount": 266,
    "total_amount": 1666
  }
}

Invoice with non-tax document reference (Factura electrónica con referencia a documento no tributario)

In order to create a new chilean invoice with reference, you need to use the /documents endpoint with the proper parameters.

{
  "header": {
    "account_id": 423,
    "document_type_id": "2",
    "received_issued_flag": 1,
    "issue_date": "2025-01-07",
    "issuer_tax_id_code": "76399932-7",
    "issuer_tax_id_type": "CL-RUT",
    "issuer_legal_name": "<string>",
    "issuer_address": "<string>",
    "issuer_district": "<string>",
    "issuer_city": "<string>",
    "issuer_country_id": "253",
    "issuer_phone": "<string>",
    "issuer_activity": "<string>",
    "receiver_tax_id_code": "76399932-7",
    "receiver_tax_id_type": "CL-RUT",
    "receiver_legal_name": "ESCUELA KEMPER URGATE",
    "receiver_address": "<string>",
    "receiver_district": "<string>",
    "receiver_city": "<string>",
    "receiver_country_id": "253",
    "receiver_phone": "<string>",
    "receiver_activity": "<string>",
    "payment_conditions": "0",
    "currency_id": 39

  },
  "details": [
    {
      "quantity": 1,
      "sku": "aa111",
      "line_description": "Prueba Koywe",
      "unit_measure": "UN",
      "unit_price": 1500,
      "long_description": "Esta es una linea de prueba",
      "modifier_amount": -100,
      "total_taxes": 266,
      "modifier_percentage": 0,
      "total_amount_line": 1624,
      "taxes": [
        {
          "tax_type_id": "387",
          "tax_percentage": 19,
          "tax_amount": 266
        }
      ]
    }
  ],
  "references": [
    {
        "reference_code": 5,
        "reference_type": 801,
        "reference_number": 22548,
        "description": "Orden de compra",
        "reference_date": "2025-01-05"
    }
  ],
  "totals": {
    "net_amount": 1400,
    "taxes_amount": 266,
    "total_amount": 1666
  }
}

Purchase invoice (Factura de compra electrónica)

In order to create a new chilean purchase invoice, you need to use the /documents endpoint with the proper parameters.

{
    "header": {
        "account_id": 423,
        "document_type_id": "31",
        "issue_date": "2025-01-07",
        "payment_conditions": "0",
        "currency_id": 39,
        "receiver_legal_name": "GOOGLE LLC",
        "receiver_tax_id_code": "59224080-7",
        "receiver_tax_id_type": "CL-RUT",
        "receiver_address": "1600 Amphitheatre Pkwy, Mountain View, CA, 94043-1351",
        "receiver_district": "Mountain View",
        "receiver_city": "California",
        "receiver_country_id": "253",
        "receiver_activity": "Servicios Digitales"
    },
    "details": [
        {
            "quantity": 1,
            "line_description": "servicio ads",
            "unit_price": 1500,
            "unit_measure": "UN",
            "modifier_amount": -100,
            "total_amount_line": 1666,
            "total_taxes": 266,
            "taxes": [
                {
                    "tax_type_id": 387,
                    "tax_percentage": 19,
                    "tax_amount": 266
                }
            ]
        }
    ],
    "totals": {
        "net_amount": 1400,
        "taxes_amount": 266,
        "total_amount": 1666
    }
}

Invoice VAT exempt (Factura electrónica exenta)

In order to create a new chilean VAT exempt invoice, you need to use the /documents endpoint with the proper parameters.

{
  "header": {
    "account_id": 141,
    "document_type_id": "32",

    "received_issued_flag": 1,
    "issue_date": "2025-01-07",
    "issuer_tax_id_code": "76399932-7",
    "issuer_tax_id_type": "CL-RUT",
    "issuer_legal_name": "<string>",
    "issuer_address": "<string>",
    "issuer_district": "<string>",
    "issuer_city": "<string>",
    "issuer_country_id": "253",
    "issuer_phone": "<string>",
    "issuer_activity": "<string>",
    "receiver_tax_id_code": "76399932-7",
    "receiver_tax_id_type": "CL-RUT",
    "receiver_legal_name": "ESCUELA KEMPER URGATE",
    "receiver_address": "<string>",
    "receiver_district": "<string>",
    "receiver_city": "<string>",
    "receiver_country_id": "253",
    "receiver_phone": "<string>",
    "receiver_activity": "<string>",
    "payment_conditions": "0",
    "currency_id": 39

  },
  "details": [
    {
      "quantity": 1,
      "sku": "aa111",
      "line_description": "Prueba Koywe",
      "unit_measure": "UN",
      "unit_price": 1500,
      "long_description": "Esta es una linea de prueba",
      "modifier_amount": -100,
      "total_taxes": 0,
      "modifier_percentage": 0,
      "total_amount_line": 1400
    }
  ],
  "totals": {
    "net_amount": 1400,
    "taxes_amount": 0,
    "total_amount": 1400
  }
}

Receipt (Boleta electrónica)

The receiver parameters are optional for electronic receipt. You can include them to create a nominative receipt or not include them to generate a regular (non-nominative) receipt.

{
  "header": {
    "account_id": 423,
    "document_type_id": "37",

    "received_issued_flag": 1,
    "issue_date": "2025-01-07",
    "issuer_tax_id_code": "76399932-7",
    "issuer_tax_id_type": "CL-RUT",
    "issuer_legal_name": "<string>",
    "issuer_address": "<string>",
    "issuer_district": "<string>",
    "issuer_city": "<string>",
    "issuer_country_id": "253",
    "issuer_phone": "<string>",
    "issuer_activity": "<string>",
    "receiver_tax_id_code": "76399932-7",
    "receiver_tax_id_type": "CL-RUT",
    "receiver_legal_name": "ESCUELA KEMPER URGATE",
    "receiver_address": "<string>",
    "receiver_district": "<string>",
    "receiver_city": "<string>",
    "receiver_country_id": "253",
    "receiver_phone": "<string>",
    "receiver_activity": "<string>",
    "payment_conditions": "0",
    "currency_id": 39

  },
  "details": [
    {
      "quantity": 1,
      "sku": "aa111",
      "line_description": "Prueba Koywe",
      "unit_measure": "UN",
      "unit_price": 1500,
      "long_description": "Esta es una linea de prueba",
      "modifier_amount": -100,
      "total_taxes": 266,
      "modifier_percentage": 0,
      "total_amount_line": 1666,
      "taxes": [
        {
          "tax_type_id": "387",
          "tax_percentage": 19,
          "tax_amount": 266
        }
      ]
    }
  ],
  "totals": {
    "net_amount": 1400,
    "taxes_amount": 266,
    "total_amount": 1666
  }
}

Receipt VAT exempt (Boleta electrónica exenta)

The receiver parameters are optional for VAT exempt electronic receipt. You can include them to create a nominative receipt or not include them to generate a regular (non-nominative) receipt.

{
  "header": {
    "account_id": 141,
    "document_type_id": "41",

    "received_issued_flag": 1,
    "issue_date": "2025-01-07",
    "issuer_tax_id_code": "76399932-7",
    "issuer_tax_id_type": "CL-RUT",
    "issuer_legal_name": "<string>",
    "issuer_address": "<string>",
    "issuer_district": "<string>",
    "issuer_city": "<string>",
    "issuer_country_id": "253",
    "issuer_phone": "<string>",
    "issuer_activity": "<string>",
    "receiver_tax_id_code": "76399932-7",
    "receiver_tax_id_type": "CL-RUT",
    "receiver_legal_name": "ESCUELA KEMPER URGATE",
    "receiver_address": "<string>",
    "receiver_district": "<string>",
    "receiver_city": "<string>",
    "receiver_country_id": "253",
    "receiver_phone": "<string>",
    "receiver_activity": "<string>",
    "payment_conditions": "0",
    "currency_id": 39

  },
  "details": [
    {
      "quantity": 1,
      "sku": "aa111",
      "line_description": "Prueba Koywe",
      "unit_measure": "UN",
      "unit_price": 1500,
      "long_description": "Esta es una linea de prueba",
      "modifier_amount": -100,
      "total_taxes": 0,
      "modifier_percentage": 0,
      "total_amount_line": 1400
    }
  ],
  "totals": {
    "net_amount": 1400,
    "taxes_amount": 0,
    "total_amount": 1400
  }
}

Credit note with reference to reference_number (Nota de crédito con referencia de reference_number)

The receiver parameters are mandatory for credit note. If you are cancelling an electronic receipt and you have no nominative information, you can use the generic tax id 66666666-6.

Use reference_number (document_number) to reference the document you are cancelling.

{
  "header": {
    "account_id": 423,
    "document_type_id": "16",
    "received_issued_flag": 1,
    "issue_date": "2025-01-07",
    "issuer_tax_id_code": "76399932-7",
    "issuer_tax_id_type": "CL-RUT",
    "issuer_legal_name": "<string>",
    "issuer_address": "<string>",
    "issuer_district": "<string>",
    "issuer_city": "<string>",
    "issuer_country_id": "253",
    "issuer_phone": "<string>",
    "issuer_activity": "<string>",
    "receiver_tax_id_code": "76399932-7",
    "receiver_tax_id_type": "CL-RUT",
    "receiver_legal_name": "ESCUELA KEMPER URGATE",
    "receiver_address": "<string>",
    "receiver_district": "<string>",
    "receiver_city": "<string>",
    "receiver_country_id": "253",
    "receiver_phone": "<string>",
    "receiver_activity": "<string>",
    "payment_conditions": "0",
    "currency_id": 39
  },
  "details": [
    {
      "quantity": 1,
      "sku": "aa111",
      "line_description": "Prueba ROW",
      "unit_measure": "UN",
      "unit_price": 1500,
      "long_description": "Esta es una linea de prueba",
      "modifier_amount": -100,
      "total_taxes": 266,
      "modifier_percentage": 0,
      "total_amount_line": 1624,
      "taxes": [
        {
          "tax_type_id": "387",
          "tax_percentage": 19,
          "tax_amount": 266
        }
      ]
    }
  ],
   "references": [
    {
        "document_type_id": 2,
        "reference_number": "1712",
        "reference_code": 1,
        "description": "Anulacion",
        "reference_date": "2025-01-07"
    }
  ],
  "totals": {
    "net_amount": 1400,
    "taxes_amount": 266,
    "total_amount": 1666
  }
}

Credit note with reference to reference_document_id (Nota de crédito con referencia de reference_document_id)

The receiver parameters are mandatory for credit note. If you are cancelling an electronic receipt and you have no nominative information, you can use the generic tax id 66666666-6.

Use reference_document_id (document_id) to reference the document you are cancelling.

{
  "header": {
    "account_id": 423,
    "document_type_id": "16",
    "received_issued_flag": 1,
    "issue_date": "2025-01-07",
    "issuer_tax_id_code": "76399932-7",
    "issuer_tax_id_type": "CL-RUT",
    "issuer_legal_name": "<string>",
    "issuer_address": "<string>",
    "issuer_district": "<string>",
    "issuer_city": "<string>",
    "issuer_country_id": "253",
    "issuer_phone": "<string>",
    "issuer_activity": "<string>",
    "receiver_tax_id_code": "76399932-7",
    "receiver_tax_id_type": "CL-RUT",
    "receiver_legal_name": "ESCUELA KEMPER URGATE",
    "receiver_address": "<string>",
    "receiver_district": "<string>",
    "receiver_city": "<string>",
    "receiver_country_id": "253",
    "receiver_phone": "<string>",
    "receiver_activity": "<string>",
    "payment_conditions": "0",
    "currency_id": 39
  },
  "details": [
    {
      "quantity": 1,
      "sku": "aa111",
      "line_description": "Prueba ROW",
      "unit_measure": "UN",
      "unit_price": 1500,
      "long_description": "Esta es una linea de prueba",
      "modifier_amount": -100,
      "total_taxes": 266,
      "modifier_percentage": 0,
      "total_amount_line": 1666,
      "taxes": [
        {
          "tax_type_id": "387",
          "tax_percentage": 19,
          "tax_amount": 266
        }
      ]
   "references": [
    {
        "document_type_id": 2,
        "reference_document_id": 1542,
        "reference_code": 1,
        "description": "Anulacion",
        "reference_date": "2025-01-07"
    }
  ],
  "totals": {
    "net_amount": 1400,
    "taxes_amount": 266,
    "total_amount": 1666
  }
}

Debit note with reference to reference_number (Nota de débito con referencia de reference_number)

The receiver parameters are mandatory for debit note. If you are cancelling an credit note and you have no nominative information, you can use the generic tax id 66666666-6.

Use reference_number (document_number) to reference the document you are cancelling.

{
  "header": {
    "account_id": 423,
    "document_type_id": "17",
    "received_issued_flag": 1,
    "issue_date": "2025-01-07",
    "issuer_tax_id_code": "76399932-7",
    "issuer_tax_id_type": "CL-RUT",
    "issuer_legal_name": "<string>",
    "issuer_address": "<string>",
    "issuer_district": "<string>",
    "issuer_city": "<string>",
    "issuer_country_id": "253",
    "issuer_phone": "<string>",
    "issuer_activity": "<string>",
    "receiver_tax_id_code": "76399932-7",
    "receiver_tax_id_type": "CL-RUT",
    "receiver_legal_name": "ESCUELA KEMPER URGATE",
    "receiver_address": "<string>",
    "receiver_district": "<string>",
    "receiver_city": "<string>",
    "receiver_country_id": "253",
    "receiver_phone": "<string>",
    "receiver_activity": "<string>",
    "payment_conditions": "0",
    "currency_id": 39
  },
  "details": [
    {
      "quantity": 1,
      "sku": "aa111",
      "line_description": "Prueba ROW",
      "unit_measure": "UN",
      "unit_price": 1500,
      "long_description": "Esta es una linea de prueba",
      "modifier_amount": -100,
      "total_taxes": 266,
      "modifier_percentage": 0,
      "total_amount_line": 1666,
      "taxes": [
        {
          "tax_type_id": "387",
          "tax_percentage": 19,
          "tax_amount": 266
        }
      ]
    }
  ],
   "references": [
    {
        "document_type_id": 16,
        "reference_number": "1815",
        "reference_code": 1,
        "description": "Anulacion",
        "reference_date": "2025-01-07"
    }
  ],
  "totals": {
    "net_amount": 1400,
    "taxes_amount": 266,
    "total_amount": 1666
  }
}

Debit note with reference to reference_document_id (Nota de débito con referencia de reference_document_id)

The receiver parameters are mandatory for debit note. If you are cancelling an credit note and you have no nominative information, you can use the generic tax id 66666666-6.

Use reference_document_id (document_id) to reference the document you are cancelling.

{
  "header": {
    "account_id": 423,
    "document_type_id": "17",
    "received_issued_flag": 1,
    "issue_date": "2025-01-07",
    "issuer_tax_id_code": "76399932-7",
    "issuer_tax_id_type": "CL-RUT",
    "issuer_legal_name": "<string>",
    "issuer_address": "<string>",
    "issuer_district": "<string>",
    "issuer_city": "<string>",
    "issuer_country_id": "253",
    "issuer_phone": "<string>",
    "issuer_activity": "<string>",
    "receiver_tax_id_code": "76399932-7",
    "receiver_tax_id_type": "CL-RUT",
    "receiver_legal_name": "ESCUELA KEMPER URGATE",
    "receiver_address": "<string>",
    "receiver_district": "<string>",
    "receiver_city": "<string>",
    "receiver_country_id": "253",
    "receiver_phone": "<string>",
    "receiver_activity": "<string>",
    "payment_conditions": "0",
    "currency_id": 39
  },
  "details": [
    {
      "quantity": 1,
      "sku": "aa111",
      "line_description": "Prueba ROW",
      "unit_measure": "UN",
      "unit_price": 1500,
      "long_description": "Esta es una linea de prueba",
      "modifier_amount": -100,
      "total_taxes": 266,
      "modifier_percentage": 0,
     "total_amount_line": 1666,
      "taxes": [
        {
          "tax_type_id": "387",
          "tax_percentage": 19,
          "tax_amount": 266
        }
      ]
    }
  ],
   "references": [
    {
        "document_type_id": 16,
        "reference_document_id": 1542,
        "reference_code": 1,
        "description": "Anulacion",
        "reference_date": "2025-01-07"
    }
  ],
  "totals": {
    "net_amount": 1400,
    "taxes_amount": 266,
    "total_amount": 1666
  }
}

Bill of Lading (Guía de despacho)

Bills of lading are used in addition to invoices when moving inventory within the same company warehouses, or to/from a customer address.

{
  "header": {
    "account_id": 423,
    "document_type_id": "54",
    "received_issued_flag": 1,
    "issue_date": "2025-03-04",
    "receiver_tax_id_code": "76399932-7",
    "receiver_tax_id_type": "CL-RUT",
    "receiver_legal_name": "ESCUELA KEMPER URGATE",
    "receiver_address": "Av providencia 1456",
    "receiver_district": "Providencia",
    "receiver_city": "Santiago",
    "receiver_country_id": "253",
    "receiver_phone": "<string>",
    "receiver_activity": "Venta insumos",
    "payment_conditions": "0",
    "currency_id": 39,
    "guide_type": 1,
    "transfer_type": 1

  },
  "details": [
    {
      "quantity": 1,
      "sku": "aa111",
      "line_description": "Prueba Koywe",
      "unit_measure": "UN",
      "unit_price": 1500,
      "long_description": "Esta es una linea de prueba",
      "modifier_amount": -100,
      "total_taxes": 266,
      "modifier_percentage": 0,
      "total_amount_line": 1624,
      "taxes": [
        {
          "tax_type_id": "387",
          "tax_percentage": 19,
          "tax_amount": 266
        }
      ]
    }
  ],
  "totals": {
    "net_amount": 1400,
    "taxes_amount": 266,
    "total_amount": 1666
  }
}

Exports Invoice (Factura de exportación)

When you sell to other countries, you are required in Chile to issue a export invoice. The format is similar but it also allows

{
  "header": {
    "account_id": 423,
    "document_type_id": "46",
    "received_issued_flag": 1,
    "issue_date": "2025-03-04",
    "receiver_tax_id_code": "222333444",
    "receiver_tax_id_type": "MX-RFC",
    "receiver_legal_name": "ESCUELA KEMPER URGATE",
    "receiver_address": "Av providencia 1456",
    "receiver_district": "Providencia",
    "receiver_city": "Santiago",
    "receiver_country_id": "80",
    "receiver_phone": "<string>",
    "receiver_activity": "Venta insumos",
    "payment_conditions": "0",
    "exchange_rate_value": 934.58,
    "currency_id": 5,
    "sale_modality": 1,
    "sale_clause": 1
  },
  "details": [
    {
      "quantity": 1,
      "sku": "aa111",
      "line_description": "Prueba Koywe",
      "unit_measure": "UN",
      "unit_price": 1500,
      "long_description": "Esta es una linea de prueba",
      "modifier_amount": -100,
      "total_taxes": 0,
      "modifier_percentage": 0,
      "total_amount_line": 1400,
      "taxes": [
      ]
    }
  ],
  "totals": {
    "net_amount": 1400,
    "taxes_amount": 0,
    "total_amount": 1400
  }
}

Exports Credit note (Nota de crédito de exportación)

If you want to cancel an export invoice, you need to use this special kind of document.

{
  "header": {
    "account_id": 423,
    "document_type_id": "48",
    "received_issued_flag": 1,
    "issue_date": "2025-03-04",
    "receiver_tax_id_code": "222333444",
    "receiver_tax_id_type": "MX-RFC",
    "receiver_legal_name": "ESCUELA KEMPER URGATE",
    "receiver_address": "Av providencia 1456",
    "receiver_district": "Providencia",
    "receiver_city": "Santiago",
    "receiver_country_id": "80",
    "receiver_phone": "<string>",
    "receiver_activity": "Venta insumos",
    "payment_conditions": "0",
    "exchange_rate_value": 934.58,
    "currency_id": 5,
    "sale_modality": 1,
    "sale_clause": 1
  },
  "details": [
    {
      "quantity": 1,
      "sku": "aa111",
      "line_description": "Prueba Koywe",
      "unit_measure": "UN",
      "unit_price": 1500,
      "long_description": "Esta es una linea de prueba",
      "modifier_amount": -100,
      "total_taxes": 0,
      "modifier_percentage": 0,
      "total_amount_line": 1400,
      "taxes": [
      ]
    }
  ],
  "references": [
    {
        "document_type_id": 46,
        "reference_number": "139",
        "reference_code": 1,
        "description": "Anulacion",
        "reference_date": "2025-03-04"
    }
  ],
  "totals": {
    "net_amount": 1400,
    "taxes_amount": 0,
    "total_amount": 1400
  }
}

Exports Debit note (Nota de débito de exportación)

If you want to cancel an export invoice, you need to use this special kind of document.

{
  "header": {
    "account_id": 423,
    "document_type_id": "47",
    "received_issued_flag": 1,
    "issue_date": "2025-03-04",
    "receiver_tax_id_code": "222333444",
    "receiver_tax_id_type": "MX-RFC",
    "receiver_legal_name": "ESCUELA KEMPER URGATE",
    "receiver_address": "Av providencia 1456",
    "receiver_district": "Providencia",
    "receiver_city": "Santiago",
    "receiver_country_id": "80",
    "receiver_phone": "<string>",
    "receiver_activity": "Venta insumos",
    "payment_conditions": "0",
    "exchange_rate_value": 934.58,
    "currency_id": 5,
    "sale_modality": 1,
    "sale_clause": 1
  },
  "details": [
    {
      "quantity": 1,
      "sku": "aa111",
      "line_description": "Prueba Koywe",
      "unit_measure": "UN",
      "unit_price": 1500,
      "long_description": "Esta es una linea de prueba",
      "modifier_amount": -100,
      "total_taxes": 0,
      "modifier_percentage": 0,
      "total_amount_line": 1400,
      "taxes": [
      ]
    }
  ],
  "references": [
    {
        "document_type_id": 46,
        "reference_number": "139",
        "reference_code": 1,
        "description": "csmbio vslor",
        "reference_date": "2025-03-04"
    }
  ],
  "totals": {
    "net_amount": 1400,
    "taxes_amount": 0,
    "total_amount": 1400
  }
}

Invoice with Draft and Preview mode (Factura electrónica con modo Borrador y Vista previa)

In order to create a new chilean invoice with Draft and Preview mode, you need to use the /documents endpoint with the proper parameters and you mode draft_only/draft_preview.

{
  "options": {
    "draft_only":1,
    "draft_preview": 1
    },
  "header": {
    "account_id": 423,
    "document_type_id": "2",
    "received_issued_flag": 1,
    "issue_date": "2025-01-07",
    "issuer_tax_id_code": "76399932-7",
    "issuer_tax_id_type": "CL-RUT",
    "issuer_legal_name": "<string>",
    "issuer_address": "<string>",
    "issuer_district": "<string>",
    "issuer_city": "<string>",
    "issuer_country_id": "253",
    "issuer_phone": "<string>",
    "issuer_activity": "<string>",
    "receiver_tax_id_code": "76399932-7",
    "receiver_tax_id_type": "CL-RUT",
    "receiver_legal_name": "ESCUELA KEMPER URGATE",
    "receiver_address": "<string>",
    "receiver_district": "<string>",
    "receiver_city": "<string>",
    "receiver_country_id": "253",
    "receiver_phone": "<string>",
    "receiver_activity": "<string>",
    "payment_conditions": "0",
    "currency_id": 39

  },
  "details": [
    {
      "quantity": 1,
      "sku": "aa111",
      "line_description": "Prueba Koywe",
      "unit_measure": "UN",
      "unit_price": 1500,
      "long_description": "Esta es una linea de prueba",
      "modifier_amount": -100,
      "total_taxes": 266,
      "modifier_percentage": 0,
      "total_amount_line": 1624,
      "taxes": [
        {
          "tax_type_id": "387",
          "tax_percentage": 19,
          "tax_amount": 266
        }
      ]
    }
  ],
  "totals": {
    "net_amount": 1400,
    "taxes_amount": 266,
    "total_amount": 1666
  }
}

Response status in result the API Rest

status description
0 The draft was created successfully, signed, and sent to the SII successfully.
1 There are errors in the input, so the draft was not generated nor sent to the SII. The error details will be in error_message.
2 The draft was created successfully; however, there are other issues (e.g., lack of folios) that prevented it from being sent to the SII. The error details will be in error_message.
{
   "document_id": 377,
   "header":    {
      "account_id": 14540,
      "document_type_id": 82,
      "document_type_taxbureau": "01",
      "document_number": 1040447,
      "received_issued_flag": 1,
      "taxbureau_validation_status": null,
      "issue_date": "2025-04-15",
      "issuer_tax_id_code": "860517022-2",
      "issuer_tax_id_type": "CO-NIT",
      "issuer_legal_name": "Demo Colombia",
      "issuer_address": "",
      "issuer_district": "",
      "issuer_city": "",
      "issuer_country_id": 253,
      "issuer_phone": "442020550",
      "issuer_activity": "",
      "receiver_tax_id_code": "1097491385-1",
      "receiver_tax_id_type": "CO-NIT",
      "receiver_legal_name": "ESCUELAa KEMPER URGATE",
      "receiver_address": "",
      "receiver_district": "",
      "receiver_city": "",
      "receiver_country_id": 66,
      "receiver_phone": "<string>",
      "receiver_activity": "<string>",
      "document_status": 1,
      "payment_conditions": "0",
      "currency_id": 28
   },
   "details": [   {
      "quantity": "1.000000",
      "line_description": "Prueba Koywe",
      "long_description": "Esta es una linea de prueba",
      "unit_measure": "70",
      "unit_price": "3660.000000",
      "vat_status": "0"
   }],
   "references": null,
   "global_modifiers": null,
   "totals":    {
      "net_amount": 3660,
      "taxes_amount": 695.4,
      "total_amount": "4355.40"
   },
   "electronic_document":    {
      "document_xml": "PD94bWwgdmVyc2lvbj0iMS4wIiB...",
      "document_pdf": "JVBERi0xLjMKMyAwIG9iago8PC9..."
   },
   "payment_link": null,
   "result":    {
      "status": 0,
      "error_message": ""
   },
   "_links": {"self": {"href": "https://api-billing.koywe.com/V1/documents"}}
}

API Reference POST /documents

Detailed endpoint documentation: /english/billing/api-reference/billing-api/documents/create-a-new-document