Skip to content
Invoicing

FISCALISTO / API

Cancel and replace

How a CFDI is cancelled at SAT, when the customer must accept it and how to correct an invoice with another that replaces it.

Open in ChatGPTOpen in ClaudeOpen in Cursor

A stamped CFDI isn't edited: if it has an error it's cancelled and, if needed, another one is issued that replaces it. Fiscalisto requests the cancellation from SAT with the issuer's CSD.

Cancel

curl https://api.fiscalisto.com/v1/invoices/inv_OufpKqnrvx9p0Nfbydl9jG4UNGeTYcvdrg/cancel \
  -H "Authorization: Bearer $FISCALISTO_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "motive": "02" }'

Right after stamping, SAT doesn't have the invoice on record yet: it takes a few minutes (up to 5 in test mode). If you cancel before that, the API returns 409 cancellation_too_early with Retry-After: 60, without cancelling anything or using timbres: repeat the same request a minute later. If you're cancelling to correct it, better replace it: Fiscalisto retries on its own.

SAT requires one of four reasons (motive):

ReasonWhen
01It has errors and you already issued the one that replaces it: send substitution with its id or UUID. Better use replace.
02It has errors and won't be replaced. It's the one used if you don't send motive.
03The operation didn't take place.
04Only on a global invoice: a sale included in it was later invoiced in the customer's name, so the global is cancelled (and another is issued without that sale). On another invoice it returns cancellation_failed.

When the customer must accept it

If the invoice is over $1,000 and isn't one of SAT's exceptions, the customer has to accept the cancellation in their buzón tributario (SAT inbox). Meanwhile the invoice stays status: "pending", with cancellation.status: "pending", and remains current. Then one of these events arrives:

  • invoice.canceled: they accepted it, or didn't answer within 3 business days and SAT took it as accepted.
  • invoice.cancellation_rejected: they rejected it, or the request expired. You can request it again.

These are cancelled right away, without acceptance: invoices up to $1,000, credit notes, transfers, payroll receipts, invoices to the general public or to a foreigner, and any invoice cancelled no later than the business day after it was issued (rule 2.7.1.35, section IX, of the RMF 2026): one from Friday, until Monday, or Tuesday if Monday is a holiday. Withholding certificates are also cancelled right away. Fiscalisto asks SAT for a few seconds until it sees it cancelled; if SAT takes longer, the response carries cancellation.status: "pending" without the customer having to do anything, and invoice.canceled arrives within minutes.

Diesel and gasoline are the exception (rule 2.7.1.34, third paragraph, of the RMF 2026): an invoice or credit note for them (keys 15101505, 15101514 and 15101515, with the Hidrocarburos y Petrolíferos complement) and an invoice with Carta Porte that carries them always need the customer's express acceptance, whatever the amount or the day. If the customer doesn't answer, the invoice stays current. Only an invoice to the general public or to a foreigner with the generic RFC cancels without acceptance (rule 2.7.1.35, last paragraph).

If you request the cancellation again while waiting for the customer, the API returns the current status without sending another request. With another motive it returns 400 with param: "motive": SAT never changes the motive of a cancellation already requested. If you look up the invoice with ?refresh=true, Fiscalisto asks SAT for its status at that moment.

When Fiscalisto asks again

Sometimes SAT doesn't accept the request yet: it doesn't have the invoice that replaces this one on record (it takes a few minutes), or it briefly rejected its signature. Fiscalisto asks again on its own, and the invoice says so in cancellation, even though it's still current. And if SAT took the request but 3 hours later still doesn't show it (neither «En proceso» nor cancelled), it didn't get there: Fiscalisto asks again with the same reason, up to twice, and the invoice stays pending:

cancellation.statusWhat happens
scheduledFiscalisto asks again on its own. next_attempt_at says when (null: within the next 15 minutes) and error why it didn't go through. invoice.cancellation_pending arrives, then invoice.canceled once SAT cancels it.
failedFiscalisto stopped trying and the invoice is still current; error says why. invoice.cancellation_failed arrives. Request it again with POST /v1/invoices/{id}/cancel, and for a replacement, with reason 01 and the new one in substitution.

With pending, on the other hand, SAT already has the request. If the authorized PAC doesn't answer the request and SAT doesn't show it yet, the response is pending too: the request may have arrived. Fiscalisto asks SAT every 15 minutes; invoice.canceled arrives if SAT cancelled it and, if SAT still doesn't show it 3 hours later, it is requested again as above.

The cancellation receipt

Once SAT cancels the invoice (status: "canceled"), GET /v1/invoices/{id}/cancellation_receipt downloads its acuse de cancelación: the XML signed by SAT that proves it cancelled it and when. Keep it with the invoice for a SAT review or a dispute with the customer.

curl https://api.fiscalisto.com/v1/invoices/inv_OufpKqnrvx9p0Nfbydl9jG4UNGeTYcvdrg/cancellation_receipt \
  -H "Authorization: Bearer $FISCALISTO_API_KEY" \
  -o acuse-cancelacion.xml

Before SAT cancels it (current, or waiting for the customer) it answers 409 with invoice_not_canceled: listen to invoice.canceled and download it then. In the SDKs it's invoices.cancellationReceipt.

Until when it can be cancelled

A CFDI can be cancelled no later than the month in which the annual return for the year it was issued is due (article 29-A of the Código Fiscal): until March 31 of the following year if the issuer is a company (12-character RFC) and until April 30 if it's an individual. After that day, cancelling it returns cancellation_failed and replacing it, invoice_invalid, with the reason and without asking SAT or stamping the new one. If there's an error, correct it with a credit note or with a new CFDI.

What it costs

Cancelling a document uses no timbres, neither the first request nor the ones you repeat after a rejection. The timbre used when stamping it doesn't come back.

Replace

To correct an invoice (another price, another customer regime, another line item), send the full corrected invoice, with the same body as POST /v1/invoices:

curl https://api.fiscalisto.com/v1/invoices/inv_OufpKqnrvx9p0Nfbydl9jG4UNGeTYcvdrg/substitute \
  -H "Authorization: Bearer $FISCALISTO_API_KEY" \
  -H "Idempotency-Key: pedido-A-1042-corregida" \
  -H "Content-Type: application/json" \
  -d '{
    "customer": { "tax_id": "ICV060329BY0", "legal_name": "INMOBILIARIA CVA", "tax_system": "601", "zip": "33826" },
    "payment_form": "03",
    "items": [{ "description": "Mensualidad", "product_key": "86121700", "quantity": 2, "unit_price": 2400 }]
  }'

Fiscalisto stamps the new one related to the previous one (relationship 04) and cancels the previous one with reason 01, in a single call. The response is the new invoice; its substitutes says which one it replaced and whether it's already cancelled, and substitutes.cancellation is the previous one's cancellation as its GET returns it (see when Fiscalisto asks again). If it couldn't be cancelled, substitutes.cancel_error says why. The previous one is cancelled 15 minutes after the new one is stamped: SAT's status service shows it within seconds, but the one that cancels may not have it yet, and SAT then drops the request without a word. Meanwhile substitutes.canceled is false and substitutes.cancellation.status is scheduled. When it's only that SAT doesn't have the new one on record yet (it takes a few minutes), Fiscalisto cancels the previous one again every 15 minutes for 72 hours and the invoice.canceled webhook arrives when it's cancelled. If it's something else, correct it and cancel it with POST /v1/invoices/{id}/cancel with reason 01 and the new one in substitution. If the previous one needs the customer's acceptance, the new one is already stamped and the previous one stays pending until they answer.

Payment complements and credit notes aren't replaced: they're cancelled and another is issued.

Was this page helpful?