Download invoice file
The XML or PDF of one invoice or credit note, as a file.
GET https://cotlet.dev/api/v1/facturama/invoices/{invoice_id}/file/download
read
Returns the XML (the legal CFDI) or the PDF of one document as base64 content with its file name. Fails with a not-found error when the ID does not exist.
Parameters
| Name | Type | Description |
|---|---|---|
| invoice_id string required | string | Invoice ID from list_invoices or create_invoice. |
| format enum required | enum | xml or pdf. |
Request
curl "https://cotlet.dev/api/v1/facturama/invoices/Y61TLX-Ls_ZJFqzjanPN1w2/file/download?format=xml" \
-H "Authorization: Bearer $COTLET_API_KEY" result = client.call("facturama", "download_invoice_file", {"invoice_id":"Y61TLX-Ls_ZJFqzjanPN1w2","format":"xml"}) const result = await cotlet.call('facturama', 'download_invoice_file', {"invoice_id":"Y61TLX-Ls_ZJFqzjanPN1w2","format":"xml"}); cotlet call facturama download_invoice_file --data '{"invoice_id":"Y61TLX-Ls_ZJFqzjanPN1w2","format":"xml"}' Example response
{
"invoice_id": "Y61TLX-Ls_ZJFqzjanPN1w2",
"format": "xml",
"file_name": "FAC-101.xml",
"content_base64": "PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz4="
}