---
title: "Infraestructura mexicana de facturación y CFDI para desarrolladores y agentes de IA"
description: "Emite facturas, automatiza la descarga masiva de CFDI del SAT y ejecuta flujos de negocio en México mediante REST o MCP con un contrato por organización."
language: es-MX
canonical_url: "https://exac.mx/docs"
md_url: "https://exac.mx/docs.md"
---

# Infraestructura mexicana de facturación y CFDI para desarrolladores y agentes de IA

Emite facturas, automatiza la descarga masiva de CFDI del SAT y ejecuta flujos de negocio en México mediante REST o MCP con un contrato por organización.

## Producción y entorno de prueba

Las API keys de organización pertenecen a un solo entorno. Las claves de prueba usan las operaciones marcadas “Producción y prueba” en la referencia de API contra datos de prueba aislados. Las operaciones exclusivas de producción y MCP no están disponibles en prueba. Las credenciales se rechazan fuera del entorno asignado.

## Haz tu primera solicitud autenticada

Comienza con una organización de prueba aislada y una API key de prueba.

### 1. Abre la consola para desarrolladores

Abre /consola desde Exac, selecciona Prueba y entra a Claves API para tu workspace actual.

### 2. Crea una API key de prueba

Crea una clave para Prueba y cópiala una sola vez. Exac prepara el entorno aislado automáticamente.

### 3. Verifica la organización de prueba

Llama GET /v1/organization con la clave de prueba contra el servidor de prueba mostrado en OpenAPI.

### 4. Ejecuta un flujo Test

Crea un contacto y un borrador CFDI; luego crea, consulta y cancela un timbrado de prueba. Los artefactos de sandbox no se envían al SAT y no tienen validez fiscal.

```bash
curl "https://grateful-squid-667.convex.site/v1/organization" \
  --header "Authorization: Bearer <EXAC_API_KEY>"
```

## Flujos canónicos

Usa la misma intención de dominio mediante REST o MCP. Estos ejemplos se validan contra los contratos de ejecución; reemplaza los identificadores y credenciales de ejemplo con valores de tu organización.

### Prueba el ciclo de un CFDI en sandbox

Crea, timbra, descarga y cancela un CFDI de prueba sin validez fiscal usando únicamente operaciones REST de sandbox.

```json
{
  "steps": [
    {
      "id": "verify-sandbox-organization",
      "rest": {
        "operationId": "getOrganization",
        "method": "GET",
        "path": "/v1/organization",
        "environments": [
          "production",
          "sandbox"
        ]
      }
    },
    {
      "id": "create-sandbox-contact",
      "rest": {
        "operationId": "createContact",
        "method": "POST",
        "path": "/v1/contacts",
        "environments": [
          "production",
          "sandbox"
        ],
        "headers": {
          "Idempotency-Key": "sandbox-create-contact"
        },
        "body": {
          "kind": "customer",
          "legalName": "Estudio Jacaranda",
          "email": "administracion@jacaranda.example"
        }
      }
    },
    {
      "id": "create-sandbox-cfdi",
      "rest": {
        "operationId": "createCfdiDraft",
        "method": "POST",
        "path": "/v1/cfdis",
        "environments": [
          "production",
          "sandbox"
        ],
        "headers": {
          "Idempotency-Key": "sandbox-create-cfdi"
        },
        "body": {
          "customerId": "customer-example",
          "items": [
            {
              "kind": "custom",
              "description": "Consultoría administrativa · julio 2026",
              "quantity": 1,
              "unitPrice": 10000,
              "satProductCode": "84111506",
              "satUnitCode": "E48",
              "taxRate": 0.16,
              "taxability": "standard"
            }
          ],
          "kind": "income",
          "cfdiUse": "G03",
          "payment": {
            "timing": "deferred_or_installments",
            "formCode": "99",
            "conditions": "Crédito a 30 días"
          }
        }
      }
    },
    {
      "id": "stamp-sandbox-cfdi",
      "rest": {
        "operationId": "stampCfdi",
        "method": "POST",
        "path": "/v1/cfdis/cfdi:invoice-example/stamp",
        "environments": [
          "production",
          "sandbox"
        ],
        "headers": {
          "Idempotency-Key": "sandbox-stamp-cfdi"
        },
        "body": {}
      }
    },
    {
      "id": "download-sandbox-pdf",
      "rest": {
        "operationId": "downloadDocumentFile",
        "method": "GET",
        "path": "/v1/documents/cfdi:invoice-example/files/pdf",
        "environments": [
          "production",
          "sandbox"
        ]
      }
    },
    {
      "id": "cancel-sandbox-cfdi",
      "rest": {
        "operationId": "cancelCfdi",
        "method": "POST",
        "path": "/v1/cfdis/cfdi:invoice-example/cancel",
        "environments": [
          "production",
          "sandbox"
        ],
        "headers": {
          "Idempotency-Key": "sandbox-cancel-cfdi"
        },
        "body": {
          "reason": "02"
        }
      }
    }
  ]
}
```

### Configurar acceso fiscal

Configura la identidad fiscal, carga el CSD y verifica la disponibilidad antes de crear CFDI.

```json
{
  "steps": [
    {
      "id": "update-fiscal-settings",
      "rest": {
        "operationId": "updateOrganization",
        "method": "PATCH",
        "path": "/v1/organization",
        "environments": [
          "production"
        ],
        "headers": {
          "Idempotency-Key": "workflow-fiscal-settings"
        },
        "body": {
          "section": "fiscal",
          "legalName": "Empresa Ejemplo SA de CV",
          "rfc": "XAXX010101000",
          "taxSystem": "601",
          "address": {
            "postalCode": "82110"
          }
        }
      },
      "mcp": {
        "tool": "update_organization",
        "arguments": {
          "idempotencyKey": "workflow-fiscal-settings",
          "input": {
            "section": "fiscal",
            "legalName": "Empresa Ejemplo SA de CV",
            "rfc": "XAXX010101000",
            "taxSystem": "601",
            "address": {
              "postalCode": "82110"
            }
          }
        },
        "environments": [
          "production"
        ]
      }
    },
    {
      "id": "upload-csd",
      "rest": {
        "operationId": "uploadCertificate",
        "method": "PUT",
        "path": "/v1/organization/certificates/csd",
        "environments": [
          "production"
        ],
        "headers": {
          "Idempotency-Key": "workflow-upload-csd"
        },
        "body": {
          "certificateBase64": "BASE64_CER",
          "privateKeyBase64": "BASE64_KEY",
          "password": "certificate-password",
          "certificateFileName": "certificate.cer",
          "privateKeyFileName": "private.key"
        }
      }
    },
    {
      "id": "verify-organization",
      "rest": {
        "operationId": "getOrganization",
        "method": "GET",
        "path": "/v1/organization",
        "environments": [
          "production",
          "sandbox"
        ]
      },
      "mcp": {
        "tool": "get_organization",
        "arguments": {},
        "environments": [
          "production"
        ]
      }
    }
  ]
}
```

### Emitir y enviar un CFDI en producción

Flujo de producción: crea un borrador, revísalo, timbra explícitamente ante el SAT y después envía el documento.

```json
{
  "steps": [
    {
      "id": "create-cfdi-draft",
      "rest": {
        "operationId": "createCfdiDraft",
        "method": "POST",
        "path": "/v1/cfdis",
        "environments": [
          "production",
          "sandbox"
        ],
        "headers": {
          "Idempotency-Key": "workflow-create-cfdi"
        },
        "body": {
          "customerId": "customer-example",
          "items": [
            {
              "kind": "custom",
              "description": "Consultoría administrativa · julio 2026",
              "quantity": 1,
              "unitPrice": 10000,
              "satProductCode": "84111506",
              "satUnitCode": "E48",
              "taxRate": 0.16,
              "taxability": "standard"
            }
          ],
          "kind": "income",
          "cfdiUse": "G03",
          "payment": {
            "timing": "deferred_or_installments",
            "formCode": "99",
            "conditions": "Crédito a 30 días"
          }
        }
      },
      "mcp": {
        "tool": "create_cfdi_draft",
        "arguments": {
          "idempotencyKey": "workflow-create-cfdi",
          "input": {
            "customerId": "customer-example",
            "items": [
              {
                "kind": "custom",
                "description": "Consultoría administrativa · julio 2026",
                "quantity": 1,
                "unitPrice": 10000,
                "satProductCode": "84111506",
                "satUnitCode": "E48",
                "taxRate": 0.16,
                "taxability": "standard"
              }
            ],
            "kind": "income",
            "cfdiUse": "G03",
            "payment": {
              "timing": "deferred_or_installments",
              "formCode": "99",
              "conditions": "Crédito a 30 días"
            }
          }
        },
        "environments": [
          "production"
        ]
      }
    },
    {
      "id": "inspect-cfdi-draft",
      "rest": {
        "operationId": "getCfdi",
        "method": "GET",
        "path": "/v1/cfdis/cfdi:invoice-example",
        "environments": [
          "production",
          "sandbox"
        ]
      },
      "mcp": {
        "tool": "get_document",
        "arguments": {
          "documentRef": "cfdi:invoice-example"
        },
        "environments": [
          "production"
        ]
      }
    },
    {
      "id": "preview-cfdi-draft-pdf",
      "rest": {
        "operationId": "downloadDocumentFile",
        "method": "GET",
        "path": "/v1/documents/cfdi:invoice-example/files/preview_pdf",
        "environments": [
          "production",
          "sandbox"
        ]
      },
      "mcp": {
        "tool": "get_document_file",
        "arguments": {
          "documentRef": "cfdi:invoice-example",
          "file": "preview_pdf"
        },
        "environments": [
          "production"
        ]
      }
    },
    {
      "id": "stamp-cfdi",
      "rest": {
        "operationId": "stampCfdi",
        "method": "POST",
        "path": "/v1/cfdis/cfdi:invoice-example/stamp",
        "environments": [
          "production",
          "sandbox"
        ],
        "headers": {
          "Idempotency-Key": "workflow-stamp-cfdi"
        },
        "body": {}
      },
      "mcp": {
        "tool": "stamp_cfdi",
        "arguments": {
          "documentRef": "cfdi:invoice-example",
          "idempotencyKey": "workflow-stamp-cfdi"
        },
        "environments": [
          "production"
        ]
      }
    },
    {
      "id": "send-cfdi",
      "rest": {
        "operationId": "sendDocument",
        "method": "POST",
        "path": "/v1/documents/cfdi:invoice-example/send",
        "environments": [
          "production"
        ],
        "headers": {
          "Idempotency-Key": "workflow-send-cfdi"
        },
        "body": {
          "recipient": "administracion@jacaranda.example"
        }
      },
      "mcp": {
        "tool": "send_document",
        "arguments": {
          "idempotencyKey": "workflow-send-cfdi",
          "input": {
            "documentRef": "cfdi:invoice-example",
            "recipient": "administracion@jacaranda.example"
          }
        },
        "environments": [
          "production"
        ]
      }
    }
  ]
}
```

### Crear un complemento de pago

Registra uno o más pagos de una factura PPD. Exac distribuye los impuestos conocidos de la factura en cada pago parcial.

```json
{
  "steps": [
    {
      "id": "inspect-related-cfdi",
      "rest": {
        "operationId": "getCfdi",
        "method": "GET",
        "path": "/v1/cfdis/cfdi:invoice-example",
        "environments": [
          "production",
          "sandbox"
        ]
      },
      "mcp": {
        "tool": "get_document",
        "arguments": {
          "documentRef": "cfdi:invoice-example"
        },
        "environments": [
          "production"
        ]
      }
    },
    {
      "id": "create-payment-complement-draft",
      "rest": {
        "operationId": "createCfdiDraft",
        "method": "POST",
        "path": "/v1/cfdis",
        "environments": [
          "production",
          "sandbox"
        ],
        "headers": {
          "Idempotency-Key": "workflow-create-payment-complement"
        },
        "body": {
          "kind": "payment_complement",
          "customerId": "customer-example",
          "payment": {
            "formCode": "03",
            "paidLocalDateTime": "2026-07-15T12:00:00",
            "documents": [
              {
                "uuid": "00000000-0000-4000-8000-000000000001",
                "amount": 11600,
                "installment": 1,
                "previousBalance": 11600,
                "taxes": "auto"
              }
            ]
          }
        }
      },
      "mcp": {
        "tool": "create_cfdi_draft",
        "arguments": {
          "idempotencyKey": "workflow-create-payment-complement",
          "input": {
            "kind": "payment_complement",
            "customerId": "customer-example",
            "payment": {
              "formCode": "03",
              "paidLocalDateTime": "2026-07-15T12:00:00",
              "documents": [
                {
                  "uuid": "00000000-0000-4000-8000-000000000001",
                  "amount": 11600,
                  "installment": 1,
                  "previousBalance": 11600,
                  "taxes": "auto"
                }
              ]
            }
          }
        },
        "environments": [
          "production"
        ]
      }
    },
    {
      "id": "inspect-payment-complement-draft",
      "rest": {
        "operationId": "getCfdi",
        "method": "GET",
        "path": "/v1/cfdis/cfdi:payment-example",
        "environments": [
          "production",
          "sandbox"
        ]
      },
      "mcp": {
        "tool": "get_document",
        "arguments": {
          "documentRef": "cfdi:payment-example"
        },
        "environments": [
          "production"
        ]
      }
    },
    {
      "id": "stamp-payment-complement",
      "rest": {
        "operationId": "stampCfdi",
        "method": "POST",
        "path": "/v1/cfdis/cfdi:payment-example/stamp",
        "environments": [
          "production",
          "sandbox"
        ],
        "headers": {
          "Idempotency-Key": "workflow-stamp-payment-complement"
        },
        "body": {}
      },
      "mcp": {
        "tool": "stamp_cfdi",
        "arguments": {
          "documentRef": "cfdi:payment-example",
          "idempotencyKey": "workflow-stamp-payment-complement"
        },
        "environments": [
          "production"
        ]
      }
    }
  ]
}
```

### Convertir recibos en CFDI

Crea un borrador de CFDI a partir de ventas seleccionadas de recibos. El timbrado permanece como una operación explícita separada.

```json
{
  "steps": [
    {
      "id": "create-invoiceable-receipt",
      "rest": {
        "operationId": "createSalesReceipt",
        "method": "POST",
        "path": "/v1/sales-receipts",
        "environments": [
          "production",
          "sandbox"
        ],
        "headers": {
          "Idempotency-Key": "workflow-create-invoiceable-receipt"
        },
        "body": {
          "saleType": "paid",
          "customer": {
            "kind": "stored",
            "customerId": "customer-example"
          },
          "items": [
            {
              "productId": "product-example",
              "description": "Servicio",
              "quantity": 1,
              "unitPrice": 1250
            }
          ],
          "paymentForm": "03",
          "invoiceRequested": true
        }
      },
      "mcp": {
        "tool": "create_sales_receipt",
        "arguments": {
          "idempotencyKey": "workflow-create-invoiceable-receipt",
          "input": {
            "saleType": "paid",
            "customer": {
              "kind": "stored",
              "customerId": "customer-example"
            },
            "items": [
              {
                "productId": "product-example",
                "description": "Servicio",
                "quantity": 1,
                "unitPrice": 1250
              }
            ],
            "paymentForm": "03",
            "invoiceRequested": true
          }
        },
        "environments": [
          "production"
        ]
      }
    },
    {
      "id": "create-cfdi-from-receipts",
      "rest": {
        "operationId": "createCfdiDraftFromSalesReceipts",
        "method": "POST",
        "path": "/v1/cfdis/from-sales-receipts",
        "environments": [
          "production",
          "sandbox"
        ],
        "headers": {
          "Idempotency-Key": "workflow-receipts-to-cfdi"
        },
        "body": {
          "salesReceiptRefs": [
            "sales_receipt:receipt-example"
          ],
          "customer": {
            "kind": "existing",
            "customerId": "customer-example"
          },
          "cfdiUse": "S01"
        }
      },
      "mcp": {
        "tool": "create_cfdi_draft_from_sales_receipts",
        "arguments": {
          "idempotencyKey": "workflow-receipts-to-cfdi",
          "input": {
            "salesReceiptRefs": [
              "sales_receipt:receipt-example"
            ],
            "customer": {
              "kind": "existing",
              "customerId": "customer-example"
            },
            "cfdiUse": "S01"
          }
        },
        "environments": [
          "production"
        ]
      }
    },
    {
      "id": "read-converted-cfdi",
      "rest": {
        "operationId": "getCfdi",
        "method": "GET",
        "path": "/v1/cfdis/cfdi:invoice-example",
        "environments": [
          "production",
          "sandbox"
        ]
      },
      "mcp": {
        "tool": "get_document",
        "arguments": {
          "documentRef": "cfdi:invoice-example"
        },
        "environments": [
          "production"
        ]
      }
    }
  ]
}
```

### Buscar y descargar un CFDI

Busca en la colección de CFDI con filtros fiscales, recupera un documento y descarga su PDF o XML.

```json
{
  "steps": [
    {
      "id": "search-cfdis",
      "rest": {
        "operationId": "listCfdis",
        "method": "GET",
        "path": "/v1/cfdis",
        "environments": [
          "production",
          "sandbox"
        ],
        "query": {
          "kind": "income",
          "status": "valid",
          "dateFrom": "2026-01-01",
          "dateTo": "2026-01-31",
          "limit": 20
        }
      },
      "mcp": {
        "tool": "search_documents",
        "arguments": {
          "input": {
            "category": "cfdi",
            "kind": "income",
            "status": "valid",
            "dateFrom": "2026-01-01",
            "dateTo": "2026-01-31",
            "limit": 20
          }
        },
        "environments": [
          "production"
        ]
      }
    },
    {
      "id": "get-cfdi",
      "rest": {
        "operationId": "getCfdi",
        "method": "GET",
        "path": "/v1/cfdis/cfdi:invoice-example",
        "environments": [
          "production",
          "sandbox"
        ]
      },
      "mcp": {
        "tool": "get_document",
        "arguments": {
          "documentRef": "cfdi:invoice-example"
        },
        "environments": [
          "production"
        ]
      }
    },
    {
      "id": "download-pdf",
      "rest": {
        "operationId": "downloadDocumentFile",
        "method": "GET",
        "path": "/v1/documents/cfdi:invoice-example/files/pdf",
        "environments": [
          "production",
          "sandbox"
        ]
      },
      "mcp": {
        "tool": "get_document_file",
        "arguments": {
          "documentRef": "cfdi:invoice-example",
          "file": "pdf"
        },
        "environments": [
          "production"
        ]
      }
    },
    {
      "id": "download-xml",
      "rest": {
        "operationId": "downloadDocumentFile",
        "method": "GET",
        "path": "/v1/documents/cfdi:invoice-example/files/xml",
        "environments": [
          "production",
          "sandbox"
        ]
      },
      "mcp": {
        "tool": "get_document_file",
        "arguments": {
          "documentRef": "cfdi:invoice-example",
          "file": "xml"
        },
        "environments": [
          "production"
        ]
      }
    }
  ]
}
```

### Conciliar el estado CFDI con el SAT

Consulta al SAT el estado actual de un CFDI timbrado después de un resultado asíncrono o incierto del proveedor.

```json
{
  "steps": [
    {
      "id": "refresh-cfdi-status",
      "rest": {
        "operationId": "refreshCfdiStatus",
        "method": "POST",
        "path": "/v1/cfdis/cfdi:invoice-example/status/refresh",
        "environments": [
          "production"
        ],
        "headers": {
          "Idempotency-Key": "workflow-refresh-cfdi-status"
        },
        "body": {}
      },
      "mcp": {
        "tool": "refresh_cfdi_status",
        "arguments": {
          "documentRef": "cfdi:invoice-example",
          "idempotencyKey": "workflow-refresh-cfdi-status"
        },
        "environments": [
          "production"
        ]
      }
    },
    {
      "id": "read-reconciled-cfdi",
      "rest": {
        "operationId": "getCfdi",
        "method": "GET",
        "path": "/v1/cfdis/cfdi:invoice-example",
        "environments": [
          "production",
          "sandbox"
        ]
      },
      "mcp": {
        "tool": "get_document",
        "arguments": {
          "documentRef": "cfdi:invoice-example"
        },
        "environments": [
          "production"
        ]
      }
    }
  ]
}
```

### Sincronizar y reportar datos fiscales

Programa la descarga masiva de CFDI del SAT mediante la sincronización de documentos y después consulta por separado los agregados CFDI y los totales declarados autorizados.

```json
{
  "steps": [
    {
      "id": "verify-fiel-readiness",
      "rest": {
        "operationId": "getOrganization",
        "method": "GET",
        "path": "/v1/organization",
        "environments": [
          "production",
          "sandbox"
        ]
      },
      "mcp": {
        "tool": "get_organization",
        "arguments": {},
        "environments": [
          "production"
        ]
      }
    },
    {
      "id": "sync-documents",
      "rest": {
        "operationId": "syncTaxData",
        "method": "POST",
        "path": "/v1/tax/sync",
        "environments": [
          "production"
        ],
        "headers": {
          "Idempotency-Key": "workflow-sync-documents"
        },
        "body": {
          "source": "documents",
          "dateFrom": "2026-01-01",
          "dateTo": "2026-01-31",
          "kind": "all"
        }
      },
      "mcp": {
        "tool": "sync_sat_data",
        "arguments": {
          "idempotencyKey": "workflow-sync-documents",
          "input": {
            "source": "documents",
            "dateFrom": "2026-01-01",
            "dateTo": "2026-01-31",
            "kind": "all"
          }
        },
        "environments": [
          "production"
        ]
      }
    },
    {
      "id": "read-cfdi-summary",
      "rest": {
        "operationId": "getCfdiReport",
        "method": "GET",
        "path": "/v1/reports/cfdi",
        "environments": [
          "production",
          "sandbox"
        ],
        "query": {
          "monthFrom": "2026-01",
          "monthTo": "2026-01"
        }
      },
      "mcp": {
        "tool": "get_cfdi_summary",
        "arguments": {
          "monthFrom": "2026-01",
          "monthTo": "2026-01"
        },
        "environments": [
          "production"
        ]
      }
    },
    {
      "id": "read-tax-summary",
      "rest": {
        "operationId": "getTaxReport",
        "method": "GET",
        "path": "/v1/reports/taxes",
        "environments": [
          "production"
        ],
        "query": {
          "fiscalYear": 2026
        }
      },
      "mcp": {
        "tool": "get_tax_summary",
        "arguments": {
          "fiscalYear": 2026
        },
        "environments": [
          "production"
        ]
      }
    }
  ]
}
```

### Registrar un pago por cobrar

Registra un pago de cliente y asígnalo a saldos abiertos de recibos mediante una operación idempotente y auditable.

```json
{
  "steps": [
    {
      "id": "record-payment",
      "rest": {
        "operationId": "createReceivablePayment",
        "method": "POST",
        "path": "/v1/accounts/receivables/customer-example/payments",
        "environments": [
          "production",
          "sandbox"
        ],
        "headers": {
          "Idempotency-Key": "workflow-receivable-payment"
        },
        "body": {
          "allocations": [
            {
              "documentRef": "sales_receipt:receipt-example",
              "amount": 500
            }
          ],
          "paymentForm": "03",
          "notes": "Bank transfer"
        }
      },
      "mcp": {
        "tool": "record_payment",
        "arguments": {
          "idempotencyKey": "workflow-receivable-payment",
          "input": {
            "direction": "received",
            "customerId": "customer-example",
            "allocations": [
              {
                "documentRef": "sales_receipt:receipt-example",
                "amount": 500
              }
            ],
            "paymentForm": "03",
            "notes": "Bank transfer"
          }
        },
        "environments": [
          "production"
        ]
      }
    },
    {
      "id": "read-receivable-account",
      "rest": {
        "operationId": "getReceivableAccount",
        "method": "GET",
        "path": "/v1/accounts/receivables/customer-example",
        "environments": [
          "production",
          "sandbox"
        ]
      },
      "mcp": {
        "tool": "get_accounts",
        "arguments": {
          "input": {
            "operation": "get",
            "kind": "receivable",
            "customerId": "customer-example"
          }
        },
        "environments": [
          "production"
        ]
      }
    }
  ]
}
```

## El contrato está listo para construir

El artefacto OpenAPI 3.1 se genera desde el mismo registro de operaciones que el runtime REST y se verifica contra clientes generados de TypeScript y Python.

- [Descargar OpenAPI 3.1 (JSON)](/openapi.json)

- [Descargar catálogo de herramientas MCP (JSON)](/mcp-tools.json)

- Comprobaciones de generación Node y Python

Documentación completa: https://exac.mx/docs.md
Índice para agentes: https://exac.mx/docs/llms.txt
