The Spanish version is the authoritative reference. View in Spanish
π¬ Response and error handling
Regardless of the channel (REST or WebSocket), xPOS Core returns a JSON object with two parts: a common core that always appears and an optional subset that depends on the country. Each country's sheet indicates which fields appear and how to interpret them.
This page describes the standard xPOS response, which is JSON and has a fixed structure. If your system needs to receive the response with a different structure β your own XML, a different JSON β that is solved with the custom response, which is a separate mechanism and does not alter anything described here.
Full response exampleβ
This is the full shape of the response: it includes all possible fields. Values appear as null when the country or the operation does not apply them.
{
"transactionId": null,
"message": null,
"custom_response": null,
"error_description": null,
"stage": null,
"number": null,
"docNumber": null,
"output": null,
"signedXml": null,
"input": null,
"barcodeText": null,
"barcodeBase64": null,
"countryIdentificationCode": null,
"statusCode": null,
"statusDescription": null,
"statusMessage": null,
"applicationResponse": null,
"timeGeneration": null,
"timeValidation": null,
"contingencyCode": null
}Core fields (all countries)β
When message is Operation Error (or Operation Successful with an observation in code 200), the stage and error_description fields indicate exactly what happened. See the Error handling section for the integration contract and the full code catalog for the recommended action per stage.
Optional fields by countryβ
Visual code (QR / PDF417)β
Chile uses PDF417 and only returns
barcodeBase64. The rest of the countries use QR and return both fields.
Tax identificationβ
Tax authority echoβ
These fields appear when the tax authority responds synchronously to the submission. Countries with an asynchronous response (Chile, Paraguay) do not return them in the initial response β they are queried later via /api/v1/status.
Contingencyβ
Presence matrix by countryβ
| Field | CL | CO | CR | SV | GT | PA | PE | PY | DO |
|---|---|---|---|---|---|---|---|---|---|
barcodeText | β | β | β | β | β | β | β | β | β |
barcodeBase64 | βΒΉ | β | β | β | β | β | βΒ² | β | β |
countryIdentificationCode | β | β | β | β | β | β | β | β | β |
statusCode / statusDescription / statusMessage | β | β | β | β | β | β | βΒ³ | β | β |
applicationResponse | β | β | β | β | β | β | β | β | β |
timeGeneration | β | β | β | β | β | β | β | β | β |
timeValidation | β | β | β | β | β | β | β | β | β |
contingencyCode | β | β | β | β | β | β | β | β | β |
ΒΉ Chile returns barcodeBase64 in PDF417 format (not QR).
Β² In Peru barcodeText is not returned and barcodeBase64 arrives as the literal string "null" (it does not contain a code).
Β³ Peru emits statusCode and statusMessage (read from the SUNAT/OSE CDR), but not statusDescription. It also returns the Peru-specific field series β see the Peru sheet.
Each country sheet includes a response mock with illustrative values. See Communication by country.
π¦ Error handlingβ
xPOS-Core expresses any anomalous result β validation error, tax authority rejection, contingency fallback or scheduled retry β through three core fields of the response: message, stage and error_description. The full catalog of stages lives in xPOS-Core error codes; this section describes the integration contract that the POS must respect to react to each case.
Response contractβ
When an operation does not end in success, xPOS populates the three fields like this:
Example of an error response: see the Response β Error tab at the top of this page.
Stage code vs. HTTP statusβ
The stage code (200 / 400 / 404 / 503 / 510) that appears in the catalog is an internal operational label, not the HTTP status returned by the REST API. xPOS-Core delivers it inside the response body; the transport's HTTP status follows the standard API rules.
What the POS has to doβ
Each row of the catalog carries a suggested action that the POS should adopt as a contract:
| Action | POS decision |
|---|---|
| Correct and retry | The input is responsible. Correct the data indicated by error_description and resend POST /api/v1/process-documents. |
| Retry | Transient error (network, token, temporary validation). Resend as is. |
| Reload and retry | The xPOS local state is not healthy (folios, certificates, templates). Call PUT /api/v1/reobtain-config and resend. |
| Correct | Review the case without resending automatically (the tax authority already responded and leaves the action to the operator). |
| End of process | No POS action required (duplicate document, automatic retry scheduled in xPOS, or manual escalation to Gosocket). |
When the POS loses the responseβ
If the network was cut or the POS restarted before processing the response, there is no need to resend the document: the GET /api/v1/status endpoint retrieves the original response from the transactionId or the docNumber β see Status re-retrieval. For deeper diagnosis (audit, escalation), the operational logs at GET /api/v1/db-data/logs are filtered by uuid or free metadata.