Antes de empezar
Asegúrate de tener:- Una cuenta en el sandbox de Facturama
- Tus credenciales (usuario y contraseña)
- Un cliente HTTP (cURL, Postman o el SDK de tu lenguaje)
El payload mínimo
Este es el JSON mínimo para emitir un CFDI de ingreso al público en general: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
}
]
}
Explicación campo por campo
| Campo | Valor | Descripción |
|---|---|---|
NameId | 1 | Nombre que se mostrará en el PDF |
Folio | 100 | Se debe especificar el Folio (atributo para control interno) |
CfdiType | I | Ingreso (factura de venta) |
PaymentForm | 03 | Transferencia electrónica |
PaymentMethod | PUE | Pago en una sola exhibición |
ExpeditionPlace | 78000 | Código postal del emisor |
Receiver.Rfc | XAXX010101000 | RFC genérico para público general |
Receiver.CfdiUse | S01 | Sin efectos fiscales (CFDI 4.0) |
Receiver.FiscalRegime | 616 | Sin obligaciones fiscales |
Items[].ProductCode | 01010101 | Clave SAT genérica |
Items[].IdentificationNumber | ABCD123456 | Número de serie de un producto |
Items[].Description | Estudios de laboratorio | Descripción del concepto (1000 caracteres alfanuméricos) |
Items[].Unit | NO APLICA | Unidad de medida aplicable al producto |
Items[].UnitCode | MTS | Codigo de unidad de medida aplicable al producto |
Items[].UnitPrice | 50.0 | Precio Unitario |
Items[].Quantity | 1 | Cantidad |
Items[].Subtotal | 100 | Subtotal de la operación |
Items[].TaxObject | 02 | Tipo de impuesto |
Items[].Total | 116.0 | Total del concepto |
Items[].Taxes.Total | 16.0 | Total del impuesto |
Items[].Taxes.Name | IVA | Nombre del impuesto |
Items[].Taxes.Base | 100.0 | Base del impuesto |
Items[].Taxes.Rate | .16 | Porcentaje del impuesto |
Items[].Taxes.IsRetention | false | Bandera para diferenciar entre retención y traslado |
Hacer la petición
curl --request POST \
--url https://apisandbox.facturama.mx/3/cfdis \
--header 'Authorization: Basic BASE64_DE_TUS_CREDENCIALES' \
--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
}
]
}'
import requests, base64
creds = base64.b64encode(b"tu_usuario:tu_contraseña").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/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/3/cfdis"
))
.header(
"Authorization",
"Basic BASE64_DE_TUS_CREDENCIALES"
)
.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/3/cfdis";
const headers = {
"Authorization": "Basic BASE64_DE_TUS_CREDENCIALES",
"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 BASE64_DE_TUS_CREDENCIALES"
);
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/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/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 BASE64_DE_TUS_CREDENCIALES'
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
Respuesta exitosa
{
"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": "",
"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||"
}
Complement.TaxStamp.Uuid es el folio fiscal (UUID) que identifica de forma única tu CFDI ante el SAT.
Errores comunes
| Error | Causa | Solución |
|---|---|---|
401 Unauthorized | Credenciales incorrectas | Verifica usuario y contraseña |
El RFC del receptor no es válido | RFC mal formado | Usa XAXX010101000 para público general |
El código postal de expedición no existe | CP inválido | Usa el CP de tu domicilio fiscal real |
La clave de producto no existe | ClaveProdServ inválida | Consulta el catálogo SAT en la API |