Download an invoice
The electronic invoice as PDF or the XML DIAN validated, for what the firm paid. The download is recorded.
This is the recipe the MCP server gives AI assistants, as is. It is in English because models follow it best that way; the assistant answers you in your language.
An assistant reads it with docs({uri:"docs://recipes/download-an-invoice"})
docs://recipes/download-an-invoice — fetch a DIAN electronic invoice the firm received
Use when the lawyer or their accountant needs the factura electrónica (PDF, or the XML DIAN
validated) for something the firm paid Notificado. Credits themselves:
docs://recipes/top-up-credits. Every download is recorded in the firm's audit log.
1. whoami({})
→ orgId, scopes
scopes lack "billing:read"? Stop: the token cannot read invoices.
skip if you already hold orgId
2. manage_resource({resource:"billing", action:"listMyInvoices", params:{orgId:"<orgId>", limit:50}})
→ invoices newest first: invoice.id, status (queued | issued | rejected), number, cufe,
amountNet, discount, amountIva, amountGross, issuedAt, hasPdf, hasXml
Amounts are COP minor units (centavos): divide by 100 and show them as pesos.
Empty? The firm has no invoice yet — in free mode nothing is billed. Stop.
The lawyer means one by number or date? Match it here; ask if two could be it.
3. status "queued"? DIAN has not issued it yet: say so and stop; minutes to hours are normal.
status "rejected"? Notificado's team fixes and re-issues it; nothing for the firm to do but
check its billing data on https://www.notificado.co/facturacion. Stop.
4. manage_resource({resource:"billing", action:"downloadInvoice", params:{orgId:"<orgId>", invoiceId:"<invoice.id>", format:"pdf"}})
→ filename, contentType, sha256, contentBase64
format is "pdf" or "xml"; the accountant usually needs both — fetch the xml the same way.
X_INVOICE_FILE_NOT_READY? Not issued yet — back to step 3.
Decode contentBase64; its SHA-256 must equal sha256, or discard it and report.
Done when the lawyer has the file(s) and the invoice number.
Tips
- A credit note (nota crédito) is not in listMyInvoices. With the creditNoteId Notificado gave
the lawyer, add creditNoteId:"<creditNote.id>" to step 4's params; without one, they write to
admin@notificado.co.
- The CUFE is what DIAN's own consultation page takes to confirm an invoice.