# What Facturia is (/en/docs/empezar)

## In one sentence [#in-one-sentence]

Facturia issues, receives and files Chilean electronic tax documents (DTE) over an API, for as many
empresas — Chilean companies, one per RUT — as you like, with a free sandbox that never touches the
SII, Chile's tax authority.

## What we do for you [#what-we-do-for-you]

When you send a document, this is what happens without you having to write any of it:

**We assign the folio** — the pre-authorised sequential number a DTE must carry — out of a real CAF
(*código de autorización de folios*, the SII-signed block of folios) held by that empresa for that
document type. A folio is never issued twice: the engine holds a unique constraint on
`(empresa RUT, tipo_dte, folio)`.

**We build and sign the XML** with the empresa's digital certificate, which lives encrypted in a
per-tenant vault and never leaves it. The certificate is not an argument of the issuance call.

**We transmit it to the SII** and store the `track_id`.

**We follow it to a terminal state**, querying both of the SII's status layers (the envelope's and
the document's) and publishing a single `status`.

**We generate the PDF** with the layout that already passed the SII's printed-samples review, and we
tell you with a webhook.

We also receive your suppliers' DTEs in a casilla de intercambio of our own — the mailbox the SII
delivers exchange traffic to — keep your Registro de Compras y Ventas in sync, compute your F29 (the
monthly VAT return) and, if you switch it on, file it.

## What stays yours [#what-stays-yours]

* **The digital certificate** belongs to a natural person, who has to be an authorised user of the
  empresa at the SII. You upload it once and can purge it whenever you want with
  `DELETE /v1/empresas/{empresa_id}/certificate`; that revokes custody and suspends issuance,
  without talking to support.
* **The mandato** — the revocable power of attorney that lets us act before the SII on your behalf —
  can be withdrawn at any moment.
* **The tax decisions.** Every automation ships switched off except the folio request. Nothing files
  a return or issues a document because of a default we picked.
* **The exchange rate** on a charge in foreign currency is yours to set. We do not invent a figure
  that defines the taxable base of a tax document.

> **We never ask for your clave tributaria**
>
> The whole tax suite runs on a certificate-authenticated session against the SII's own data area.
> There is no clave tributaria — the taxpayer's SII password — in Facturia: we do not ask for it, we
> do not store it and we do not need it.

## The resource model [#the-resource-model]

```
account
├── api_key                (modo, scopes, lista blanca de empresas)
├── webhook_endpoint  ──▶  event ──▶ webhook_delivery
├── usage_record           (libro inmutable; se anota al aceptar el SII)
└── empresa                (una por RUT; el límite de tenencia de todo lo de abajo)
    ├── certificate        (custodia del .pfx, vencimiento)
    ├── mandato            (autorización revocable para actuar ante el SII)
    ├── onboarding         (draft → … → emitting; certificación por tipo de documento)
    ├── automation_settings(auto_emit_46, auto_file_f29, auto_request_folios, …)
    ├── branding           (logo, formatos de impresión)
    ├── caf / folio_range  (disponibilidad por tipo_dte)
    ├── document           (DTE emitido) ──▶ artefactos, eventos, referencias
    ├── received_document  (DTE de proveedor) ──▶ commercial_response
    ├── connection         (feed bancario Fintoc → gastos)
    └── tax
        ├── rcv_entry      (compras / ventas, estado_contable, caracterización)
        ├── expense        (cargo en moneda extranjera → candidato a tipo 46)
        ├── statement      (cartola CSV/XLSX subida → gastos)
        ├── suggestion     (acción detectada, p. ej. emitir un tipo 46)
        ├── f29_proposal   (calculado, por período, + .txt listo para subir)
        └── f29_filing     (job asíncrono: prepared → uploading → submitted → accepted)
```

**The empresa is the tenancy boundary.** Nothing crosses it: not folios, not documents, not RCV, not
webhook payloads, not usage. An account is a billing and access-control container over many
empresas.

## The eight document types [#the-eight-document-types]

| `tipo_dte` | Document                     | Prices are                             | Notes                                                                                  |
| ---------- | ---------------------------- | -------------------------------------- | -------------------------------------------------------------------------------------- |
| 33         | Factura electrónica (afecta) | net                                    | The only one with a copia cedible (the transferable copy used for factoring) at launch |
| 34         | Factura no afecta o exenta   | net                                    | Every line exempt                                                                      |
| 39         | Boleta electrónica (afecta)  | **gross (IVA, Chile's VAT, included)** | Receptor optional (`66666666-6`)                                                       |
| 41         | Boleta exenta                | **gross**                              | Receptor optional                                                                      |
| 46         | Factura de compra            | net                                    | You withhold the IVA                                                                   |
| 52         | Guía de despacho             | net                                    | Requires a `dispatch` block                                                            |
| 56         | Nota de débito               | net                                    | Requires a reference                                                                   |
| 61         | Nota de crédito              | net                                    | Requires a reference                                                                   |

Boletas (39/41) travel over a different transport from facturas — REST instead of SOAP, in batches,
with their own token and their own certification. That is invisible to you: same endpoint, same
fields, same statuses.

## Next step [#next-step]

- [Quickstart](/en/docs/empezar/quickstart): A sandbox key and an issued boleta, with the real status cycle.

- [Concepts](/en/docs/empezar/conceptos): Empresa, document, mode and the `Facturia-Empresa` header.

- [From sandbox to production](/en/docs/empezar/produccion): The two lanes, the mandato, the steps a person performs at the SII, and going live.
