Node.js
Official SDK · New
To integrate API v5 into your Node.js backend.
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.
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.
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);$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'];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"])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.
Official SDK · New
To integrate API v5 into your Node.js backend.
Official SDK · New
To integrate API v5 into your PHP system without building the requests with curl.
Official SDK · New
To integrate API v5 into your Python system or scripts.
Same endpoints, same X-Api-Key and same responses as the documented API.
Integrate against the sandbox, which stamps with a test PAC; those CFDI have no tax validity.
The SDK has no cost. Each stamped CFDI uses 1 folio and your folios never expire.
If a PAC doesn't respond, your CFDI still gets stamped. Your code doesn't change.
With the JSON method of API v5 you send the document data and the rest is already handled.
You send the CFDI data as JSON; the API builds the XML, seals it with your CSD and stamps it.
Folio and Fecha accept the value "AUTO"; for Carta Porte, so does IdCCP.
You get the UUID, the XML in Base64 and links to the PDF and XML. The PDF uses the template you choose.
With enviar_mail, the CFDI is sent to your customer in the same step.
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.
Payment receipt 2.0, payroll 1.2, Carta Porte 3.1, Comercio Exterior 2.0 and the other current complements.
API v5 reference and a guide for each SDK at docs.facturadigital.com.mx.
If you get stuck with the integration, someone from our team helps you at +52 81 2044 5452.
Also new: notifications when a CFDI is stamped, cancelled or paid, and a connection for Claude, ChatGPT or Gemini.
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.
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.
No. You pay for folios, not the API: each stamped CFDI uses 1 folio, same as on the web, and your folios never expire.
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.
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.
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.»
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.
Create your account with 10 free folios, no card required. The sandbox is free and the API is included: you pay for folios.