Cancellation of Retenciones CFDI

Service that allows the cancellation of Retenciones CFDI (the Mexican withholding and payments-information tax document), including their complements, by sending a signed XML or the issuer’s certificates (CSD or PFX).

✓ Before you start
1 Get a Bearer Token with your SW username and password. We recommend using an infinite token.
2 If you are going to cancel with a PFX and do not have one, use our PFX Certificate Generator.
3 Review the cancellation reasons table below: the motivo field is required in all 3 methods, and folioSustitucion only applies with motivo = "01".
💡 Scope: this method only cancels Retenciones CFDI. To cancel invoices, payment or payroll CFDI, use Cancellation of CFDI.
💡 Important note: in the testing environment only test CSDs can be used; otherwise, the service will return an error. Find them here: valid test CSDs.

Valid values for the motivo field

Required in the CSD and PFX methods. folioSustitucion is only sent when motivo = "01"; for any other value, omit it entirely.

Code
Description
Requires folioSustitucion?
01
Invoice issued with errors with relation
✅ Yes, required
02
Invoice issued with errors, without relation
❌ Do not send
03
The transaction did not take place
❌ Do not send
04
Nominal transaction related to global invoice
❌ Do not send

URLs

Select your active environment. The copy buttons and the code examples below are built with the base URL you choose here.

🔗 Endpoint

All 3 methods return the same response shape — what changes is how you send the cancellation data.

POST
💡 Important note: if you are unfamiliar with the structure of the cancellation XML, watch the following video (in Spanish): How to create a cancellation XML for CFDI and Retenciones? The XML Signing Tool may also be useful.

Request Example


        

Response

The API returns the texts of message and messageDetail in Spanish, so they are shown here exactly as received.


        
💡 Note: status: "success" confirms that the cancellation request was received correctly — not that the document has already been cancelled with the SAT. Always check the code in data.uuid (see the codes table below) to learn the authority’s answer.

📋 Retenciones cancellation folio response codes

The data.uuid field of a 200 response returns one of these codes for each folio sent.

Code
Message
1201
Cancellation request received.
1202
UUID previously cancelled.
1203
UUID does not correspond to the issuer.
1205
UUID does not exist.
1300
Invalid authentication.
1301
Malformed XML.
1302
Invalid folio structure.
1303
Invalid RFC structure.
1304
Invalid date structure.
1305
Certificate does not correspond to the issuer.
1306
Certificate not in force.
1307
Use of e.firma not allowed.
1308
Revoked or expired certificate.
1309
Malformed or invalid signature.
This method does not take path parameters: all the information goes in the XML file.
This method does not take path parameters: all the information goes in the body.
This method does not take path parameters: all the information goes in the body.

In SW® we strive to be the best for You, wich is why your opinion is very important. Please help us by rating this article and leaving your comments.

How useful was this post?

Click on a star to rate it!

We are sorry that this post was not useful for you!

Let us improve this post!

Tell us how we can improve this post?

Updated on octubre 9, 2026

Related Articles