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

Parameters: download_invoice_file
NameTypeDescription
invoice_id string required string Invoice ID from list_invoices or create_invoice.
format enum required enum xml or pdf.

Request

cURL
curl "https://cotlet.dev/api/v1/facturama/invoices/Y61TLX-Ls_ZJFqzjanPN1w2/file/download?format=xml" \
  -H "Authorization: Bearer $COTLET_API_KEY"
Python
result = client.call("facturama", "download_invoice_file", {"invoice_id":"Y61TLX-Ls_ZJFqzjanPN1w2","format":"xml"})
Node.js
const result = await cotlet.call('facturama', 'download_invoice_file', {"invoice_id":"Y61TLX-Ls_ZJFqzjanPN1w2","format":"xml"});
CLI
cotlet call facturama download_invoice_file --data '{"invoice_id":"Y61TLX-Ls_ZJFqzjanPN1w2","format":"xml"}'

Example response

JSON

{
  "invoice_id": "Y61TLX-Ls_ZJFqzjanPN1w2",
  "format": "xml",
  "file_name": "FAC-101.xml",
  "content_base64": "PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz4="
}

Sign in once. Your agent does the rest.

Sign up and add the apps you need. Free 7-day trial with 2,000 credits, no card needed.