GET
/v1/invoices/{id}/previewReturns one XML file of an invoice as text inside JSON, for display. It is not a file download.
Use it to read an invoice that was rejected and so cannot be downloaded. The response has the text and whether the file may be downloaded.
The file is found the same way as on the download: the stored file, or else the syntax rendered from the invoice’s canonical model. DATEV files and PDFs made from the model are not available here.
An invoice that arrived as a PDF is returned with format=original as that PDF itself, unchanged and shown inline, so a screen can show it as it arrived. Viewing it here is not recorded as a download.
Path parameters
- idstring (uuid)Required
Query parameters
- formatstringRequiredOne of
original,ubl,cii,peppol,en16931-ubl,en16931-cii.
Status codes
| Status | Meaning |
|---|---|
200 |
The file as text, or a PDF original as the PDF. |
400 |
The requested format is not text (invalid_query). |
401 |
No usable credential was sent (invalid_credentials). |
404 |
No such invoice exists for this company, or it has no file in that format (unknown_invoice). |
409 |
The requested syntax cannot carry this invoice (conversion_would_be_incomplete), or the invoice data it would be made from is not the data the newest check recorded (invoice_changed_since_check). |
502 |
The engine could not render the requested syntax (engine_unavailable). |
GET
/v1/invoices/{id}/previewExample
curl https://api.certinvo.com/v1/invoices/$INVOICE_ID/preview?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}/preview?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}/preview?format=original",
headers={"Authorization": f"Bearer {os.environ['CERTINVO_API_KEY']}"},
)
print(response.status_code, response.text)200
application/pdf
The body is the file itself (application/pdf).
Success response