Skip to content

Official SDKs for Node.js, PHP and Python.

Call the CFDI 4.0 stamping API v5 from your language without building requests by hand. Same API, same X-Api-Key and a free sandbox. You pay for folios, not the API.

Create and stamp a CFDI. The same API v5 in Node.js, PHP and Python.

This is the call to POST /invoice/create with each language's HTTP client: your key in the X-Api-Key header and the CFDI in the json field. The official SDK makes this call for you; installation and methods are in the documentation.

Node.jsAPI v5
import { readFile } from "node:fs/promises";
const factura = await readFile("factura.json", "utf8");
const res = await fetch(
"https://app.facturadigital.com.mx/api/v5/invoice/create",
{
method: "POST",
headers: { "X-Api-Key": process.env.FD_API_KEY },
body: new URLSearchParams({ json: factura }),
}
);
const { cfdi } = await res.json();
console.log(cfdi.UUID);
PHPAPI v5
$factura = file_get_contents('factura.json');
$ch = curl_init(
'https://app.facturadigital.com.mx/api/v5/invoice/create'
);
curl_setopt_array($ch, [
CURLOPT_POST => true,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => ['X-Api-Key: ' . getenv('FD_API_KEY')],
CURLOPT_POSTFIELDS => http_build_query(['json' => $factura]),
]);
$res = json_decode(curl_exec($ch), true);
echo $res['cfdi']['UUID'];
PythonAPI v5
import os, requests
with open("factura.json") as f:
factura = f.read()
res = requests.post(
"https://app.facturadigital.com.mx/api/v5/invoice/create",
headers={"X-Api-Key": os.environ["FD_API_KEY"]},
data={"json": factura},
)
print(res.json()["cfdi"]["UUID"])
Same responsecfdi.UUID: 6FA90F39-2D7A-4F1C-…plus the XML in Base64 and the PDF link

One SDK per language, the same API v5.

Each SDK calls the same API v5: same endpoints, same X-Api-Key and same responses. Using another language? The API works with any HTTPS client.

Node.js

Official SDK · New

To integrate API v5 into your Node.js backend.

PHP

Official SDK · New

To integrate API v5 into your PHP system without building the requests with curl.

Python

Official SDK · New

To integrate API v5 into your Python system or scripts.

What you get with API v5.

The same API v5

Same endpoints, same X-Api-Key and same responses as the documented API.

Free sandbox

Integrate against the sandbox, which stamps with a test PAC; those CFDI have no tax validity.

You pay for folios, not the API

The SDK has no cost. Each stamped CFDI uses 1 folio and your folios never expire.

Ultra-fast PAC stamping with backup

If a PAC doesn't respond, your CFDI still gets stamped. Your code doesn't change.

What the API handles for you.

With the JSON method of API v5 you send the document data and the rest is already handled.

No XML or seal

You send the CFDI data as JSON; the API builds the XML, seals it with your CSD and stamps it.

Automatic folio and date

Folio and Fecha accept the value "AUTO"; for Carta Porte, so does IdCCP.

XML and PDF in the response

You get the UUID, the XML in Base64 and links to the PDF and XML. The PDF uses the template you choose.

Email at stamping time

With enviar_mail, the CFDI is sent to your customer in the same step.

SAT errors explained in Spanish

If the CFDI doesn't match the SAT schema, nothing is stamped: the response has code 702 and an errors list with the element and field of each error.

Current complements

Payment receipt 2.0, payroll 1.2, Carta Porte 3.1, Comercio Exterior 2.0 and the other current complements.

Documentation and support from real people.

Real people on WhatsApp

If you get stuck with the integration, someone from our team helps you at +52 81 2044 5452.

Webhooks and MCP server

Also new: notifications when a CFDI is stamped, cancelled or paid, and a connection for Claude, ChatGPT or Gemini.

Frequently asked questions

Which languages have an official SDK?

Node.js, PHP and Python. If you use another language, API v5 works with any client that makes HTTPS requests: curl, fetch, Guzzle, requests or HttpClient.

Do I need an SDK to use the API?

No. API v5 is REST over HTTPS: you send form fields and get JSON back. The SDK saves you from building requests and reading responses by hand.

Does the SDK cost anything?

No. You pay for folios, not the API: each stamped CFDI uses 1 folio, same as on the web, and your folios never expire.

Can I test with the sandbox?

Yes. The SDK calls the same API v5, so it works with the sandbox, which is free and stamps with a test PAC; those CFDI have no tax validity. For production you switch to the production URL and key.

Can I stamp Carta Porte, payroll and payment receipts with the SDK?

Yes. The SDK calls API v5, which accepts invoices, credit notes, payment receipts 2.0, payroll 1.2, Carta Porte 3.1 and the other current complements.

What happens if my CFDI has an error?

It isn't stamped. If the CFDI doesn't match the SAT schema, the API responds with code 702, a summary in Spanish and an errors list with the element, field and message of each error; for example: «Elemento 'Comprobante': El campo 'Exportacion' es obligatorio.»

Where do I find installation steps and examples?

In the documentation, at docs.facturadigital.com.mx. If you get stuck, message us on WhatsApp at +52 81 2044 5452 and a person from our team will help you.

Stamp from your system with API v5.

Create your account with 10 free folios, no card required. The sandbox is free and the API is included: you pay for folios.