The DTE API exposes operations for managing electronic invoices (Documentos Tributarios Electrónicos) sent to El Salvador’s Ministerio de Hacienda. DTEs are generated automatically when a sale is processed, but can be re-sent if the initial submission failed.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/Carlos-Gnd/FERRED-Inventario-y-Ventas/llms.txt
Use this file to discover all available pages before exploring further.
A sale with
estado: "SIMULADO" is a valid, committed sale — it is not a test transaction. SIMULADO means Hacienda’s sandbox was unreachable at the time of submission, not that the invoice is invalid. Use POST /api/dte/:id/reenviar to retry the submission when connectivity is restored.DTE estados
| Estado | Description |
|---|---|
SIMULADO | Hacienda sandbox was unreachable (network timeout or DNS failure). The sale is valid; DTE submission is pending. |
PROCESADO | Hacienda accepted the DTE and returned a selloRecibido. |
ERROR_HACIENDA | Hacienda responded with a 4xx or 5xx error, rejecting the DTE. |
ERROR_INTERNO | A system-level error prevented DTE generation or submission. |
PENDIENTE | The DTE has been queued for retry via POST /api/dte/:id/reenviar. |
GET /api/dte/:id
Returns the current status of a DTE by invoice ID. Roles: ADMIN, CAJEROPath parameters
ID of the
FacturaDte record.Response 200
Invoice ID.
Hacienda control number in the format
DTE-01-{establecimiento}P001-{sequence}. null if not yet generated.UUID assigned to the DTE document.
null if not yet generated.Current DTE state. See the estados table above.
true if Hacienda returned a selloRecibido for this DTE.Errors
| Status | Condition |
|---|---|
| 400 | id is not a valid positive integer. |
| 403 | The authenticated user does not belong to the branch that owns this invoice. |
| 404 | No FacturaDte record found for the given id. |
GET /api/dte/:id/qr
Returns a base64-encoded QR code image for the DTE’s Hacienda public verification URL. Roles: ADMIN, CAJEROPath parameters
ID of the
FacturaDte record. The DTE must already have a codigoGeneracion.Response 200
Base64-encoded PNG data URL of the QR code (200×200 px). Suitable for use directly in an
<img src="..."> tag.Errors
| Status | Condition |
|---|---|
| 404 | Invoice not found. |
| 409 | The invoice does not yet have a codigoGeneracion — send the DTE first. |
POST /api/dte/:id/enviar
Sends the DTE to Hacienda for a specific invoice. This is called automatically after each sale; use this endpoint to trigger a manual send. Roles: ADMIN, CAJEROPath parameters
ID of the
FacturaDte to send.Response
true if Hacienda accepted the DTE (PROCESADO); false on any error.Resulting DTE state after the submission attempt.
Hacienda’s receipt stamp. Only present when
estado is PROCESADO.Base64 QR code generated from the
codigoGeneracion. Present on success.Human-readable error detail. Present when
ok is false.POST /api/dte/:id/reenviar
Resets a DTE’s estado toPENDIENTE and retries the submission to Hacienda. Use this after a SIMULADO, ERROR_HACIENDA, or ERROR_INTERNO to attempt recovery without creating a new sale.
Roles: ADMIN, CAJERO
Path parameters
ID of the
FacturaDte to resend.Response
Same shape asPOST /api/dte/:id/enviar.
true if Hacienda accepted the resubmitted DTE.Final DTE state after the retry.
Hacienda receipt stamp, present when
estado is PROCESADO.Base64 QR code, present on successful resubmission.
Error detail, present when
ok is false.Errors
| Status | Condition |
|---|---|
| 404 | Invoice not found. |
| 502 | The DTE submission was attempted but Hacienda returned an error. |
GET /api/dte/sucursal/:sucursalId
Lists all DTEs for a specific branch, ordered by creation date descending. Supports pagination. Roles: ADMIN, CAJEROPath parameters
ID of the branch whose DTEs you want to list. CAJERO users can only access their own branch.
Query parameters
Maximum number of records to return. Capped at 200.
Number of records to skip for pagination.
Response
Total number of DTEs in the branch (before pagination).
Paginated list of DTE records.