This service facilitates the cancellation of invoices through various available methods. It is crucial to note that, for cancellations in the testing environment, the use of test CSDs (Digital Seal Certificate) designated by the SAT (Tax Administration Service) is mandatory.
Before initiating the cancellation process, it is highly recommended to perform the following technical checks.
Firstly, verify the current status of the invoice to ensure it is eligible for cancellation. Secondly, conduct a thorough review of the associated CFDIs (Digital Fiscal Invoices over the Internet) to identify any dependencies or linked transactions.
These pre-cancellation steps are crucial to ensuring a seamless and error-free cancellation process.
🛠Test URL : https://services.test.sw.com.mx
🧰 Production URL : https://services.sw.com.mx
Cancellation by UUID
Cancellation method by UUID, for this method it is essential to previously upload the issuer’s certificates to the account
Endpoint
Method | Path |
---|---|
POST | /cfdi33/cancel/{rfc}/{uuid}/{motivo}/{folioSustitucion} |
Authentication and Headers
Header | Value |
---|---|
Authorization | Bearer Token |
Path Parameters
Property | Use | Description |
---|---|---|
rfc | Required | Tax ID (RFC) of the issuer |
uuid | Required | UUID of the CFDI to cancel |
motivo | Required | Key to express the reason for cancellation |
folioSustitucion | Optional | UUID of the CFDI replacing the previous one |
Example Request
curl --request POST \ --url https://services.test.sw.com.mx/cfdi33/cancel/EKU9003173C9/f7392818-aca8-44b0-9942-120d862a71ea/02 \ --header 'Authorization: Bearer $token'
{ "data": { "acuse": "<!--?xml version=\"1.0\" encoding=\"utf-8\"?--><acuse xmlns:xsd="\"http://www.w3.org/2001/XMLSchema\"" xmlns:xsi="\"http://www.w3.org/2001/XMLSchema-instance\"" fecha="\"2022-06-10T02:49:35.7057854\"" rfcemisor="\"EKU9003173C9\""><folios xmlns="\"http://cancelacfd.sat.gob.mx\""><uuid>FE4E71B0-8959-4FB9-8091-F5AC4FB0FEF8</uuid><estatusuuid>202</estatusuuid></folios><signature id="\"SelloSAT\"" xmlns="\"http://www.w3.org/2000/09/xmldsig#\""><signedinfo><canonicalizationmethod algorithm="\"http://www.w3.org/TR/2001/REC-xml-c14n-20010315\""><signaturemethod algorithm="\"http://www.w3.org/2001/04/xmldsig-more#hmac-sha512\""><reference uri="\"\""><transforms><transform algorithm="\"http://www.w3.org/TR/1999/REC-xpath-19991116\""><xpath>not(ancestor-or-self::*[local-name()='Signature'])</xpath></transform></transforms><digestmethod algorithm="\"http://www.w3.org/2001/04/xmlenc#sha512\""><digestvalue>yQdDpQmr8EW3PvHBdGDiOfcO4hF3gXApv9ggW+x8pGb0Ox1inycuKKBo46RBozt8oWat4g2jLQEak2PyS/JbEg==</digestvalue></digestmethod></reference></signaturemethod></canonicalizationmethod></signedinfo><signaturevalue>xAzJW9WdeFYkxR7+NQXGCgRoGCFbnUMN4aQ81OIa6Nh/NfuRStIhA8s5V4amtaNimYNR3v6PKAOUjCDVxxnVMw==</signaturevalue><keyinfo><keyname>BF66E582888CC845</keyname><keyvalue><rsakeyvalue><modulus>n5YsGT0w5Z70ONPbqszhExfJU+KY3Bscftc2jxUn4wxpSjEUhnCuTd88OK5QbDW3Mupoc61jr83lRhUCjchFAmCigpC10rEntTfEU+7qtX8ud/jJJDB1a9lTIB6bhBN//X8IQDjhmHrfKvfen3p7RxLrFoxzWgpwKriuGI5wUlU=</modulus><exponent>AQAB</exponent></rsakeyvalue></keyvalue></keyinfo></signature></acuse>", "uuid": { "FE4E71B0-8959-4FB9-8091-F5AC4FB0FEF8": "201" } }, "status": "success" }
{ "message": "CACFDI33 - Problemas con el xml.", "messageDetail": "CA305 - Certificado Inválido.", "data": null, "status": "error" }
Cancellation by CSD
For our electronic invoice cancellation service, you can use this method if you prefer to include your CSD in the request or if they are not stored in our ADT portal. This streamlined process ensures secure and efficient cancellation.
Endpoint,
Method | Path |
---|---|
POST | /cfdi33/cancel/csd |
Authentication and Headers
Header | Value |
---|---|
Authorization | Bearer Token |
Content-Type | application/json |
JSON Body parameters
Property | Use | Type | Description |
---|---|---|---|
uuid | Required | string | UUID of the CFDI to cancel |
rfc | Required | string | Tax ID (RFC) of the issuer |
motivo | Required | string | Key to express the reason for cancellation |
folioSustitucion | Optional | string | UUID of the CFDI replacing the previous one |
b64Cer | Required | string | Issuer’s certificate in Base64 |
b64Key | Required | string | Issuer’s key in Base64 |
password | Required | string | Certificate password |
Example Request
curl --request POST \ --url https://services.test.sw.com.mx/cfdi33/cancel/csd \ --header 'Authorization: Bearer $token' \ --header 'Content-Type: application/json' \ --data '{ "uuid": "059c8c06-af7e-4c8c-8085-51b631696de5", "password": "12345678a", "rfc": "EKU9003173C9", "motivo": "02", "b64Cer": "$cer", "b64Key": "$key" }'
{ "data": { "acuse": "<!--?xml version=\"1.0\" encoding=\"utf-8\"?--><acuse xmlns:xsd="\"http://www.w3.org/2001/XMLSchema\"" xmlns:xsi="\"http://www.w3.org/2001/XMLSchema-instance\"" fecha="\"2022-09-08T10:42:56.2610824\"" rfcemisor="\"EKU9003173C9\""><folios xmlns="\"http://cancelacfd.sat.gob.mx\""><uuid>24B927FF-E5FA-4662-9BA0-9176A4C218B1</uuid><estatusuuid>202</estatusuuid></folios><signature id="\"SelloSAT\"" xmlns="\"http://www.w3.org/2000/09/xmldsig#\""><signedinfo><canonicalizationmethod algorithm="\"http://www.w3.org/TR/2001/REC-xml-c14n-20010315\""><signaturemethod algorithm="\"http://www.w3.org/2001/04/xmldsig-more#hmac-sha512\""><reference uri="\"\""><transforms><transform algorithm="\"http://www.w3.org/TR/1999/REC-xpath-19991116\""><xpath>not(ancestor-or-self::*[local-name()='Signature'])</xpath></transform></transforms><digestmethod algorithm="\"http://www.w3.org/2001/04/xmlenc#sha512\""><digestvalue>5S+xTQEV6cO8ek7qdG2l3yAcepQ0kvQ9eakdiWDq9/2D6P20O48G6K8AUJ9C55fBVBYoj+sQ87YUF/dpGJZemA==</digestvalue></digestmethod></reference></signaturemethod></canonicalizationmethod></signedinfo><signaturevalue>W8JG7ypQmqfuOtFefK9HQwwI6BQHd9dojGhyo7YmDaG3RRGxMlGozQOJGYEHAR4XSvISKkCRnT9RodEdgnEfFw==</signaturevalue><keyinfo><keyname>BF66E582888CC845</keyname><keyvalue><rsakeyvalue><modulus>n5YsGT0w5Z70ONPbqszhExfJU+KY3Bscftc2jxUn4wxpSjEUhnCuTd88OK5QbDW3Mupoc61jr83lRhUCjchFAmCigpC10rEntTfEU+7qtX8ud/jJJDB1a9lTIB6bhBN//X8IQDjhmHrfKvfen3p7RxLrFoxzWgpwKriuGI5wUlU=</modulus><exponent>AQAB</exponent></rsakeyvalue></keyvalue></keyinfo></signature></acuse>", "uuid": { "24B927FF-E5FA-4662-9BA0-9176A4C218B1": "201" } }, "status": "success" }
{ "message": "CACFDI33 - Problemas con el xml.", "messageDetail": "CA305 - Certificado Inválido.", "data": null, "status": "error" }
Cancellation by PFX
Our electronic invoice cancellation service allows secure and convenient authentication using PFX files, consolidating both the digital certificate and private key into a single password-protected file for an integrated and efficient solution. This service is particularly useful if you haven’t uploaded your CSD to our ADT portal.
Endpoint
Method | Path |
---|---|
POST | /cfdi33/cancel/pfx |
Authentication and Headers
Header | Value |
---|---|
Authorization | Bearer Token |
Content-Type | application/json |
JSON Body parameters
Property | Use | Type | Description |
---|---|---|---|
uuid | Required | string | UUID of the CFDI to cancel |
rfc | Required | string | Tax ID (RFC) of the issuer |
motivo | Required | string | Key to express the reason for cancellation |
folioSustitucion | Optional | string | UUID of the CFDI replacing the previous one |
b64Pfx | Required | string | PFX file in Base64 |
password | Required | string | PFX password |
Example Request
curl --request POST \ --url https://services.test.sw.com.mx/cfdi33/cancel/pfx \ --header 'Authorization: Bearer $token' \ --header 'Content-Type: application/json' \ --data '{ "uuid": "15b0cdf5-7cc6-4f6f-815a-5f101402f185", "password": "12345678a", "rfc": "EKU9003173C9", "motivo": "01", "folioSustitucion":"fe4e71b0-8959-4fb9-8091-f5ac4fb0fef8" "b64Pfx": "$Pfx" }'
{ "data": { "acuse": "<!--?xml version=\"1.0\" encoding=\"utf-8\"?--><acuse xmlns:xsd="\"http://www.w3.org/2001/XMLSchema\"" xmlns:xsi="\"http://www.w3.org/2001/XMLSchema-instance\"" fecha="\"2022-06-10T02:49:35.7057854\"" rfcemisor="\"EKU9003173C9\""><folios xmlns="\"http://cancelacfd.sat.gob.mx\""><uuid>FE4E71B0-8959-4FB9-8091-F5AC4FB0FEF8</uuid><estatusuuid>202</estatusuuid></folios><signature id="\"SelloSAT\"" xmlns="\"http://www.w3.org/2000/09/xmldsig#\""><signedinfo><canonicalizationmethod algorithm="\"http://www.w3.org/TR/2001/REC-xml-c14n-20010315\""><signaturemethod algorithm="\"http://www.w3.org/2001/04/xmldsig-more#hmac-sha512\""><reference uri="\"\""><transforms><transform algorithm="\"http://www.w3.org/TR/1999/REC-xpath-19991116\""><xpath>not(ancestor-or-self::*[local-name()='Signature'])</xpath></transform></transforms><digestmethod algorithm="\"http://www.w3.org/2001/04/xmlenc#sha512\""><digestvalue>yQdDpQmr8EW3PvHBdGDiOfcO4hF3gXApv9ggW+x8pGb0Ox1inycuKKBo46RBozt8oWat4g2jLQEak2PyS/JbEg==</digestvalue></digestmethod></reference></signaturemethod></canonicalizationmethod></signedinfo><signaturevalue>xAzJW9WdeFYkxR7+NQXGCgRoGCFbnUMN4aQ81OIa6Nh/NfuRStIhA8s5V4amtaNimYNR3v6PKAOUjCDVxxnVMw==</signaturevalue><keyinfo><keyname>BF66E582888CC845</keyname><keyvalue><rsakeyvalue><modulus>n5YsGT0w5Z70ONPbqszhExfJU+KY3Bscftc2jxUn4wxpSjEUhnCuTd88OK5QbDW3Mupoc61jr83lRhUCjchFAmCigpC10rEntTfEU+7qtX8ud/jJJDB1a9lTIB6bhBN//X8IQDjhmHrfKvfen3p7RxLrFoxzWgpwKriuGI5wUlU=</modulus><exponent>AQAB</exponent></rsakeyvalue></keyvalue></keyinfo></signature></acuse>", "uuid": { "FE4E71B0-8959-4FB9-8091-F5AC4FB0FEF8": "201" } }, "status": "success" }
{ "message": "CACFDI33 - Problemas con el xml.", "messageDetail": "CA305 - Certificado Inválido.", "data": null, "status": "error" }
? Supporting articles:
Cancellation by XML
Service for canceling by sending an XML with the information and folios of the invoices to be canceled. This method can be used for mass cancellation of CFDI.
Endpoint
Method | Path |
---|---|
POST | /cfdi33/cancel/xml |
Authentication and Headers
Header | Value |
---|---|
Authorization | Bearer Token |
Content-Type | multipart/form-data |
Form Parameters
Property | Use | Description |
---|---|---|
xml | Required | XML structured according to the Anexo 20 (Technical Documentation page 62, on the official SAT portal), containing information about the invoices to be canceled. |
Example Request
curl --request POST \ --url http://services.test.sw.com.mx/cfdi33/cancel/xml \ --header 'Authorization: Bearer $token' \ --header 'Content-Type: multipart/form-data; boundary=---011000010111000001101001' \ --form 'xml=@C:\Users\SW sapien\cancelacionMasiva.xml'
{ "data": { "acuse": "<!--?xml version=\"1.0\" encoding=\"utf-8\"?--><acuse xmlns:xsd="\"http://www.w3.org/2001/XMLSchema\"" xmlns:xsi="\"http://www.w3.org/2001/XMLSchema-instance\"" fecha="\"2022-06-10T02:49:35.7057854\"" rfcemisor="\"EKU9003173C9\""><folios xmlns="\"http://cancelacfd.sat.gob.mx\""><uuid>FE4E71B0-8959-4FB9-8091-F5AC4FB0FEF8</uuid><estatusuuid>202</estatusuuid></folios><signature id="\"SelloSAT\"" xmlns="\"http://www.w3.org/2000/09/xmldsig#\""><signedinfo><canonicalizationmethod algorithm="\"http://www.w3.org/TR/2001/REC-xml-c14n-20010315\""><signaturemethod algorithm="\"http://www.w3.org/2001/04/xmldsig-more#hmac-sha512\""><reference uri="\"\""><transforms><transform algorithm="\"http://www.w3.org/TR/1999/REC-xpath-19991116\""><xpath>not(ancestor-or-self::*[local-name()='Signature'])</xpath></transform></transforms><digestmethod algorithm="\"http://www.w3.org/2001/04/xmlenc#sha512\""><digestvalue>yQdDpQmr8EW3PvHBdGDiOfcO4hF3gXApv9ggW+x8pGb0Ox1inycuKKBo46RBozt8oWat4g2jLQEak2PyS/JbEg==</digestvalue></digestmethod></reference></signaturemethod></canonicalizationmethod></signedinfo><signaturevalue>xAzJW9WdeFYkxR7+NQXGCgRoGCFbnUMN4aQ81OIa6Nh/NfuRStIhA8s5V4amtaNimYNR3v6PKAOUjCDVxxnVMw==</signaturevalue><keyinfo><keyname>BF66E582888CC845</keyname><keyvalue><rsakeyvalue><modulus>n5YsGT0w5Z70ONPbqszhExfJU+KY3Bscftc2jxUn4wxpSjEUhnCuTd88OK5QbDW3Mupoc61jr83lRhUCjchFAmCigpC10rEntTfEU+7qtX8ud/jJJDB1a9lTIB6bhBN//X8IQDjhmHrfKvfen3p7RxLrFoxzWgpwKriuGI5wUlU=</modulus><exponent>AQAB</exponent></rsakeyvalue></keyvalue></keyinfo></signature></acuse>", "uuid": { "FE4E71B0-8959-4FB9-8091-F5AC4FB0FEF8": "201" } }, "status": "success" }
{ "message": "CACFDI33 - Problemas con el xml.", "messageDetail": "CA305 - Certificado Inválido.", "data": null, "status": "error" }
Cancellation responses
All cancellation responses return the same structure in case of an error or a successful request, which are as follows:
Successful response
{ "data": { "acuse": "<?xml version=\"1.0\" encoding=\"utf-8\"?><Acuse xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" Fecha=\"2017-06-27T11:00:54.8788503\" RfcEmisor=\"LAN7008173R5\"><Folios xmlns=\"http://cancelacfd.sat.gob.mx\"><UUID>3EAEABC9-EA41-4627-9609-C6856B78E2B1</UUID><EstatusUUID>202</EstatusUUID></Folios><Signature Id=\"SelloSAT\" xmlns=\"http://www.w3.org/2000/09/xmldsig#\"><SignedInfo><CanonicalizationMethod Algorithm=\"http://www.w3.org/TR/2001/REC-xml-c14n-20010315\" /><SignatureMethod Algorithm=\"http://www.w3.org/2001/04/xmldsig-more#hmac-sha512\" /><Reference URI=\"\"><Transforms><Transform Algorithm=\"http://www.w3.org/TR/1999/REC-xpath-19991116\"><XPath>not(ancestor-or-self::*[local-name()='Signature'])</XPath></Transform></Transforms><DigestMethod Algorithm=\"http://www.w3.org/2001/04/xmlenc#sha512\" /><DigestValue>yoO1MKUhUcokwUgyKt5GJbcXvSzZhMKOp2pGhtuwBVrk35Y8HW8s6gJ04liSamflJFNWwUzaFOIf7KpS0SKkaw==</DigestValue></Reference></SignedInfo><SignatureValue>7ZKbUqUVSXkd9Xo9Dm4xOzrqd+j8v3NQWH8HeIPH+opnTOTGNSlVu+a2cqKKB7vmbt2ZTyfsaNsZ+d7up0zEIw==</SignatureValue><KeyInfo><KeyName>00001088888810000001</KeyName><KeyValue><RSAKeyValue><Modulus>vAr6QLmcvW6auTg7a+Ogm0veNvqJ30rD3j0iSAHxGzGVrg1d0xl0Fj5l+JX9EivD+qhkSY7pfLnJoObLpQ3GGZZOOihJVS2tbJDmnn9TW8fKUOVg+jGhcnpCHaUPq/Poj8I2OVb3g7hiaREORm6tLtzOIjkOv9INXxIpRMx54cw46D5F1+0M7ECEVO8Jg+3yoI6OvDNBH+jABsj7SutmSnL1Tov/omIlSWausdbXqykcl10BLu2XiQAc6KLnl0+Ntzxoxk+dPUSdRyR7f3Vls6yUlK/+C/4FacbR+fszT0XIaJNWkHaTOoqz76Ax9XgTv9UuT67j7rdTVzTvAN363w==</Modulus><Exponent>AQAB</Exponent></RSAKeyValue></KeyValue></KeyInfo></Signature></Acuse>", "uuid": { "3EAEABC9-EA41-4627-9609-C6856B78E2B1": "202" } }, "status": "success" }
In this case, a JSON message is received, which contains the following data:
- Acuse: XML of the acknowledgment returned by SAT. It is considered a successful cancellation request; however, this does not guarantee its cancellation.
- UUID: UUID of the request and its status..
Unsuccessful responses
{ "message": "CASD - Acuse sin descripción específica.", "messageDetail": "El uuid proporcionado es inválido. Favor de verificar.", "data": null, "status": "error" }
{ "message": "CACFDI33 - Problemas con los campos.", "messageDetail": "El certificado no pertenece a la llave privada.", "data": null, "status": "error" }
{ "message": "CASD - Acuse sin descripción específica.", "messageDetail": "El Rfc proporcionado es inválido. Favor de verificar.", "data": null, "status": "error" }
{ "message": "CASD - Acuse sin descripción específica.", "messageDetail": "Invalid length for a Base-64 char array or string.", "data": null, "status": "error" }
{ "message": "CASD - Acuse sin descripción específica.", "messageDetail": "El uuid proporcionado es inválido. Favor de verificar.", "data": null, "status": "error" }
{ "message": "CACFDI33 - Problemas con los CSD.", "messageDetail": "Error con los CSD. Error: Cannot Read PFX......", "data": null, "status": "error" }
{ "message": "CASD - Acuse sin descripción específica.", "messageDetail": "El Rfc proporcionado es inválido. Favor de verificar.", "data": null, "status": "error" }
{ "message": "CASD - Acuse sin descripción específica.", "messageDetail": "Invalid length for a Base-64 char array or string.", "data": null, "status": "error" }
{ "message": "CACFDI33", "messageDetail": "El UUID proporcionado es invalido. Favor de verificar.", "data": null, "status": "error" }
{ "message": "CACFDI33", "messageDetail": "El Rfc proporcionado es invalido. Favor de verificar.", "data": null, "status": "error" }
{ "message": "CACFDI33 - Problemas con el xml.", "messageDetail": "CA305 - La fecha de emisión no esta dentro de la vigencia del CSD del Emisor.", "data": null, "status": "error" }
{ "message": "CACFDI33 - Problemas con el xml.", "messageDetail": "CA302 - Sello mal formado o inválido.", "data": null, "status": "error" }
Response codes for cancellation folios
Code
|
Message
|
Description
|
---|---|---|
201 |
Solicitud de cancelación exitosa | It is considered a successful cancellation request; however, this does not guarantee its cancellation. |
202 |
Folio Fiscal Previamente Cancelado | It is considered a previously submitted cancellation request. Status: Canceled with the SAT. |
203 |
Folio Fiscal No Correspondiente al Emisor | |
204 |
Folio Fiscal No Aplicable a Cancelación | |
205 |
Folio Fiscal No Existente | The SAT grants a 48-hour extension for the invoice to appear with a Valid status after being sent by the CFDI Certification Provider. It is possible that some invoices may not appear immediately; it is necessary to wait for at least 48 hours. |
206 |
UUID no corresponde a un CFDI del Sector Primario | |
207 |
No se especificó el motivo de cancelación o el motivo no es valido | The replacement UUID does not exist, is canceled, or has an issuance date earlier than the issuance date of the original invoice. |
208 |
Folio Sustitución invalido | |
209 |
Folio Sustitución no requerido | |
210 |
La fecha de solicitud de cancelación es mayor a la fecha de declaración | . |
211 |
La fecha de solicitud de cancelación límite para factura global | |
212 |
Relación no valida o inexistente | |
300 |
Usuario No Válido | |
301 |
XML Mal Formado | This error code is returned when the request contains invalid information, for example: an invalid recipient RFC. |
302 |
Sello Mal Formado | |
304 |
Certificado Revocado o Caduco | The certificate can be invalid for multiple reasons such as type, validity, etc. |
305 |
Certificado Inválido | The certificate can be invalid for multiple reasons such as type, validity, etc. |
309 |
Certificado Inválido | The certificate can be invalid for multiple reasons such as type, validity, etc. |
310 |
CSD Inválido | |
311 |
Motivo inválido | Invalid cancellation reason code. |
312 |
UUID no relacionado | Unrelated UUID according to the cancellation reason code. |
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.