Runs everywhere your TypeScript or JavaScript runs
Zero dependencies, fully typed, tree-shakeable ESM and CommonJS. Signing uses Web Crypto, so dte-sdk behaves the same on Node (>= 20), Deno, and Bun, at the Edge, and in the browser.
import { createDte, stampDte } from 'dte-sdk'
import { signDte, sendToSii } from 'dte-sdk'
const dte = createDte(invoice)
dte.totals.vat // → 22800
dte.totals.total // → 142800
const doc = stampDte(dte, caf) // TED ✓
const signed = await signDte(doc, cert)
await sendToSii(signed, opts) // → { trackId }dte-sdk is a TypeScript toolkit for Chilean DTE as defined by the SII — build, stamp, sign, and send invoices, receipts, and credit notes from any runtime.
From line items to an accepted document — each function owns one step of the lifecycle, so you compose only what your flow needs.
By example
Nine composable functions across the whole lifecycle — typed documents, IVA-correct totals, the TED stamp, XMLDSig signing, SII upload and tracking, and PII-safe errors. Tab through to see them in context.
import { createDte } from 'dte-sdk'
const dte = createDte({
type: 33, // Factura electrónica
folio: 1024,
issuer, // { rut: '76.123.456-0', ... }
receiver, // { rut: '77.654.321-7', ... }
items: [
{ name: 'Licencia anual', quantity: 1, unitPrice: 120000 },
],
})
dte.totals.net // → 120000
dte.totals.vat // → 22800
dte.totals.total // → 142800Live demo
Pick a document type and a line item. Net, IVA, total, and the XML preview update live in your browser — no server, no account.
Try it — build a document
toXml() preview — unsigned, no TED
<DTE version="1.0">
<Documento ID="F1024T33">
<Encabezado>
<IdDoc>
<TipoDTE>33</TipoDTE>
<Folio>1024</Folio>
<FchEmis>2026-10-30</FchEmis>
</IdDoc>
<Emisor>
<RUTEmisor>76123456-0</RUTEmisor>
<RznSoc>Arrow Software SpA</RznSoc>
</Emisor>
<Receptor>
<RUTRecep>77654321-7</RUTRecep>
</Receptor>
<Totales>
<MntNeto>120000</MntNeto>
<TasaIVA>19</TasaIVA>
<IVA>22800</IVA>
<MntTotal>142800</MntTotal>
</Totales>
</Encabezado>
<Detalle>
<NroLinDet>1</NroLinDet>
<NmbItem>Licencia anual</NmbItem>
<QtyItem>1</QtyItem>
<PrcItem>120000</PrcItem>
<MontoItem>120000</MontoItem>
</Detalle>
</Documento>
</DTE>Why an SDK
You can template a DTE by hand. The hard part is everything around it: IVA rounding that matches the SII, CAF folio bookkeeping, the TED stamp, XMLDSig canonicalization, the seed/token dance, and tracking acceptance. Here's how the alternatives compare.
| Capability | Other SDKs | Hand-rolled XML | dte-sdk |
|---|---|---|---|
| Produces SII-schema XML | Supported | Supported | Supported |
| IVA and totals with SII rounding rules | Supported | Partial support | Supported |
| TED stamp from your CAF (with PDF417 payload) | Supported | Partial support | Supported |
| XMLDSig signing with Web Crypto — no OpenSSL binary | Partial support | Not supported | Supported |
| Folio range and CAF expiry checks before stamping | Partial support | Not supported | Supported |
| SII authentication, upload, and status tracking | Partial support | Not supported | Supported |
| End-to-end TypeScript types, no @types package | Not supported | Not supported | Supported |
| Typed, PII-safe errors (DteError codes) | Not supported | Not supported | Supported |
| Runs in Node, Deno, Bun, Edge, and the browser | Not supported | Partial support | Supported |
| Zero runtime dependencies | Not supported | Supported | Supported |
| Actively maintained & tested (412 cases) | Partial support | Not supported | Supported |
dte-sdk is the focused, fully typed version of all this — nine composable functions covering the whole lifecycle, in ~8.4 KB and with no runtime dependencies.
Zero dependencies, fully typed, tree-shakeable ESM and CommonJS. Signing uses Web Crypto, so dte-sdk behaves the same on Node (>= 20), Deno, and Bun, at the Edge, and in the browser.
Add the package with your manager of choice: npm install dte-sdk — also works with bun, pnpm, and yarn.
Call createDte({ type: 33, folio, issuer, receiver, items }) and get back an immutable, validated document with its totals already computed.
stampDte() adds the TED with your CAF; signDte() applies the XMLDSig signature with your digital certificate.
sendToSii() uploads the signed envelope and returns a track id; getStatus() tells you when it's accepted.
A DTE (Documento Tributario Electrónico) is the electronic version of a Chilean tax document — invoices, receipts, dispatch guides, debit and credit notes — as defined by the SII, Chile's tax authority. Each one is an XML document with a folio, an electronic stamp (TED), and a digital signature.
Issuing one means getting the details right end to end: totals and IVA, folios authorized by a CAF, the stamp, the signature, and the upload to the SII. That lifecycle is exactly what dte-sdk models.
The blog covers the engineering behind dte-sdk — how electronic tax documents actually work, from folios and stamps to signatures and SII acceptance.
Following dte-sdk?
Star on GitHubMIT License © 2026 Arrow Software