The Spanish version is the authoritative reference. View in Spanish
Cancellation process
The API in Panama offers the option to automate the document cancellation process. To do this, you must use the ChangeDocumentStatus method with the following parameters:
| ChangeDocumentStatus for cancellation (request) | |||
|---|---|---|---|
| Parameter | Type | Description | Allowed values |
| countryDocumentId | String | Country-level tax identifier of the document, also known as CUFE, CLAVE, UUID, ID | See the Country Document ID Structure table |
| Reason | String | Reason for the cancellation | Alphanumeric characters. |
| Status | String | Cancellation code: 4 | Numeric characters |
Request example
The tax identifier (countryDocumentId) in these examples is fictitious; replace it with the real CUFE of the document to cancel.
POST https://developers-sbx.gosocket.net/api/v1/Document/ChangeDocumentStatus
The query parameters sent in the request are:
| Key | Value |
|---|---|
| countryDocumentId | FE0120000000000000-2-2021-5000022023091100000000000000000000000000 |
| Reason | Documento cancelado por monto incorrecto. |
| Status | 4 |
For this method we use the Params tab in Postman.
- Select the method type. In this case, you must select POST.
- Enter the method URL.
- Enter the parameters shown in the table above with their corresponding values.
- Click Send.
If the event is generated successfully, it is then sent to the Tax Authority for validation and acceptance.
Response example
Since this is a synchronous method, the response is received immediately. If the result is successful, the API will respond as follows:
{
"Success": true,
"GlobalDocumentId": "00000000-0000-0000-0000-000000000001",
"CountryDocumentId": "FE0120000000000000-2-2021-5000022023091100000000000000000000000000",
"OtherData": {
"Country": "pa",
"AuthorityTimeStamp": "11/09/2023 15:57:17"
},
"Messages": [],
"ResponseValue": "PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0i ... (base64 XML response from the Tax Authority, abbreviated)",
"Code": null,
"Description": "Evento registrado correctamente, Evento Anulación",
"ErrorException": null
}To correctly interpret the response from the Tax Authority, take the following into account:
| ID | Field | Description | Parent node | Data type | Length | Occ | Remarks |
|---|---|---|---|---|---|---|---|
| GRSch01 | rRetEnviEventoDe | Root | - | - | - | - | Root element |
| GRSch02 | dFecProc | Date and time of processing of the last sent document | GRSch01 | D | 19 | 1-1 | Format: "AAAA-MM-DD-hh:mm:ss-ss:ss" |
| GRSch03 | gResProcEVe | Event Processing Result Group | GRSch01 | G | 1-15 | ||
| GRSch030 | dEstRes | Result Status | GRSch03 | A | 8-30 | 1-1 | Approved Approved with observation Rejected |
| GRSch031 | dProtAut | Transaction number | GRSch03 | N | 10 | 0-1 | Generated for each event record according to dCodRes=0600 |
| GRSch032 | Id | Event identifier | GRSch03 | N | 10 | 1-1 | Corresponds to the Id auto-generated by the issuer to identify the event |
| GRSch033 | gRestProc | Processing Result Group | GRSch03 | G | 1-100 | Limited in production to a maximum of 500 messages without modification of this specification | |
| GRSch034 | deCodRes | Processing result code | GRSch03 | N | 4 | 1-1 | Defined in the corresponding topic of chapter 11 |
| GRSch035 | dMsgRes | Processing result message | GRSch03 | A | 1-255 | 1-1 | Defined in the corresponding topic of chapter 11 |
The record of this request and its acceptance message will be logged in the notes of the document preview in Inbox.

In addition, the XML of the event sent to the Tax Authority will be shown as an attachment.

On the Inbox query screen, the document will be shown with the status Cancelled.

If the result of the submission is NOT successful, the Inbox API will respond with the following error message:
{
"ErrorMessage": null,
"IsValid": false,
"StatusCode": "500",
"StatusDescription": null,
"StatusMessage": " El estado del documento no fue actualizado correctamente",
"XmlBase64Bytes": null,
"XmlBytes": null,
"XmlDocumentKey": null,
"XmlFileName": null,
"ResponseType": null,
"OtherData": null,
"GlobalDocumentId": "00000000-0000-0000-0000-000000000000",
"Timestamp": null,
"Response": null,
"TaxDocument": null
}The record of this request and the error message will be shown in the notes of the document preview within Inbox.

If the document has been previously cancelled, the following response will be shown:
{
"Success": false,
"GlobalDocumentId": "00000000-0000-0000-0000-000000000000",
"CountryDocumentId": null,
"OtherData": null,
"Messages": [
"Regla: Evento no puede ser registrado ya que el documento no se encuentra en estado aprobado."
],
"ResponseValue": null,
"Code": "400",
"Description": "Evento no puede ser registrado ya que el documento no se encuentra en estado aprobado.",
"ErrorException": null
}