---
title: "Mexican invoicing and CFDI infrastructure for developers and AI agents"
description: "Issue invoices, synchronize SAT data, and run Mexican business workflows through REST or MCP using one organization-scoped contract."
language: en
canonical_url: "https://exac.mx/docs/en"
md_url: "https://exac.mx/docs/en.md"
---

# Mexican invoicing and CFDI infrastructure for developers and AI agents

Issue invoices, synchronize SAT data, and run Mexican business workflows through REST or MCP using one organization-scoped contract.

## Production and sandbox

Organization API keys are bound to one environment. Sandbox keys use the operations marked “Production and sandbox” in the API reference against isolated test data. Production-only operations and MCP remain unavailable in sandbox. Credentials are rejected outside their assigned environment.

## Make your first authenticated request

Start with an isolated sandbox organization and a sandbox API key.

### 1. Open the developer console

Open /consola from Exac, select Test, and open API keys for your current workspace.

### 2. Create a sandbox API key

Create a key for Test and copy it once. Exac prepares the isolated environment automatically.

### 3. Verify the sandbox organization

Call GET /v1/organization with the sandbox key against the sandbox server shown in OpenAPI.

### 4. Run a Test workflow

Create a contact and CFDI draft, then create, retrieve, and cancel a test stamp. Sandbox artifacts are not submitted to SAT and have no fiscal validity.

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

## Canonical workflows

Use the same domain intent through REST or MCP. These examples are validated against the runtime contracts; replace example identifiers and credentials with values from your organization.

### Test a CFDI lifecycle in sandbox

Create, stamp, download, and cancel a non-fiscal test CFDI using only sandbox REST operations.

```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"
        }
      }
    }
  ]
}
```

### Configure fiscal access

Set the organization fiscal identity, upload its CSD, and verify readiness before creating CFDIs.

```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"
        ]
      }
    }
  ]
}
```

### Issue and send a production CFDI

Production workflow: create a draft, inspect it, explicitly stamp it with SAT, then send the resulting document.

```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"
        ]
      }
    }
  ]
}
```

### Create a payment complement

Record one or more payments against a PPD invoice. Exac distributes the known invoice taxes across each partial payment.

```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"
        ]
      }
    }
  ]
}
```

### Convert receipts into a CFDI

Create one CFDI draft from selected receipt sales. Stamping remains a separate explicit operation.

```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"
        ]
      }
    }
  ]
}
```

### Find and download a CFDI

Search the CFDI collection with fiscal filters, retrieve a document, and download its PDF or 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"
        ]
      }
    }
  ]
}
```

### Reconcile CFDI status with SAT

Ask SAT for the current status of a stamped CFDI after an asynchronous or uncertain provider result.

```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"
        ]
      }
    }
  ]
}
```

### Synchronize and report fiscal data

Schedule a document sync, then read CFDI aggregates and authoritative declaration totals separately.

```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"
        ]
      }
    }
  ]
}
```

### Record a receivable payment

Record a customer payment and allocate it to open receipt balances with an auditable idempotent operation.

```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"
        ]
      }
    }
  ]
}
```

## The contract is ready to build on

The OpenAPI 3.1 artifact is generated from the same operation ledger as the REST runtime and is checked against generated TypeScript and Python clients.

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

- [Download MCP tool catalog (JSON)](/mcp-tools.json)

- Node and Python generation checks

Complete documentation: https://exac.mx/docs/en.md
Agent documentation index: https://exac.mx/docs/en/llms.txt
