/v1/drafts/from-fileReads one invoice file and saves it as a new draft, which the console’s create form continues. Nothing is filed. An XRechnung, UBL, CII or ZUGFeRD file is read by the same reader that reads a received invoice, and the draft holds the canonical invoice it makes. settings.openedFrom.verdict is the validator’s verdict on the file as it arrived. A PDF with no invoice inside is read through this company’s one PDF mapping, on our servers. settings.openedFrom.read is then pdf, and every field needs a check. Our own canonical JSON is saved as it is. A customer’s own export (CSV, XLSX, JSON, XML, SAP IDoc, EDIFACT) is read through a saved mapping: the one mappingVersion names, or the one of this company’s mappings that reads the file. settings.openedFrom.read is then mapped, with the mapping’s version. An export of more than one invoice is refused (unreadable_file) naming how many; make them as serial invoices or send the file through the mapping.
Request body
application/json, required
- namestring
The file's name
- datastring (byte)Required
The file as base64, at most 10 MB decoded.
- kindstringOne of
invoice,quote,proforma. - mappingVersionstring
Optional. The saved mapping to read a customer's export or a PDF's page with. Without it, the one of this company's mappings that reads the file is used.
Response
A 201 answer carries these fields.
- idstring (uuid)Required
- revisionintegerRequired
Counted up by every save. Send it as If-Match when you save the draft.
- kindstringRequiredOne of
invoice,quote,proforma. - titlestring or nullRequired
The buyer's name and the invoice number, as far as the draft has them.
- originobject or nullRequired
The stored invoice a follow-up was made from. Null for a draft written from scratch.
Show 2 child fields
- invoiceIdstring (uuid)Required
- followUpstringRequiredOne of
copy,correction,credit,next,final.
- createdAtstring (date-time)Required
- updatedAtstring (date-time)Required
- invoiceobjectRequired
- settingsobjectRequired
Status codes
| Status | Meaning |
|---|---|
201 |
The saved draft. settings.openedFrom says how it was read. |
400 |
The body was refused (invalid_draft, invalid_json, invalid_operation for data that is not base64), or the file is not one invoice this door opens (unreadable_file, unreadable_document). A file a mapping cannot fill is refused as a mapped file is (unmappable_payload, config_reads_no_file). Nothing was saved. |
401 |
|
404 |
mappingVersion names no saved mapping of this company (unknown_mapping_config). Nothing was saved. |
409 |
More than one of this company’s mappings reads the file, and they would make different invoices (several_mappings_fit). detail.versions names them and detail.layout the file’s layout; send the file again naming mappingVersion, or answer once for the layout with POST /v1/mappings/layout-choices. Nothing was saved. |
413 |
The file is larger than one document may be (document_too_large, file_too_large_to_read). Nothing was read. |
422 |
No saved mapping of this company reads this export (no_mapping_fits). detail.format is what the file was recognised as, for the Convert page that makes one. Nothing was saved. |
501 |
|
502 |
The engine could not run, so nothing was saved (engine_unavailable). |
/v1/drafts/from-filecurl -X POST https://api.certinvo.com/v1/drafts/from-file \
-H "Authorization: Bearer $CERTINVO_API_KEY" \
-H "Content-Type: application/json" \
--data-binary @body.jsonimport { readFile } from 'node:fs/promises'
const response = await fetch(`https://api.certinvo.com/v1/drafts/from-file`, {
method: 'POST',
headers: {
Authorization: `Bearer ${process.env.CERTINVO_API_KEY}`,
'Content-Type': 'application/json',
},
body: await readFile('body.json'),
})
console.log(response.status, await response.json())import os
import requests
response = requests.post(
"https://api.certinvo.com/v1/drafts/from-file",
headers={"Authorization": f"Bearer {os.environ['CERTINVO_API_KEY']}", "Content-Type": "application/json"},
data=open("body.json", "rb"),
)
print(response.status_code, response.text){
"id": "3f0c2a5e-8d1b-4c7a-9e2f-6b5d4a3c2b1a",
"revision": 0,
"kind": "invoice",
"title": "string",
"origin": {
"invoiceId": "3f0c2a5e-8d1b-4c7a-9e2f-6b5d4a3c2b1a",
"followUp": "copy"
},
"createdAt": "2026-09-17T09:30:00Z",
"updatedAt": "2026-09-17T09:30:00Z",
"invoice": {},
"settings": {}
}