Factura electrónica DGI
Consulta la factura electrónica en la DGI, por CUFE o desde el documento.
Petición
multipart/form-data con un solo campo:
| Campo | Tipo | Descripción |
|---|---|---|
file | archivo | JPEG, PNG, WEBP, GIF o PDF. Máximo 10 MB. Obligatorio. |
curl
curl https://api.istmobot.com/v1/factura \ -H "Authorization: Bearer ib_live_..." \ -F file=@documento.png
JavaScript
const form = new FormData();
form.append("file", fileBlob, "documento.png");
const res = await fetch("https://api.istmobot.com/v1/factura", {
method: "POST",
headers: { Authorization: "Bearer ib_live_..." },
body: form,
});
const { data, meta } = await res.json();Respuesta
200 con data según la tabla y meta (request_id, credits_used, plugin_version, sandbox). Campos ausentes en el documento llegan como null.
| Campo | Tipo | Descripción |
|---|---|---|
cufe | string | Código Único de Factura Electrónica (DGI) |
numero | string | null | |
protocolo | string | null | Protocolo de autorización DGI |
fecha_emision | string | null | ISO 8601, hora de Panamá |
fecha_autorizacion | string | null | ISO 8601, hora de Panamá |
emisor.nombre | string | null | |
emisor.ruc | string | null | |
emisor.dv | string | null | |
emisor.direccion | string | null | |
emisor.telefono | string | null | |
receptor.nombre | string | null | |
receptor.ruc | string | null | |
receptor.dv | string | null | |
receptor.direccion | string | null | |
items[] | array | |
items[].descripcion | string | |
items[].codigo | string | null | Código o referencia de la línea según el emisor |
items[].cantidad | number | |
items[].precio_unitario | number | |
items[].descuento | number | |
items[].itbms | number | Impuesto de la línea |
items[].total | number | |
subtotal | number | null | |
itbms | number | null | |
total | number | null | |
metodo_pago | string | null | |
fuente | "dgi" | Los datos vienen del registro oficial de la DGI, no del papel |
consultado_en | string |
Ejemplo
{ "data": { "cufe": "FE0120000000000-0-000000-0000002026010100000000000000000000000000000000", "numero": "0000001234", "protocolo": "20260000000000000001", "fecha_emision": "2026-09-10T10:15:00-05:00", "fecha_autorizacion": "2026-09-10T10:15:20-05:00", "emisor": { "nombre": "DISTRIBUIDORA ISTMO S.A.", "ruc": "155612345-2-2019", "dv": "45", "direccion": "Vía España, Panamá", "telefono": "300-0000" }, "receptor": { "nombre": "Cliente Ejemplo", "ruc": "8-123-456", "dv": "12", "direccion": "PANAMA" }, "items": [ { "descripcion": "Servicio de consultoría", "codigo": null, "cantidad": 1, "precio_unitario": 100, "descuento": 0, "itbms": 7, "total": 107 } ], "subtotal": 100, "itbms": 7, "total": 107, "metodo_pago": "Crédito", "fuente": "dgi", "consultado_en": "2026-09-17T12:00:00-05:00" }, "meta": { "request_id": "req_3f9c2a", "credits_used": 2, "plugin_version": "2.0.0", "sandbox": false } }
Con una key ib_test_ recibes exactamente este data con credits_used: 0 y sandbox: true.
Errores
401 key inválida · 402 sin créditos · 422 entrada inválida o extracción fallida · 429 rate limit. Formato en Errores.
istmobot