/v1/invoices/{id}/downloadReturns one file of an invoice, chosen with format. Stored files are returned exactly as stored. They are never rebuilt from the canonical model.
Stored files
original: the file exactly as it arrived.source-file: the customer’s file an invoice made through a mapping was read from, exactly as it arrived, once for all the invoices in it. Its sha256 is the invoice’ssourceFile.sha256. None for an invoice made from no file of the customer’s (404).ubl,cii,zugferd-pdf,peppol,en16931-ubl,en16931-cii,factur-x,extended-cii,zugferd-extended: the files the writer produced, as written.canonical: the canonical model read from a received document, stored at filing. It is not a file anyone sent.not-carried: what the reader could not carry into the canonical model.omissions: what the files made for the invoice leave out, as JSON{ uncarriable, omissions }. Invoices filed before 2026-09-17 have none.trace: where each value of an invoice made through a mapping came from, as a JSON list with one entry per value:at(its place in the canonical model),bt(its business term, empty when the model names none) andorigin, which issourcewith thesourcepointer it was read at in the customer’s record,cardfor a constant the mapping sets, orderivedwith a sentencefromsaying what it was worked out from. An invoice nobody mapped, such as canonical JSON sent as it is, has none (404), and so has one filed before 2026-09-29.gate-report,peppol-report,peppol-gate-report: the validation reports.gate-reportis the validator’s HTML report (Prüfbericht).
If you request ubl or cii for a received document that does not carry that syntax, it is rendered from the canonical model. That rendering is not stored.
DATEV files
Built at download time and never stored, because they depend on settings that can change:
datev-ledger: the DATEV invoice data package (application/zip, containing document.xml, the ledger XML and the invoice PDF). It includes the accounts from/v1/datev-settingswhen there are any.datev-extf: the DATEV Buchungsstapel (text/csv, windows-1252). It requires/v1/datev-settings.
An invoice the company sent is booked as revenue. An invoice it received is booked as an expense.
Path parameters
- idstring (uuid)Required
Query parameters
- formatstringRequiredOne of
original,source-file,ubl,cii,zugferd-pdf,canonical,not-carried,gate-report,peppol,peppol-report,peppol-gate-report,en16931-ubl,en16931-cii,factur-x,extended-cii,zugferd-extended,omissions,trace,datev-ledger,datev-extf. - labelstring
Selects one validator report (Prüfbericht) when there are several. Use the
runnamed by a profile of the report, for exampleubl.en16931-xrechnung. Only withformat=gate-report. A document validated under a policy has one report per rulebook and file, and none without a label.
Status codes
| Status | Meaning |
|---|---|
200 |
The file, with the media type it was stored with. |
401 |
No usable credential was sent (invalid_credentials). |
404 |
No such invoice exists for this company, or the invoice has no file in that format (unknown_invoice). Both cases use the same code. |
409 |
The file is held back, or it cannot be made. The file is held back when you created the invoice and its newest verdict is rejected (invoice_rejected), or when it was never validated (invoice_not_validated). Re-check it at /v1/invoices/{id}/validations to resolve the second case. An invoice already sent is decided by the check it was sent with, while that check accepted it, so a later check does not hold its files back. A rulebook decision that waits for a fact, or reaches none, holds nothing back: the file leaves on the validator’s verdict. A stored file is also held back when it is no longer the file the validator graded (invoice_changed_since_check): every check records a hash of the bytes it graded, and a file whose bytes no longer match that hash goes out on no verdict of its own. A PDF is compared by the XML it carries. A re-check grades the stored files, so it resolves this only when the stored file is still valid. A file made at download (a syntax, a PDF, a DATEV file) is held back the same way when the invoice data it would be made from is not the data the newest check recorded. Held back: every file meant for a buyer or a bookkeeper (original, ubl, cii, zugferd-pdf, peppol, en16931-ubl, en16931-cii, factur-x, extended-cii, zugferd-extended, datev-ledger, datev-extf). Always available: the files about the invoice (gate-report, peppol-gate-report, peppol-report, canonical, not-carried, omissions, trace), and the customer’s own file it was made from (source-file). Received invoices are never held back, except the DATEV files of one your settings hold, because the gate rejected it or for its bank account, until a person releases it (invoice_on_hold). A syntax CONVERTED from one is a file we made, so it is decided by its own verdict and not by the received invoice’s. A conversion with no verdict of its own is checked on the exact file built before it leaves, and that answer decides: a refusal is invoice_rejected. A held-back invoice’s XML stays readable as text at /v1/invoices/{id}/preview. The file cannot be made when a syntax or the PDF cannot carry the document (conversion_would_be_incomplete), or when the DATEV settings or the invoice do not allow a DATEV file (datev_export_refused). The message gives the engine’s reason. |
502 |
The engine could not run, so no file was made (engine_unavailable). |
/v1/invoices/{id}/downloadcurl https://api.certinvo.com/v1/invoices/$INVOICE_ID/download?format=original \
-H "Authorization: Bearer $CERTINVO_API_KEY"const invoiceId = '3f0c2a5e-8d1b-4c7a-9e2f-6b5d4a3c2b1a'
const response = await fetch(`https://api.certinvo.com/v1/invoices/${invoiceId}/download?format=original`, {
headers: {
Authorization: `Bearer ${process.env.CERTINVO_API_KEY}`,
},
})
console.log(response.status, await response.json())import os
import requests
invoice_id = "3f0c2a5e-8d1b-4c7a-9e2f-6b5d4a3c2b1a"
response = requests.get(
f"https://api.certinvo.com/v1/invoices/{invoice_id}/download?format=original",
headers={"Authorization": f"Bearer {os.environ['CERTINVO_API_KEY']}"},
)
print(response.status_code, response.text)