Skip to content

E-invoicing for developers

Issue DTEs to Hacienda, El Salvador’s Ministry of Finance, with a single API: from your code, your terminal or your AI agent.

  • Public API and OpenAPI 3.1
  • Test environment from day one
  • Open-source API: you can self-host it

POST /api/v1/dte · test environment

curl https://app.openfactura.co/api/v1/dte \
  -H "Authorization: Bearer $OPENFACTURA_API_KEY" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: pedido-1042" \
  -d '{
    "tipoDte": "01",
    "datos": {
      "items": [
        { "descripcion": "Service", "cantidad": 2, "precioUni": 11.3 }
      ]
    }
  }'

What it covers today

  • 11

    DTE types: invoices, tax credit invoices, notes and more

  • 4

    events, such as invalidation and contingency

  • 100%

    open-source API

  • 2.0

    Hacienda’s current specification

Authorized as a DTE issuer by the DGII

We ran our own issuer tests with Hacienda using Open Factura and passed without a hitch. In hours, not weeks.

  • Invoice
  • Tax Credit Invoice
  • Delivery Note
  • Credit Note
  • Debit Note
  • Withholding Receipt
  • Settlement Receipt
  • Accounting Settlement Document
  • Export Invoice
  • Excluded Subject Invoice
  • Contingency
  • Invalidation
Authorization MH.DGII.DFE/008.071632/2026 from the Dirección General de Impuestos Internos (DGII): YAYA TECHNOLOGIES has met the technical requirements to be a DTE issuer
MH.DGII.DFE/008.071632/2026 · November 13, 2026 · View PDF It accredits YAYA TECHNOLOGIES as a DTE issuer. It is not a certification of the software by the Ministry of Finance.

One API call and you’re integrated with Hacienda

Your first test DTE in 2 minutes, no paperwork.

API · 3 lines
const r = await fetch('https://app.openfactura.co/api/v1/dte', { method: 'POST',
  headers: { Authorization: `Bearer ${process.env.OPENFACTURA_KEY}`, 'Content-Type': 'application/json' },
  body: JSON.stringify({ tipoDte: '01', datos: { items: [{ descripcion: 'Coffee', cantidad: 2, precioUni: 3.5 }] } }) })
or with the CLI · 2 lines
npx @openfactura/cli login --url https://app.openfactura.co
npx @openfactura/cli dte emitir factura.json

Back to your system: the seal, the PDF and the dte.procesado webhook.

Everything you need to integrate

What your code needs to issue, get notified and retry without surprises.

  • Every DTE type

    Invoice, tax credit invoice, delivery note, credit and debit notes, withholding, export and excluded subject. Validation against the MH schema, JWS signing, transmission and seal.

  • Signed webhooks

    An HMAC-SHA256 notification whenever a document changes state. Retries with backoff and a delivery log.

  • Idempotency

    If the network fails, retry with the same Idempotency-Key: you get the original result and nothing is issued twice.

  • MCP and agents

    A remote and stdio MCP server, plus agent skills. Each tool requires the same permission as its REST route.

  • Test and production

    An of_test_ key never touches production. MH credentials are encrypted with AES-256-GCM and never returned by the API.

  • Hacienda’s vocabulary

    Fields are named as in the official spec, so what you send is what Hacienda defines. Stable error codes, OpenAPI 3.1 and rate limits with RateLimit headers.

Choose how to integrate

An API, a CLI and an agent. Every operation exists in REST, in the CLI and as an MCP tool, with the same permissions.

  • REST with a public OpenAPI 3.1 spec
  • MIT-licensed @openfactura/cli
  • Remote or stdio MCP, plus agent skills

Quickstart

POST /api/v1/dte
curl https://app.openfactura.co/api/v1/dte \
  -H "Authorization: Bearer $OPENFACTURA_API_KEY" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: pedido-1042" \
  -d '{
    "tipoDte": "01",
    "datos": {
      "items": [
        { "descripcion": "Service", "cantidad": 2, "precioUni": 11.3 }
      ]
    }
  }'
201 Created
{
  "codigoGeneracion": "0862382B-0BB8-42A0-BB6B-B42DCCDF1EA4",
  "numeroControl": "DTE-01-M001P001-000000000000001",
  "estado": "procesado",
  "total": 22.6,
  "selloRecibido": "20265EE94C1B2C4CBB56F56121E37F5AC8CA7D27"
}
terminal
npm i -g @openfactura/cli
openfactura login --url https://app.openfactura.co   # prompts for the key without echoing it

openfactura dte validar factura.json   # no control number, no signature
openfactura dte emitir factura.json
openfactura dte pdf 0862382B-0BB8-42A0-BB6B-B42DCCDF1EA4 -o factura.pdf
Claude Code · remote server
claude mcp add --transport http openfactura https://openfactura.co/mcp \
  --header "Authorization: Bearer of_test_…"
or over stdio, with the CLI
claude mcp add openfactura \
  --env OPENFACTURA_API_KEY=of_test_… \
  --env OPENFACTURA_URL=https://app.openfactura.co \
  -- npx -y @openfactura/cli mcp

Ask it to “issue a final-consumer invoice for 2 services at $11.30, VAT included”. The assistant validates, shows you the summary and issues once you confirm.

terminal
npx skills add xaviigna/openfactura

Four skills for Claude Code, Cursor and other agents: openfactura-conectar, openfactura-facturar, openfactura-errores and openfactura-webhooks. See them on skills.sh.

Know about every seal without polling

A signed POST to your system whenever a document changes state. Verify the signature with WebCrypto on Node, Workers, Deno or Bun.

  • HMAC-SHA256 signature in OpenFactura-Signature
  • Retries with backoff
  • Delivery log
  • dte.procesado
  • dte.rechazado
  • dte.contingencia
  • dte.invalidado
  • retorno.procesado
  • retorno.invalidado
  • operaciones_especiales.procesado
  • operaciones_especiales.invalidado

Webhooks guide

webhook.ts
const enc = new TextEncoder()

export async function POST(req: Request) {
  const body = await req.text() // raw, before JSON.parse
  const header = req.headers.get('OpenFactura-Signature') ?? ''
  const { t, v1 = '' } = Object.fromEntries(
    header.split(',').map((p) => p.split('=')),
  )
  if (!(Math.abs(Date.now() / 1000 - Number(t)) <= 300))
    return new Response('expired', { status: 400 })

  const key = await crypto.subtle.importKey(
    'raw', enc.encode(process.env.OPENFACTURA_WEBHOOK_SECRET),
    { name: 'HMAC', hash: 'SHA-256' }, false, ['verify'],
  )
  const signature = Uint8Array.from(v1.match(/../g) ?? [],
    (h) => Number.parseInt(h, 16))
  const ok = await crypto.subtle.verify(
    'HMAC', key, signature, enc.encode(`${t}.${body}`),
  )
  if (!ok) return new Response('invalid signature', { status: 400 })

  const event = JSON.parse(body) // { id, evento, ambiente, datos }
  return new Response(null, { status: 204 })
}

Your agent does it for you

Just ask. Your agent looks up the customer, validates against the MH schema and issues the DTE over MCP, with the permissions of the key you give it.

Connect your agents
npx @openfactura/cli mcp install --todos
Works with
  • +4

Connect your agent MCP tools skills.sh

The official PDF, ready for your customer

Every processed document gets its printable version in the layout Hacienda suggests, alongside the official signed JSON.

  • QR code to look it up on the MH portal
  • Generation code, control number and seal
  • From the API, the CLI (openfactura dte pdf) or the dashboard

Read the docs

factura.pdf
Your company, S.A. de C.V.
Electronic tax documentINVOICE
Generation code
0862382B-0BB8-42A0-BB6B-B42DCCDF1EA4
Control number
DTE-01-M001P001-000000000000001
Reception seal
20265EE94C1B2C4CBB56F56121E37F5AC8CA7D27
QtyDescriptionPriceTotal
2Service$11.30$22.60

Total due$22.60

Simple pricing, everything included

Every plan includes the dashboard, WhatsApp, the API, MCP, CLI, webhooks and an unlimited test environment. Each extra DTE costs $0.01 and we never block your invoicing.

Everything included

Starter

$9 /mo

Everything included: the dashboard, WhatsApp and the developer tools.

  • 2,000 DTE/mo, then $0.01 per DTE
  • API, MCP, CLI and webhooks
  • Dashboard, WhatsApp and email delivery (PDF and JSON)
  • Unlimited users and branches
  • 1 company

Pro

$19 /mo

For businesses that invoice every day.

  • 10,000 DTE/mo, then $0.01 per DTE
  • API, MCP, CLI and webhooks
  • Dashboard, WhatsApp and email delivery (PDF and JSON)
  • Unlimited users and branches
  • Clients: up to 3 companies, including yours
  • Email support

Platform

$99 /mo

For software houses, agencies and accountants.

  • 50,000 DTE/mo, then $0.01 per DTE
  • Everything in Pro
  • Up to 25 companies
  • Onboard your customers under your brand, with an API per customer
  • White label: your logo and name, on your own subdomain, on everything your customers see
  • Priority support

Add-on: guided onboarding with Hacienda, $49 one-time.

Need more volume or an SLA? Let’s talk

Prices in US dollars, VAT not included. The test environment is unlimited and doesn’t count. Hacienda charges nothing for invoicing: you pay for the platform.

Cloud or your own server?

The core is open source: you can run it yourself. The cloud adds what saves you the work.

WhatOpen Factura CloudSelf-hosted
PriceFrom $9 a monthFree, plus your Cloudflare Workers plan
Web dashboardYesNo: API, CLI and MCP
Invoicing from WhatsAppYesNo
Email delivery to the customer (PDF and JSON)AutomaticYou build it
Guided onboarding and issuer tests with HaciendaAutomatedYou run them via the API
Updates and backupsAutomatic, 30-day recoveryYou run them
SetupMinutesAn afternoon: Cloudflare, database and secrets
SupportBy emailGitHub community
LicenseServiceAGPL-3.0; SDK and CLI MIT

Integrate your system

Create your account, generate an of_test_ key and issue your first test DTE today. If you have questions, the docs and the repository are open.