---
title: "Create CFDI from sales receipts"
description: "Create a CFDI draft from one or more compatible open sales receipts. Inspect the receipts first; they must match on customer, currency, payment form, and payment timing. This operation never stamps or sends the CFDI."
language: en
canonical_url: "https://exac.mx/docs/en/mcp/tools/create_cfdi_draft_from_sales_receipts"
md_url: "https://exac.mx/docs/en/mcp/tools/create_cfdi_draft_from_sales_receipts.md"
---

# Create CFDI from sales receipts

Create a CFDI draft from one or more compatible open sales receipts. Inspect the receipts first; they must match on customer, currency, payment form, and payment timing. This operation never stamps or sends the CFDI.

Tool: `create_cfdi_draft_from_sales_receipts`

## Purpose

Create a CFDI draft from compatible open sales receipts.

### Use when

One or more receipts are ready to be invoiced together.

### Do not use when

Receipts do not share the required customer, currency, payment, and timing attributes.

| Detail | Value |
| --- | --- |
| Permissions | invoices:manage + receipts:read |
| Side effects | External side effect |
| Idempotency | Idempotent |

## Input schema

```json
{
  "type": "object",
  "properties": {
    "idempotencyKey": {
      "type": "string",
      "minLength": 1,
      "maxLength": 200,
      "description": "Unique retry key for this exact operation. Reuse it only when retrying the same request."
    },
    "input": {
      "type": "object",
      "properties": {
        "salesReceiptRefs": {
          "minItems": 1,
          "type": "array",
          "items": {
            "$ref": "#/definitions/__schema0"
          },
          "description": "One or more open receipt documentRefs from search_documents"
        },
        "customer": {
          "oneOf": [
            {
              "type": "object",
              "properties": {
                "kind": {
                  "type": "string",
                  "const": "existing"
                },
                "customerId": {
                  "type": "string",
                  "minLength": 1
                }
              },
              "required": [
                "kind",
                "customerId"
              ],
              "additionalProperties": false
            },
            {
              "type": "object",
              "properties": {
                "kind": {
                  "type": "string",
                  "const": "public_general"
                }
              },
              "required": [
                "kind"
              ],
              "additionalProperties": false
            }
          ]
        },
        "cfdiUse": {
          "type": "string",
          "enum": [
            "G01",
            "D06",
            "I07",
            "I06",
            "I01",
            "I05",
            "D09",
            "G02",
            "D04",
            "I04",
            "I03",
            "D08",
            "G03",
            "D03",
            "D02",
            "D01",
            "D05",
            "I02",
            "CN01",
            "I08",
            "CP01",
            "D10",
            "D07",
            "S01"
          ],
          "description": "Active SAT CFDI-use code.",
          "x-exac-sat-catalog": "cfdi-uses"
        },
        "acknowledgeReconciliationDifference": {
          "description": "Required only after reviewing a reported fiscal difference",
          "allOf": [
            {
              "$ref": "#/definitions/__schema1"
            }
          ]
        },
        "reconciliationNote": {
          "type": "string",
          "minLength": 1
        },
        "paymentScheduleReplacement": {
          "description": "Required when batching credit receipts that already have operational payment schedules. Replaces them with one acknowledged invoice schedule.",
          "allOf": [
            {
              "$ref": "#/definitions/__schema2"
            }
          ]
        },
        "remediation": {
          "type": "object",
          "properties": {
            "customerFiscalIdentity": {
              "$ref": "#/definitions/__schema3"
            },
            "receiptItems": {
              "$ref": "#/definitions/__schema4"
            }
          },
          "additionalProperties": false,
          "description": "Supply only when validation reports missing customer or item fiscal identity. Use the receipt reference and zero-based item index reported in details.issues."
        }
      },
      "required": [
        "salesReceiptRefs",
        "customer",
        "cfdiUse"
      ],
      "additionalProperties": false
    }
  },
  "required": [
    "idempotencyKey",
    "input"
  ],
  "$schema": "http://json-schema.org/draft-07/schema#",
  "additionalProperties": false,
  "definitions": {
    "__schema0": {
      "type": "string",
      "pattern": "^sales_receipt:.*"
    },
    "__schema1": {
      "type": "boolean"
    },
    "__schema2": {
      "type": "object",
      "properties": {
        "acknowledged": {
          "type": "boolean",
          "const": true
        },
        "settlementTerms": {
          "type": "object",
          "properties": {
            "installmentCount": {
              "type": "integer",
              "minimum": 1,
              "maximum": 60
            },
            "firstDue": {
              "oneOf": [
                {
                  "type": "object",
                  "properties": {
                    "kind": {
                      "type": "string",
                      "const": "transaction_date"
                    }
                  },
                  "required": [
                    "kind"
                  ],
                  "additionalProperties": false
                },
                {
                  "type": "object",
                  "properties": {
                    "kind": {
                      "type": "string",
                      "const": "months_after_transaction"
                    },
                    "months": {
                      "type": "integer",
                      "minimum": 1,
                      "maximum": 60
                    }
                  },
                  "required": [
                    "kind",
                    "months"
                  ],
                  "additionalProperties": false
                },
                {
                  "type": "object",
                  "properties": {
                    "kind": {
                      "type": "string",
                      "const": "fixed_date"
                    },
                    "date": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "kind",
                    "date"
                  ],
                  "additionalProperties": false
                }
              ]
            },
            "recurrence": {
              "oneOf": [
                {
                  "type": "object",
                  "properties": {
                    "kind": {
                      "type": "string",
                      "const": "anchor_day"
                    }
                  },
                  "required": [
                    "kind"
                  ],
                  "additionalProperties": false
                },
                {
                  "type": "object",
                  "properties": {
                    "kind": {
                      "type": "string",
                      "const": "day_of_month"
                    },
                    "day": {
                      "type": "integer",
                      "minimum": 1,
                      "maximum": 31
                    }
                  },
                  "required": [
                    "kind",
                    "day"
                  ],
                  "additionalProperties": false
                },
                {
                  "type": "object",
                  "properties": {
                    "kind": {
                      "type": "string",
                      "const": "last_day"
                    }
                  },
                  "required": [
                    "kind"
                  ],
                  "additionalProperties": false
                }
              ]
            }
          },
          "required": [
            "installmentCount",
            "firstDue",
            "recurrence"
          ],
          "additionalProperties": false
        },
        "reason": {
          "type": "string",
          "minLength": 3,
          "maxLength": 500
        }
      },
      "required": [
        "acknowledged",
        "settlementTerms",
        "reason"
      ],
      "additionalProperties": false
    },
    "__schema3": {
      "type": "object",
      "properties": {
        "rfc": {
          "type": "string",
          "minLength": 1
        },
        "taxSystem": {
          "type": "string",
          "enum": [
            "601",
            "603",
            "605",
            "606",
            "607",
            "608",
            "610",
            "611",
            "612",
            "614",
            "615",
            "616",
            "620",
            "621",
            "622",
            "623",
            "624",
            "625",
            "626"
          ],
          "description": "Active SAT tax-system code.",
          "x-exac-sat-catalog": "tax-systems"
        },
        "postalCode": {
          "type": "string",
          "minLength": 1
        }
      },
      "additionalProperties": false
    },
    "__schema4": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "salesReceiptRef": {
            "type": "string",
            "pattern": "^sales_receipt:.*"
          },
          "items": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "index": {
                  "type": "integer",
                  "minimum": 0,
                  "maximum": 9007199254740991
                },
                "satProductCode": {
                  "type": "string",
                  "minLength": 1
                },
                "satUnitCode": {
                  "type": "string",
                  "minLength": 1
                },
                "saveToProduct": {
                  "type": "boolean"
                }
              },
              "required": [
                "index",
                "satProductCode",
                "satUnitCode"
              ],
              "additionalProperties": false
            }
          }
        },
        "required": [
          "salesReceiptRef",
          "items"
        ],
        "additionalProperties": false
      }
    }
  }
}
```

## Output schema

```json
{
  "type": "object",
  "properties": {
    "data": {
      "type": "object",
      "properties": {
        "cfdi": {
          "type": "object",
          "properties": {
            "documentRef": {
              "type": "string",
              "pattern": "^cfdi:.+$"
            },
            "kind": {
              "type": "string",
              "enum": [
                "income",
                "credit_note",
                "transfer",
                "payroll",
                "payment_complement"
              ]
            },
            "status": {
              "type": "string",
              "const": "draft"
            }
          },
          "required": [
            "documentRef",
            "kind",
            "status"
          ],
          "additionalProperties": false
        },
        "salesReceiptRefs": {
          "type": "array",
          "items": {
            "type": "string",
            "pattern": "^sales_receipt:.+$"
          }
        },
        "reconciliationDifference": {
          "type": "number"
        }
      },
      "required": [
        "cfdi",
        "salesReceiptRefs"
      ],
      "additionalProperties": false
    },
    "error": {
      "$schema": "http://json-schema.org/draft-07/schema#",
      "type": "object",
      "properties": {
        "code": {
          "type": "string",
          "enum": [
            "validation_error",
            "unauthenticated",
            "forbidden",
            "not_found",
            "method_not_allowed",
            "conflict",
            "idempotency_conflict",
            "operation_in_progress",
            "recovery_required",
            "rate_limited",
            "provider_unavailable",
            "internal"
          ]
        },
        "message": {
          "type": "string"
        },
        "details": {
          "type": "object",
          "properties": {
            "issues": {
              "type": "array",
              "items": {
                "type": "object",
                "properties": {
                  "path": {
                    "type": "array",
                    "items": {
                      "anyOf": [
                        {
                          "type": "string"
                        },
                        {
                          "type": "number"
                        }
                      ]
                    }
                  },
                  "message": {
                    "type": "string"
                  },
                  "code": {
                    "type": "string"
                  }
                },
                "required": [
                  "path",
                  "message"
                ],
                "additionalProperties": false
              }
            },
            "retryable": {
              "type": "boolean"
            },
            "retryAfterSeconds": {
              "type": "integer",
              "exclusiveMinimum": 0,
              "maximum": 9007199254740991
            }
          },
          "additionalProperties": false
        }
      },
      "required": [
        "code",
        "message"
      ],
      "additionalProperties": false
    }
  },
  "$schema": "http://json-schema.org/draft-07/schema#",
  "additionalProperties": false,
  "oneOf": [
    {
      "required": [
        "data"
      ]
    },
    {
      "required": [
        "error"
      ]
    }
  ]
}
```

## Related tools

- [`get_document`](/docs/en/mcp/tools/get_document.md) — **Get document**: Retrieve one document by its public documentRef. Sales receipt details include stable lineRef values and remaining refundable amounts for sales receipt refunds.

- [`stamp_cfdi`](/docs/en/mcp/tools/stamp_cfdi.md) — **Stamp CFDI**: Irreversibly stamp an existing CFDI draft. Review the draft first with get_document. Safe retries require reusing the same idempotencyKey.

## Related workflow

[See the canonical workflows in the introduction](/docs/en.md)

## Equivalent REST operations

- [`POST /v1/cfdis/from-sales-receipts`](/docs/en/api/documents/cfdi/create-cfdi-draft-from-sales-receipts.md)

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