Prerequisites
- Sandbox credentials from your Facturama account
- A REST client (CURL, Postman, or your preferred HTTP library)
Build the JSON payload
This is the minimum payload for an Income CFDI to the general public:{
"NameId": "1",
"Folio": "100",
"CfdiType": "I",
"PaymentForm": "03",
"PaymentMethod": "PUE",
"ExpeditionPlace": "78000",
"Date": "2026-06-14T12:00:00",
"Receiver": {
"Rfc": "XAXX010101000",
"Name": "VENTA PÚBLICO EN GENERAL",
"CfdiUse": "S01",
"TaxZipCode": "78000",
"FiscalRegime": "616"
},
"Items": [
{
"ProductCode": "01010101",
"IdentificationNumber": "EDL",
"Description": "Estudios de laboratorio",
"Unit": "NO APLICA",
"UnitCode": "MTS",
"UnitPrice": 50,
"Quantity": 2.0,
"Subtotal": 100,
"TaxObject": "02",
"Taxes": [
{
"Total": 16,
"Name": "IVA",
"Base": 100,
"Rate": 0.16,
"IsRetention": false
}
],
"Total": 116
}
]
}
Send the request
curl --request POST \
--url https://apisandbox.facturama.mx/api/3/cfdis \
--header 'Authorization: Basic token_base64' \
--header 'Content-Type: application/json' \
--data '{
"NameId": "1",
"Folio": "100",
"CfdiType": "I",
"PaymentForm": "03",
"PaymentMethod": "PUE",
"ExpeditionPlace": "78000",
"Date": "2026-06-14T12:00:00",
"Receiver": {
"Rfc": "XAXX010101000",
"Name": "VENTA PÚBLICO EN GENERAL",
"CfdiUse": "S01",
"TaxZipCode": "78000",
"FiscalRegime": "616"
},
"Items": [
{
"ProductCode": "01010101",
"IdentificationNumber": "EDL",
"Description": "Estudios de laboratorio",
"Unit": "NO APLICA",
"UnitCode": "MTS",
"UnitPrice": 50,
"Quantity": 2.0,
"Subtotal": 100,
"TaxObject": "02",
"Taxes": [
{
"Total": 16,
"Name": "IVA",
"Base": 100,
"Rate": 0.16,
"IsRetention": false
}
],
"Total": 116
}
]
}'
Field-by-Field Explanation
NameId1Folio100CfdiTypeIPaymentForm03PaymentMethodPUEExpeditionPlace78000Receiver.RfcXAXX010101000Receiver.CfdiUseS01Receiver.FiscalRegime616Items[].ProductCode01010101Items[].IdentificationNumberABCD123456Items[].DescriptionEstudios de laboratorioItems[].UnitNO APLICAItems[].UnitCodeMTSItems[].UnitPrice50.0Items[].Quantity1Items[].Subtotal100Items[].TaxObject02Items[].Total116.0Items[].Taxes.Total16.0Items[].Taxes.NameIVAItems[].Taxes.Base100.0Items[].Taxes.Rate.16Items[].Taxes.IsRetentionfalseimport requests, base64
creds = base64.b64encode(b"user:password").decode()
headers = {"Authorization": f"Basic {creds}", "Content-Type": "application/json"}
payload = {
"NameId": "1",
"Folio": "100",
"CfdiType": "I",
"PaymentForm": "03",
"PaymentMethod": "PUE",
"ExpeditionPlace": "78000",
"Date": "2026-06-14T12:00:00",
"Receiver": {
"Rfc": "XAXX010101000",
"Name": "VENTA PÚBLICO EN GENERAL",
"CfdiUse": "S01",
"TaxZipCode": "78000",
"FiscalRegime": "616"
},
"Items": [
{
"ProductCode": "01010101",
"IdentificationNumber": "EDL",
"Description": "Estudios de laboratorio",
"Unit": "NO APLICA",
"UnitCode": "MTS",
"UnitPrice": 50,
"Quantity": 2.0,
"Subtotal": 100,
"TaxObject": "02",
"Taxes": [
{
"Total": 16,
"Name": "IVA",
"Base": 100,
"Rate": 0.16,
"IsRetention": false
}
],
"Total": 116
}
]
}
r = requests.post("https://apisandbox.facturama.mx/api/3/cfdis", json=payload, headers=headers)
print(r.json())
import java.io.IOException;
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
public class Main {
public static void main(String[] args)
throws IOException, InterruptedException {
HttpClient client = HttpClient.newHttpClient();
String json = """
{
"NameId": "1",
"Folio": "100",
"CfdiType": "I",
"PaymentForm": "03",
"PaymentMethod": "PUE",
"ExpeditionPlace": "78000",
"Date": "2026-06-14T12:00:00",
"Receiver": {
"Rfc": "XAXX010101000",
"Name": "VENTA PÚBLICO EN GENERAL",
"CfdiUse": "S01",
"TaxZipCode": "78000",
"FiscalRegime": "616"
},
"Items": [
{
"ProductCode": "01010101",
"IdentificationNumber": "EDL",
"Description": "Estudios de laboratorio",
"Unit": "NO APLICA",
"UnitCode": "MTS",
"UnitPrice": 50,
"Quantity": 2.0,
"Subtotal": 100,
"TaxObject": "02",
"Taxes": [
{
"Total": 16,
"Name": "IVA",
"Base": 100,
"Rate": 0.16,
"IsRetention": false
}
],
"Total": 116
}
]
}
""";
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create(
"https://apisandbox.facturama.mx/api/3/cfdis"
))
.header(
"Authorization",
"Basic token_base64"
)
.header(
"Content-Type",
"application/json"
)
.POST(HttpRequest.BodyPublishers.ofString(json))
.build();
HttpResponse<String> response = client.send(
request,
HttpResponse.BodyHandlers.ofString()
);
System.out.println("Status: " + response.statusCode());
System.out.println(response.body());
}
}
const axios = require("axios");
const url = "https://apisandbox.facturama.mx/api/3/cfdis";
const headers = {
"Authorization": "Basic token_base64",
"Content-Type": "application/json"
};
const data = {
NameId: "1",
Folio: "100",
CfdiType: "I",
PaymentForm: "03",
PaymentMethod: "PUE",
ExpeditionPlace: "78000",
Date: "2026-06-14T12:00:00",
Receiver: {
Rfc: "XAXX010101000",
Name: "VENTA PÚBLICO EN GENERAL",
CfdiUse: "S01",
TaxZipCode: "78000",
FiscalRegime: "616"
},
Items: [
{
ProductCode: "01010101",
IdentificationNumber: "EDL",
Description: "Estudios de laboratorio",
Unit: "NO APLICA",
UnitCode: "MTS",
UnitPrice: 50,
Quantity: 2.0,
Subtotal: 100,
TaxObject: "02",
Taxes: [
{
Total: 16,
Name: "IVA",
Base: 100,
Rate: 0.16,
IsRetention: false
}
],
Total: 116
}
]
};
axios.post(url, data, { headers })
.then(response => {
console.log("Status:", response.status);
console.log(response.data);
})
.catch(error => {
if (error.response) {
console.error("Status:", error.response.status);
console.error(error.response.data);
} else {
console.error(error.message);
}
});
using System;
using System.Net.Http;
using System.Text;
using System.Threading.Tasks;
class Program
{
static async Task Main()
{
using var client = new HttpClient();
client.DefaultRequestHeaders.Add(
"Authorization",
"Basic token_base64"
);
var json = @"
{
""NameId"": ""1"",
""Folio"": ""100"",
""CfdiType"": ""I"",
""PaymentForm"": ""03"",
""PaymentMethod"": ""PUE"",
""ExpeditionPlace"": ""78000"",
""Date"": ""2026-06-14T12:00:00"",
""Receiver"": {
""Rfc"": ""XAXX010101000"",
""Name"": ""VENTA PÚBLICO EN GENERAL"",
""CfdiUse"": ""S01"",
""TaxZipCode"": ""78000"",
""FiscalRegime"": ""616""
},
""Items"": [
{
""ProductCode"": ""01010101"",
""IdentificationNumber"": ""EDL"",
""Description"": ""Estudios de laboratorio"",
""Unit"": ""NO APLICA"",
""UnitCode"": ""MTS"",
""UnitPrice"": 50,
""Quantity"": 2.0,
""Subtotal"": 100,
""TaxObject"": ""02"",
""Taxes"": [
{
""Total"": 16,
""Name"": ""IVA"",
""Base"": 100,
""Rate"": 0.16,
""IsRetention"": false
}
],
""Total"": 116
}
]
}";
var content = new StringContent(
json,
Encoding.UTF8,
"application/json"
);
var response = await client.PostAsync(
"https://apisandbox.facturama.mx/api/3/cfdis",
content
);
var responseBody = await response.Content.ReadAsStringAsync();
Console.WriteLine($"Status: {(int)response.StatusCode}");
Console.WriteLine(responseBody);
}
}
require 'net/http'
require 'uri'
require 'json'
url = URI.parse(
'https://apisandbox.facturama.mx/api/3/cfdis'
)
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url.request_uri)
request['Authorization'] =
'Basic token_base64'
request['Content-Type'] = 'application/json'
request.body = {
NameId: "1",
Folio: "100",
CfdiType: "I",
PaymentForm: "03",
PaymentMethod: "PUE",
ExpeditionPlace: "78000",
Date: "2026-06-14T12:00:00",
Receiver: {
Rfc: "XAXX010101000",
Name: "VENTA PÚBLICO EN GENERAL",
CfdiUse: "S01",
TaxZipCode: "78000",
FiscalRegime: "616"
},
Items: [
{
ProductCode: "01010101",
IdentificationNumber: "EDL",
Description: "Estudios de laboratorio",
Unit: "NO APLICA",
UnitCode: "MTS",
UnitPrice: 50,
Quantity: 2.0,
Subtotal: 100,
TaxObject: "02",
Taxes: [
{
Total: 16,
Name: "IVA",
Base: 100,
Rate: 0.16,
IsRetention: false
}
],
Total: 116
}
]
}.to_json
response = http.request(request)
puts "Status: #{response.code}"
puts response.body
Successful response
{
"Id": "Y61TLX-Ls_ZJFqzjanPN1w2",
"CfdiType": "ingreso",
"Type": "I - ingreso",
"Serie": "FAC",
"Folio": "100",
"Date": "2026-06-14T12:00:00",
"CertNumber": "30001000000500003416",
"PaymentTerms": "03 - Transferencia electrónica de fondos",
"PaymentConditions": "",
"PaymentMethod": "PUE - Pago en una sola exhibición",
"PaymentAccountNumber": "",
"PaymentBankName": "",
"ExpeditionPlace": "78000",
"ExchangeRate": 0.0,
"Currency": "MXN - Peso Mexicano",
"Subtotal": 100.0,
"Discount": 0.0,
"Total": 116.00,
"Observations": "",
"OrderNumber": "TEST-001",
"Issuer": {
"FiscalRegime": "601 - General de Ley Personas Morales",
"Rfc": "EKU9003173C9",
"TaxName": "ESCUELA KEMPER URGATE",
"Email": "correo@pruebas.com",
"Phone": "9999999999",
"TaxAddress": {
"Street": "Calle de pruebas",
"ExteriorNumber": "123",
"InteriorNumber": "",
"Neighborhood": "Pruebas",
"ZipCode": "42501",
"Municipality": "Pruebas",
"State": "ESTADO DE MEXICO",
"Country": "México"
},
"IssuedIn": {
"Street": "",
"ExteriorNumber": "",
"Neighborhood": "-",
"ZipCode": "78000",
"Municipality": "",
"State": "",
"Country": "MEXICO"
}
},
"Receiver": {
"Rfc": "XAXX010101000",
"Name": "VENTA PÚBLICO EN GENERAL",
"Email": ""
},
"Items": [
{
"ProductCode": "01010101",
"IdentificationNumber": "EDL",
"UnitCode": "MTS",
"Discount": 0.0,
"CuentaPredial": "",
"Quantity": 2.0,
"Unit": "MTS - NO APLICA",
"Description": "Estudios de laboratorio",
"UnitValue": 50.0,
"Total": 100.0
}
],
"Taxes": [
{
"Total": 16.00,
"Name": "IVA",
"Rate": 0.16,
"Type": "transferred"
}
],
"Complement": {
"TaxStamp": {
"Uuid": "51990f08-5e34-4f5f-a188-bd7e23cd220a",
"Date": "2026-06-14T12:00:01",
"CfdiSign": "H+vvJTkUSRCsyaDfzucoO229RwGw9lgZGONNcYbPUm4giPD7IiwCHx7oXRSC...",
"SatCertNumber": "30001000000500003456",
"SatSign": "KEOuC+0zt4O7DFf2APfzafQdWiIGX3RcQynhfhs3l85V+DHT6eULkPSrJBTjl4Tb....",
"RfcProvCertif": "SPR190613I52"
}
},
"Status": "active",
"OriginalString": "||4.0||100|2026-06-14T12:00:00|03|30001000000500003416||100.0|0.0|MXN|116.00|I|01|PUE|78000|EKU9003173C9|ESCUELA KEMPER URGATE|601|XAXX010101000|VENTA PÚBLICO EN GENERAL|78000|616|S01|01010101|EDL|2|MTS|NO APLICA|Estudios de laboratorio|50|100|02|100|002|Tasa|0.160000|16|100.0|002|Tasa|0.160000|16.00|16.00||"
}
Id you’ll use to download the XML, PDF, or send by email.
Common errors on your first invoice
| Error | Cause | Solution |
|---|---|---|
401 Unauthorized | Wrong credentials | Check your Sandbox username/password |
400 Bad Request - RFC inválido | Wrong receiver RFC | Use XAXX010101000 for general public |
400 - ProductCode no válido | Invalid product code | Use 01010101 for general items |
400 - Subtotal no coincide | Math mismatch | Subtotal = Total / 1.16, Taxes.Total = Subtotal × 0.16 |