Skip to content
Documentation sections

Quickstart

In a few minutes you stamp your first CFDI 4.0 in the sandbox, free and with no tax validity. All you need is a terminal with curl and your CSD at hand.

1. Create your sandbox account

Sign up at sandbox-app.facturadigital.com.mx/registro. Sign-up asks for your Constancia de Situación Fiscal (tax status certificate) and your digital seal certificate (CSD: .cer, .key and password). Don't confuse it with the e.firma.

The sandbox is a separate account from production: its CFDIs are stamped with a test provider and never reach the SAT.

2. Copy your key

In your sandbox account, go to Configuración › API y desarrolladores (Settings › API and developers) and copy the Llave vigente (current key). Keep it in an environment variable; treat it like a password.

3. Test the key

curl
export FD_API=https://sandbox-app.facturadigital.com.mx/api/v5
export FD_API_KEY="tu llave vigente"

curl -sS "$FD_API/account/balance" -H "X-Api-Key: $FD_API_KEY"
200
{ "message": "10 credits available.", "balance": 10, "code": 200 }

If it responds code 501, the key doesn't match that URL: check that both belong to the sandbox. More in Keys and environments.

4. Stamp your first CFDI

Save this JSON as factura.json. It's an income invoice with one line item and 16% VAT to XENON INDUSTRIAL ARTICLES, a test taxpayer the SAT publishes. Change Emisor.RegimenFiscal to your regime; the API fills in the issuer's RFC and name from your account.

factura.json
{
  "Version": "4.0",
  "Serie": "A",
  "Folio": "1",
  "Fecha": "AUTO",
  "FormaPago": "03",
  "MetodoPago": "PUE",
  "Moneda": "MXN",
  "TipoDeComprobante": "I",
  "Exportacion": "01",
  "LugarExpedicion": "64000",
  "SubTotal": "2501.00",
  "Total": "2901.16",
  "Emisor": { "RegimenFiscal": "601" },
  "Receptor": {
    "Rfc": "XIA190128J61",
    "Nombre": "XENON INDUSTRIAL ARTICLES",
    "DomicilioFiscalReceptor": "76343",
    "RegimenFiscalReceptor": "601",
    "UsoCFDI": "G03"
  },
  "Conceptos": [
    {
      "ClaveProdServ": "01010101",
      "Cantidad": "2",
      "ClaveUnidad": "H87",
      "Descripcion": "Producto de prueba",
      "ValorUnitario": "1250.50",
      "Importe": "2501.00",
      "ObjetoImp": "02",
      "Impuestos": {
        "Traslados": [
          { "Base": "2501.00", "Impuesto": "002", "TipoFactor": "Tasa", "TasaOCuota": "0.160000", "Importe": "400.16" }
        ]
      }
    }
  ],
  "Impuestos": {
    "TotalImpuestosTrasladados": "400.16",
    "Traslados": [
      { "Base": "2501.00", "Impuesto": "002", "TipoFactor": "Tasa", "TasaOCuota": "0.160000", "Importe": "400.16" }
    ]
  }
}
curl
curl -sS -X POST "$FD_API/invoice/create" \
  -H "X-Api-Key: $FD_API_KEY" \
  --data-urlencode "json@factura.json"
200
{
  "message": "The document was generated successfully",
  "code": 200,
  "cfdi": {
    "UUID": "6F1A2B3C-4D5E-4F60-8172-93A4B5C6D7E8",
    "FechaTimbrado": "2026-11-03T10:30:12",
    "XmlBase64": "PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz4…",
    "PDF": "https://sandbox-app.facturadigital.com.mx/docs/pdf/6F1A2B3C-…",
    "…": "…"
  }
}
  • cfdi.UUID is the fiscal folio.
  • cfdi.XmlBase64 is the stamped XML. Store it in your system.
  • cfdi.PDF opens the PDF with your template.

5. Go live

  1. Create your account at app.facturadigital.com.mx/registro: it comes with 10 free folios.
  2. Copy that account's current key, in Configuración › API y desarrolladores.
  3. Change the base URL to https://app.facturadigital.com.mx/api/v5 and the key. The rest of the code stays the same.
  4. Each stamped CFDI uses 1 folio; cancelling uses none. Buy more folios in your account when you need them; they don't expire.

Next steps

Checked against the production API v5 on 2026-11-03.