Skip to main content

Upload invoice PDFs (with their attachments) for capture

POST 

/v1/source-document

PDF files, or ZIP archives of PDFs, become one source document that is captured straight away (the same path as email intake).

Other files may come along, loose or inside the ZIP: PNG, JPEG, TIFF, GIF, DOCX, XLSX, PPTX, DOC, XLS, CSV, TXT, XML, JSON, EML and MSG. They are kept as attachments of the source document, exactly like the non-PDF attachments of an email: not captured, shown with the source document and attached to every invoice captured from the upload.

file_roles[] sets per file whether it is captured (document) or kept as an attachment. A PDF sent as attachment is kept and never captured, for example a terms-and-conditions PDF next to the invoice PDF. A ZIP takes one role for all its PDFs; its other files are always attachments. At least one PDF must be a document (422 no_processable_file); a non-PDF sent as document answers 422 invalid_file_role naming the file.

Multipart: files (max 20 files of 50 MB) and the fields below. Large files: POST /uploads first, then a JSON body { upload_ids: [...], ...fields }.

Checked before anything is stored: the type comes from the bytes, not the name or declared content type (a PDF is processed whatever content type is declared; Office files are recognised from their contents; macro-enabled Office files, HTML and SVG are not taken). Any other type answers 415 unsupported_file_type, also inside a ZIP, and so does an archive inside the ZIP. ZIPs are opened under limits (200 files, 250 MB, ratio 100, no encryption; 422 zip_rejected). An upload without a PDF answers 422 no_processable_file.

The same files in the same roles from the same API user within 24 hours answer the earlier source document (duplicate: true, nothing processed) unless allow_duplicate=true. Idempotency-Key works on the content: the same key with the same files and fields (roles included) replays the answer, anything else under the key answers 422.

Follow the processing with GET /source-documents/{id}; with a webhook, invoice events arrive as the invoices progress.

Request​

Responses​

Created and queued, or the duplicate