Try the sandbox

How to issue a Chilean electronic invoice (DTE 33) with an API

Short answer: you POST to /api/v1/dte/factura/emit/ with the recipient's complete data (RUT, legal name, giro, address and comuna), the detail lines and a stable Idempotency-Key per sale. The response carries the folio (document number), signed XML and PDF instantly; SII acceptance arrives later. The issuer RUT (Chilean tax ID) is not in the body: it comes from the API key. A factura is a Chilean electronic invoice; the SII is Chile's tax authority.

What does the issuing RUT need before invoicing?

According to the contract (OpenAPI), the factura requires three things on the issuer's side:

If the RUT is not enabled yet, see how the process works in SII certification to issue with your own software.

Which recipient fields are required?

The factura is a business-to-business document. These five fields are required:

FieldMax lengthExample
receptor_rutRUT as text with hyphen76987654-5
receptor_name100Comercial Los Andes SpA
receptor_giro (line of business)40Venta de insumos
receptor_direccion (address)70Av. Providencia 1234
receptor_comuna (municipality)20Providencia

Useful optional fields: receptor_ciudad, receptor_contacto and receptor_email. If you send the email, when the SII accepts the document the XML and PDF are sent to that address.

The factura rejects the generic final-consumer RUT (66666666-6): that one is valid only on boletas (receipts).

Are prices net or VAT-inclusive?

On the factura, price is net by default. The API calculates VAT as 19% of the net and the total as net + exempt + VAT. If your system uses VAT-inclusive prices, send "prices_include_iva": true and the API calculates the net so that net + VAT gives your total. For example, a price of CLP 119,000 with VAT becomes net CLP 100,000 and VAT CLP 19,000. The contract warns that for a few amounts the net may differ by CLP 1, because the SII requires VAT to be 19% of the net.

Amounts are in whole pesos, as JSON numbers. A factura accepts up to 60 lines in items, with per-line discounts, global discounts or surcharges and references (for example a purchase order).

What does the full call look like?

This example uses the sandbox, which does not touch the real SII or consume folios. The API key is read from the SHARKPOS_API_KEY environment variable.

curl -X POST https://sandbox.sharkpos.cl/api/v1/dte/factura/emit/ \
  -H "Authorization: Bearer $SHARKPOS_API_KEY" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: venta-1042" \
  -d '{
    "receptor_rut": "76987654-5",
    "receptor_name": "Comercial Los Andes SpA",
    "receptor_giro": "Venta de insumos",
    "receptor_direccion": "Av. Providencia 1234",
    "receptor_comuna": "Providencia",
    "receptor_email": "[email protected]",
    "items": [
      {"name": "Servicio de consultoría", "qty": 1, "price": 100000},
      {"name": "Licencia mensual", "qty": 2, "price": 25000}
    ],
    "payment_form": 1,
    "references": [
      {"document_type": "801", "folio": "OC-2026-118", "date": "2026-11-20", "reason": "Orden de compra"}
    ]
  }'

With those lines, the net is CLP 150,000, VAT CLP 28,500 and the total CLP 178,500. payment_form is 1 cash, 2 credit or 3 no cost; if you do not send it, 2 (credit) is used, as the SII assumes. If the sale has already been paid, send 1.

If the document has a single line, you can also send item_name and amount_net (or amount_total with VAT), but not both.

What does the API respond?

A 201 with these fields (the values below are examples):

{
  "status": "success",
  "dte_id": "0f1e2d3c-4b5a-4968-8776-655443322110",
  "folio": 48,
  "document_type": 33,
  "dte_status": "SIGNED",
  "idempotency_replayed": false,
  "xml_data": "...base64...",
  "pdf_data": "...base64...",
  "links": {
    "status": "/api/v1/dte/documents/0f1e2d3c-.../",
    "pdf": "/api/v1/dte/b2b/0f1e2d3c-.../pdf/",
    "xml": "/api/v1/dte/documents/0f1e2d3c-.../xml/",
    "ted": "/api/v1/dte/documents/0f1e2d3c-.../ted/",
    "ted_png": "/api/v1/dte/documents/0f1e2d3c-.../ted.png"
  }
}

The document is already signed and has a folio, but the SII has not responded yet. Save dte_id and folio and follow the result with webhooks: how to know whether the SII accepted your receipt or invoice.

How do I get the PDF?

With auto_send_email set to false (the default), the response carries pdf_data in base64, letter-size format. You can also download it whenever you want from links.pdf:

curl https://sandbox.sharkpos.cl/api/v1/dte/b2b/0f1e2d3c-4b5a-4968-8776-655443322110/pdf/ \
  -H "Authorization: Bearer $SHARKPOS_API_KEY" \
  -o factura-48.pdf

If the response carries pdf_error, the document is still valid: download the PDF later from links.pdf and never issue again.

Which errors show up most when invoicing?

On any other 4xx, do not retry: fix the request. The message says which field failed and many responses carry a solution. If you change the body and reuse the key, you get 409 IDEMPOTENCY_CONFLICT.

What if I need to correct or cancel the invoice?

It is done with a nota de crédito (credit note, DTE 61) that references the factura. The same pattern works for boletas: we explain it in how to cancel or correct a boleta with a credit note (in Spanish). If your stack is Python, Node or PHP, the guides for Python, Node and PHP (in Spanish) show the same idempotency and error handling applied to boletas.

Try it in the sandbox

Request your test API key at /sandbox/: it arrives instantly, with a test company, certificate and folios loaded, and lasts 2, 6 or 24 hours at your choice. In production, SharkPOS API costs CLP 5,990 a month per RUT, VAT included, with 20,000 documents a month. The full contract is in openapi.yaml.

Try it today in the sandbox

Get a sandbox API key: a test company with certificate and folios already loaded and a simulated SII. When you are ready, each RUT costs CLP 5,990 a month (VAT included) with 20,000 documents a month.