Overview
The Cancel Event endpoint allows you to cancel a previously submitted electronic tax document event. This operation sends a cancellation request via SOAP to the tax authority system and returns the result in JSON format.
Event cancellation is irreversible. Once an event is cancelled, it cannot be restored. Ensure you have the correct CDC (Document Control Code) before proceeding with cancellation.
Use Cases
- Cancel an electronic invoice due to data errors
- Revoke a tax document before it is processed by the recipient
- Correct submission mistakes by cancelling and resubmitting
- Handle customer refund scenarios requiring document cancellation
Authentication
This endpoint requires authentication via headers:
Authentication token for API access
Issuer identifier. If not provided or blank, the system will use the default issuer context.
Request Body
CDC (Código de Control del Documento) - The unique control code of the document to be cancelled. This is a 44-character alphanumeric code assigned when the document was originally submitted.
Reason for cancellation. Provide a clear explanation of why the event is being cancelled. This will be sent to the tax authority and may be visible to the recipient.
Response Fields
Processing date and time when the cancellation was processed by the tax authority system
Result status of the cancellation operation (e.g., “Aprobado”, “Rechazado”)
Authorization protocol number assigned by the tax authority for this cancellation
Unique identifier assigned to this cancellation transaction
Result code indicating the outcome of the cancellation request
Detailed message describing the result of the cancellation operation
Request Example
curl -X POST https://api.jsifen.com/evento/cancelar \
-H "Content-Type: application/json" \
-H "token: your-auth-token-here" \
-H "Emisor: 80012345-6" \
-d '{
"cdc": "01800123456001001000100012345678901234567890123",
"motivo": "Error en datos del documento - Corrección requerida"
}'
Response Example
Successful Cancellation
{
"fechaProceso": "2026-03-08T14:30:45",
"estadoResultado": "Aprobado",
"protocoloAut": "12345678901234",
"identificador": "9876543210",
"codigoResultado": "0000",
"mensajeResultado": "Evento de cancelación procesado correctamente"
}
Failed Cancellation
{
"fechaProceso": "2026-03-08T14:30:45",
"estadoResultado": "Rechazado",
"protocoloAut": "",
"identificador": "9876543211",
"codigoResultado": "0301",
"mensajeResultado": "CDC no encontrado o ya ha sido cancelado previamente"
}
Error Handling
HTTP 500 - Internal Server Error
If the cancellation process encounters an error, the API returns a 500 status code with an error message:
"Error interno: [error details]"
Common error scenarios:
- Invalid CDC format or CDC not found in the system
- Document has already been cancelled
- SOAP service connection issues
- Authentication or authorization failures
Best Practices
- Verify CDC: Always double-check the CDC before cancelling to avoid cancelling the wrong document
- Provide Clear Reasons: Use descriptive cancellation reasons for audit trail purposes
- Store Protocol Number: Save the
protocoloAut from successful cancellations for your records
- Handle Errors Gracefully: Implement proper error handling for failed cancellation attempts
- Check Status: Always verify the
estadoResultado field to confirm successful cancellation
Additional Notes
- The cancellation request is sent to the tax authority via SOAP protocol
- The response is transformed from SOAP/XML to JSON format for easier integration
- Cancellation requests are synchronous - you will receive immediate confirmation
- Keep the
protocoloAut for compliance and audit purposes