create_invoice
Issue a Chile electronic tax document (DTE): a boleta electrónica (consumer receipt, TipoDTE 39, default) or a factura electrónica (B2B invoice, TipoDTE 33), stamped against SII with the merchant's own CAF. Two backends (auto-selected from your credential header, or force with the "provider" field): OpenFactura/Haulmer (header x-openfactura-key; Emisor auto-derived from your account; DEV sandbox by default, x-openfactura-mode: production to go live) or LibreDTE cloud (header x-libredte-hash + x-libredte-emisor for your RUT; the certification-vs-production environment is whatever your emisor is registered as in LibreDTE — there is no server-side sandbox toggle). Both keep your SII certificate and CAF in your own provider account; this server only forwards a token and stores nothing. Amounts are in CLP (Chilean pesos: whole integers, no decimals). IMPORTANT price convention: for a boleta (39) each price is GROSS (IVA 19% already included, as shown to consumers); for a factura (33) each price is NET (IVA 19% is added on top).
Parameters8
| provider | string | optional | Optional. Which backend to issue through. Omit to auto-detect from your credential header (x-openfactura-key -> openfactura, x-libredte-hash -> libredte; default openfactura). |
| document_type | string | optional | DTE type: 39 = boleta electrónica (consumer, prices GROSS/IVA-included) — default; 33 = factura electrónica (B2B, prices NET/IVA-added). Cannot issue 61 here — use cancel_invoice to void via a credit note. |
| customer_rut | string | optional | Buyer RUT, format 12345678-9 (check digit 0-9 or K). REQUIRED for a factura (33). For a boleta (39) it is optional and defaults to the generic consumer 66666666-6. |
| customer_name | string | optional | Buyer razón social / name. Required for a factura (33); defaults to "Consumidor Final" for a boleta. |
| customer_giro | string | optional | Buyer giro (business activity). Factura (33) only; SII expects it for B2B. Default "Particular". |
| customer_address | string | optional | Buyer street address (DirRecep). Factura (33) only. Default "Sin direccion". |
| customer_comuna | string | optional | Buyer comuna (CmnaRecep). Factura (33) only. Default "Santiago". |
| items | array | required | Line items. Each: description, price (CLP integer — GROSS for boleta, NET for factura), optional quantity (default 1). |
Raw schema
{
"type": "object",
"properties": {
"provider": {
"type": "string",
"enum": [
"openfactura",
"libredte"
],
"description": "Optional. Which backend to issue through. Omit to auto-detect from your credential header (x-openfactura-key -> openfactura, x-libredte-hash -> libredte; default openfactura)."
},
"document_type": {
"type": "string",
"enum": [
"33",
"39"
],
"description": "DTE type: 39 = boleta electrónica (consumer, prices GROSS/IVA-included) — default; 33 = factura electrónica (B2B, prices NET/IVA-added). Cannot issue 61 here — use cancel_invoice to void via a credit note."
},
"customer_rut": {
"type": "string",
"description": "Buyer RUT, format 12345678-9 (check digit 0-9 or K). REQUIRED for a factura (33). For a boleta (39) it is optional and defaults to the generic consumer 66666666-6."
},
"customer_name": {
"type": "string",
"description": "Buyer razón social / name. Required for a factura (33); defaults to \"Consumidor Final\" for a boleta."
},
"customer_giro": {
"type": "string",
"description": "Buyer giro (business activity). Factura (33) only; SII expects it for B2B. Default \"Particular\"."
},
"customer_address": {
"type": "string",
"description": "Buyer street address (DirRecep). Factura (33) only. Default \"Sin direccion\"."
},
"customer_comuna": {
"type": "string",
"description": "Buyer comuna (CmnaRecep). Factura (33) only. Default \"Santiago\"."
},
"items": {
"type": "array",
"minItems": 1,
"description": "Line items. Each: description, price (CLP integer — GROSS for boleta, NET for factura), optional quantity (default 1).",
"items": {
"type": "object",
"properties": {
"description": {
"type": "string",
"description": "Item name (NmbItem), max 80 chars."
},
"price": {
"type": "number",
"description": "Unit price in CLP (whole pesos, no decimals)."
},
"quantity": {
"type": "number",
"description": "Default 1."
}
},
"required": [
"description",
"price"
]
}
}
},
"required": [
"items"
]
}