---
title: "Cancel sales receipt"
description: "Cancel an open receipt while preserving its operational history."
language: en
canonical_url: "https://exac.mx/docs/en/mcp/tools/cancel_sales_receipt"
md_url: "https://exac.mx/docs/en/mcp/tools/cancel_sales_receipt.md"
---

# Cancel sales receipt

Cancel an open receipt while preserving its operational history.

Tool: `cancel_sales_receipt`

## Purpose

Cancel an open sales receipt while preserving operational history.

### Use when

An open receipt should no longer be usable.

### Do not use when

The receipt has already been invoiced or should be refunded.

| Detail | Value |
| --- | --- |
| Permissions | receipts:cancel |
| Side effects | Destructive |
| Idempotency | Idempotent |

## Input schema

```json
{
  "type": "object",
  "properties": {
    "documentRef": {
      "type": "string",
      "pattern": "^sales_receipt:.+$"
    },
    "idempotencyKey": {
      "type": "string",
      "minLength": 1,
      "maxLength": 200,
      "description": "Unique retry key for this exact operation. Reuse it only when retrying the same request."
    }
  },
  "required": [
    "documentRef",
    "idempotencyKey"
  ],
  "$schema": "http://json-schema.org/draft-07/schema#",
  "additionalProperties": false
}
```

## Output schema

```json
{
  "type": "object",
  "properties": {
    "data": {
      "type": "object",
      "properties": {
        "documentRef": {
          "type": "string",
          "pattern": "^sales_receipt:.+$"
        },
        "status": {
          "type": "string",
          "enum": [
            "open",
            "invoiced",
            "global_invoiced",
            "canceled"
          ]
        }
      },
      "required": [
        "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"
      ]
    }
  ]
}
```

## 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.

- [`refund_sales_receipt`](/docs/en/mcp/tools/refund_sales_receipt.md) — **Refund sales receipt**: Register a receipt refund. A refund may create a CFDI credit note; use the returned receipt refund document to follow its lifecycle.

## Related workflow

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

## Equivalent REST operations

- [`POST /v1/sales-receipts/{documentRef}/cancel`](/docs/en/api/documents/sales-receipts/cancel-sales-receipt.md)

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