Contingency
If the MH doesn’t respond when you issue, Open Factura doesn’t lose the sale: it issues the document
in contingency (deferred model). It responds 202 Accepted with status contingencia.
- The document is already valid: it is signed and has a control number. Deliver it as usual.
- Don’t issue it again.
- It must be transmitted to the MH later, with the contingency event.
Deadlines (Normativa 2.0, rule 13.2)
Section titled “Deadlines (Normativa 2.0, rule 13.2)”| Step | Deadline |
|---|---|
| Retry the connection to the MH | At least every 15 minutes |
| Transmit the contingency event | 24 hours after the cause ends |
| Transmit the documents | 72 hours after the event is stamped |
| Contingency longer than 3 consecutive days | Contingency Technical Report before the event |
In production the server transmits it on its own: it retries every 5 minutes and, once the MH
responds, sends the event and the documents, so the 24- and 72-hour deadlines are met without
intervention. If the contingency lasts more than 3 days, it stops: file the Contingency Technical
Report with Hacienda and transmit it yourself. GET /resumen returns contingencia (documentos,
desde, requiereInforme) so you can show it. In the test environment it is not transmitted
automatically.
Transmit manually
Section titled “Transmit manually”curl -X POST https://app.openfactura.co/api/v1/contingencia/transmitir \ -H "Authorization: Bearer $OPENFACTURA_API_KEY"openfactura contingencia transmitirOpen Contingency in the dashboard and transmit the pending documents.
It requires the dte:invalidate permission and the responsible person (responsable) configured
in the issuer’s details. Open Factura sends the contingency event with up to 40 documents from the
active environment and then transmits each one. The response:
{ "evento": { "id": "…", "codigoGeneracion": "…" }, "procesados": [], "rechazados": [], "restantes": 0 }procesados: documents that received a stamp.rechazados: documents the MH rejected.restantes: if greater than 0, call again.- If the MH goes down again, whatever is left stays in contingency for the next attempt.
- If the MH rejects the event:
422 contingencia_rechazadawithdetails.mh.
Contingency is not an uncertain issuance
Section titled “Contingency is not an uncertain issuance”| Situation | Code / status | What to do |
|---|---|---|
| The MH didn’t respond | 202, status contingencia |
Deliver the document; in production the contingency is transmitted automatically. |
| Unknown outcome | 502 emision_incierta, pendiente |
Don’t issue another one. Query GET /dte/{details.codigoGeneracion}; the server reconciles it with the MH on its own every few minutes. |
| The MH was unavailable before signing | 502 mh_no_disponible |
No control number was consumed: retry with the same Idempotency-Key. |
For AI assistants: llms.txt ·llms-full.txt ·every page as Markdown by adding .md to its path.