curl --request POST \
--url https://api.example.com/api/invoices/upload \
--header 'Content-Type: application/json' \
--data '
{
"profileId": "<string>"
}
'{
"message": "<string>",
"data": {
"id": "<string>",
"profile_id": "<string>",
"uuid": "<string>",
"fecha": "<string>",
"mes": 123,
"año": 123,
"total": 123,
"subtotal": 123,
"iva": 123,
"iva_amount": 123,
"retencion_iva_amount": 123,
"retencion_isr_amount": 123,
"tipo": {},
"rfc_emisor": "<string>",
"nombre_emisor": "<string>",
"regimen_fiscal_emisor": "<string>",
"rfc_receptor": "<string>",
"nombre_receptor": "<string>",
"regimen_fiscal_receptor": "<string>",
"concepto": "<string>",
"pagos": [
{}
],
"complemento_pago": {},
"validacion": {},
"created_at": "<string>",
"updated_at": "<string>"
},
"validacion": {
"rfcVerificado": true,
"regimenFiscalVerificado": true,
"uuidDuplicado": true,
"advertencias": [
"<string>"
],
"errores": [
"<string>"
],
"valido": true
},
"tipo": {}
}Upload a CFDI XML invoice file
curl --request POST \
--url https://api.example.com/api/invoices/upload \
--header 'Content-Type: application/json' \
--data '
{
"profileId": "<string>"
}
'{
"message": "<string>",
"data": {
"id": "<string>",
"profile_id": "<string>",
"uuid": "<string>",
"fecha": "<string>",
"mes": 123,
"año": 123,
"total": 123,
"subtotal": 123,
"iva": 123,
"iva_amount": 123,
"retencion_iva_amount": 123,
"retencion_isr_amount": 123,
"tipo": {},
"rfc_emisor": "<string>",
"nombre_emisor": "<string>",
"regimen_fiscal_emisor": "<string>",
"rfc_receptor": "<string>",
"nombre_receptor": "<string>",
"regimen_fiscal_receptor": "<string>",
"concepto": "<string>",
"pagos": [
{}
],
"complemento_pago": {},
"validacion": {},
"created_at": "<string>",
"updated_at": "<string>"
},
"validacion": {
"rfcVerificado": true,
"regimenFiscalVerificado": true,
"uuidDuplicado": true,
"advertencias": [
"<string>"
],
"errores": [
"<string>"
],
"valido": true
},
"tipo": {}
}Authorization: Bearer YOUR_ACCESS_TOKEN
Show Invoice
PUE, PPD, or COMPLEMENTO_PAGOShow ValidationState
factura (income) or gasto (expense)curl -X POST "https://api.contafy.com/api/invoices/upload" \
-H "Authorization: Bearer YOUR_ACCESS_TOKEN" \
-F "xml=@invoice.xml" \
-F "profileId=prof_123"
const formData = new FormData();
formData.append('xml', file);
formData.append('profileId', 'prof_123');
const response = await fetch('https://api.contafy.com/api/invoices/upload', {
method: 'POST',
headers: {
'Authorization': 'Bearer YOUR_ACCESS_TOKEN'
},
body: formData
});
const data = await response.json();
{
"message": "Factura procesada exitosamente",
"data": {
"id": "inv_abc123",
"profile_id": "prof_123",
"uuid": "12345678-90AB-CDEF-1234-567890ABCDEF",
"fecha": "2026-03-15T10:30:00Z",
"mes": 3,
"año": 2026,
"total": 11600.00,
"subtotal": 10000.00,
"iva": 16,
"iva_amount": 1600.00,
"tipo": "PUE",
"rfc_emisor": "XAXX010101000",
"nombre_emisor": "Empresa Ejemplo SA de CV",
"regimen_fiscal_emisor": "601",
"rfc_receptor": "BAXX010101000",
"nombre_receptor": "Cliente Ejemplo",
"regimen_fiscal_receptor": "612",
"concepto": "Servicios de consultoría",
"pagos": [],
"complemento_pago": null,
"validacion": {
"rfcVerificado": true,
"regimenFiscalVerificado": true,
"uuidDuplicado": false,
"advertencias": [],
"errores": [],
"valido": true
},
"created_at": "2026-03-15T10:35:00Z",
"updated_at": "2026-03-15T10:35:00Z"
},
"validacion": {
"rfcVerificado": true,
"regimenFiscalVerificado": true,
"uuidDuplicado": false,
"advertencias": [],
"errores": [],
"valido": true
},
"tipo": "factura"
}
{
"error": "Unauthorized",
"message": "Invalid or missing access token"
}
{
"error": "Bad Request",
"message": "Invalid XML file or missing required fields"
}
{
"error": "Conflict",
"message": "Invoice with this UUID already exists",
"validacion": {
"uuidDuplicado": true,
"valido": false
}
}
{
"error": "Unprocessable Entity",
"message": "Invalid CFDI XML format",
"validacion": {
"errores": ["Invalid XML structure"],
"valido": false
}
}
{
"error": "Internal Server Error",
"message": "An unexpected error occurred"
}