---
title: "Cancelar documento fiscal"
description: "Solicita al SAT la cancelación de un CFDI o documento de retención timbrado."
language: es-MX
canonical_url: "https://exac.mx/docs/mcp/tools/cancel_fiscal_document"
md_url: "https://exac.mx/docs/mcp/tools/cancel_fiscal_document.md"
---

# Cancelar documento fiscal

Solicita al SAT la cancelación de un CFDI o documento de retención timbrado.

Herramienta: `cancel_fiscal_document`

## Propósito

Solicita al SAT la cancelación de un CFDI o documento de retención timbrado.

### Úsala cuando

Un documento timbrado debe cancelarse con un motivo aceptado.

### No la uses cuando

El documento fiscal sigue en borrador.

| Detalle | Valor |
| --- | --- |
| Permisos | invoices:manage |
| Efectos secundarios | Destructivo y externo |
| Idempotencia | Idempotente |

## Esquema de entrada

```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": {
      "anyOf": [
        {
          "type": "object",
          "properties": {
            "documentRef": {
              "$ref": "#/definitions/__schema0"
            },
            "reason": {
              "$ref": "#/definitions/__schema1"
            },
            "replacementUuid": {
              "$ref": "#/definitions/__schema2"
            },
            "linkedReceiptBehavior": {
              "$ref": "#/definitions/__schema4"
            }
          },
          "required": [
            "documentRef",
            "reason"
          ],
          "additionalProperties": false
        },
        {
          "type": "object",
          "properties": {
            "documentRef": {
              "$ref": "#/definitions/__schema6"
            },
            "reason": {
              "$ref": "#/definitions/__schema1"
            },
            "replacementUuid": {
              "$ref": "#/definitions/__schema2"
            },
            "linkedReceiptBehavior": {
              "$ref": "#/definitions/__schema4"
            }
          },
          "required": [
            "documentRef",
            "reason"
          ],
          "additionalProperties": false
        }
      ]
    }
  },
  "required": [
    "idempotencyKey",
    "input"
  ],
  "$schema": "http://json-schema.org/draft-07/schema#",
  "additionalProperties": false,
  "definitions": {
    "__schema0": {
      "type": "string",
      "pattern": "^cfdi:.+$"
    },
    "__schema1": {
      "type": "string",
      "enum": [
        "01",
        "02",
        "03",
        "04"
      ],
      "description": "SAT cancellation reason code"
    },
    "__schema2": {
      "description": "Required when reason is 01",
      "allOf": [
        {
          "$ref": "#/definitions/__schema3"
        }
      ]
    },
    "__schema3": {
      "type": "string",
      "minLength": 1
    },
    "__schema4": {
      "description": "Required when one or more directly linked receipts exist; applies to all of them",
      "allOf": [
        {
          "$ref": "#/definitions/__schema5"
        }
      ]
    },
    "__schema5": {
      "type": "string",
      "enum": [
        "reopen",
        "cancel"
      ]
    },
    "__schema6": {
      "type": "string",
      "pattern": "^withholding:.+$"
    }
  }
}
```

## Esquema de salida

```json
{
  "type": "object",
  "properties": {
    "data": {
      "type": "object",
      "properties": {
        "pending": {
          "type": "boolean"
        },
        "documentRef": {
          "type": "string",
          "pattern": "^(cfdi|withholding|sales_receipt|quote|expense|declaration|tax_compliance_opinion|sales_receipt_refund):.+$"
        },
        "status": {
          "type": "string",
          "enum": [
            "draft",
            "valid",
            "canceled"
          ]
        }
      },
      "required": [
        "pending",
        "documentRef",
        "status"
      ],
      "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"
      ]
    }
  ]
}
```

## Herramientas relacionadas

- [`get_document`](/docs/mcp/tools/get_document.md) — **Leer documento**: Recupera un documento mediante su documentRef público.

- [`refresh_cfdi_status`](/docs/mcp/tools/refresh_cfdi_status.md) — **Actualizar estado CFDI**: Consulta al SAT el estado actual de un CFDI timbrado y concilia el estado local.

- [`archive_fiscal_document`](/docs/mcp/tools/archive_fiscal_document.md) — **Archivar documento fiscal**: Archiva o restaura un CFDI o documento de retención sin eliminar su historial.

## Flujo relacionado

[Consulta los flujos canónicos en la introducción](/docs.md)

## Operaciones REST equivalentes

- [`POST /v1/cfdis/{documentRef}/cancel`](/docs/api/documents/cfdi/cancel-cfdi.md)

- [`POST /v1/withholdings/{documentRef}/cancel`](/docs/api/documents/withholding-documents/cancel-withholding.md)

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