Skip to main content

File Intake

Send a whole file of invoices in one request: tens of thousands of invoices, up to 100 MB, gzip accepted. GoRoute stores the file, reads every line, turns the lines into batches and sends them. You get three receipts as it goes (received, parsed, completed) and, at the end, a status file with one row per line of your file.

Which bulk route?
  • File intake, under /api/v1/files (this page): a file your system writes, read line by line, with a control record. For integrations that send many invoices on a schedule.
  • Import and send a spreadsheet, under /api/v1/invoices/import/csv: a person uploading a CSV or Excel file. See CSV Import.
  • Batch sending, under /api/v1/batches: invoices you hold as JSON, up to a batch at a time. See Batch Sending.

The endpointsโ€‹

Method and pathWhat it does
POST /api/v1/filesUpload a file (multipart). 202 with the received receipt.
GET /api/v1/filesYour files, newest first (status, page, page_size).
GET /api/v1/files/{file_id}One file: status, counts, totals and the batches it became.
GET /api/v1/files/{file_id}/receiptThe three receipts.
GET /api/v1/files/{file_id}/resultsThe status file, ?format=csv (default) or ndjson.
DELETE /api/v1/files/{file_id}Delete a file before processing starts.

Uploading and deleting need the send scope (taking a file in sends its invoices); reading needs read. Files are the batch feature: on a plan without batches the upload is refused with 402 BATCH_IS_A_PAID_FEATURE.

Formatsโ€‹

NDJSONโ€‹

One JSON object per line, UTF-8. Each line is exactly the body POST /api/v1/invoices takes, so an integration that already sends single invoices writes one of its request bodies per line:

{"invoice": {"number": "INV-1001", "issue_date": "2026-11-20", "currency": "EUR", "seller": {"...": "..."}, "buyer": {"...": "..."}, "lines": [{"...": "..."}], "totals": {"net_amount": 1000.00, "tax_amount": 190.00, "payable_amount": 1190.00}}}
{"invoice": {"number": "INV-1002", "...": "..."}}

A line holding a bare invoice object (without the invoice wrapper) is accepted too. Blank lines are skipped. Name the file .ndjson or .jsonl (optionally .gz), or send format=ndjson.

CSVโ€‹

The same CSV template as CSV Import, read by the same parser: the same columns and aliases, rows sharing an invoice number become one multi-line invoice, the seller and the import defaults come from your company settings. Name the file .csv (optionally .gz), or send format=csv. Excel workbooks are not taken here; use the CSV import for them.

In a CSV file a "line" in the receipts and the status file is a record: each invoice the parser built is numbered in file order, and each row it refused is numbered by its CSV row.

Gzipโ€‹

A gzip file (the content, not a Content-Encoding header) is accepted and inflated as it is read. The file may be at most 100 MB as sent and at most 1 GB inflated; past that it is refused with 413 INTAKE_DECOMPRESSED_TOO_LARGE before anything is stored.

Uploadโ€‹

curl -X POST https://app.goroute.ai/peppol-api/api/v1/files \
-H "X-API-Key: $GOROUTE_API_KEY" \
-F "file=@invoices-2026-11-20.ndjson.gz" \
-F "client_reference=ERP-RUN-20261120" \
-F "control_count=12500" \
-F "control_taxable_total=1843250.75" \
-F "control_vat_total=92162.54"
FieldMeaning
fileThe file. Required.
formatndjson or csv. Taken from the file name, or from the content, when omitted.
client_referenceYour own reference for the file, returned on every view of it.
control_count, control_taxable_total, control_vat_totalThe control record (below). Optional.
allow_duplicatestrue to take a file whose content was already sent. Default false.
on_invalidaccept_valid (default): invalid lines are reported, the rest is sent. reject_file: any invalid or unparseable line rejects the whole file.

The answer is 202 Accepted with the received receipt:

{
"kind": "received",
"id": "6f1d3c1e-2b0a-4a51-9a52-0f3c8f6a1b11",
"bytes": 2817734,
"decompressed_bytes": 19876210,
"compression": "gzip",
"format": "ndjson",
"sha256": "3b2fโ€ฆ",
"client_reference": "ERP-RUN-20261120",
"control": {"count": 12500, "taxable_total": "1843250.75", "vat_total": "92162.54"},
"received_at": "2026-11-20T06:00:04.112Z"
}

The same file twiceโ€‹

A file with the same content (sha256) as one your organisation already sent is refused with 409 INTAKE_DUPLICATE_FILE; duplicate_of names the earlier file. Send allow_duplicates=true to take it anyway. Duplicate invoices inside a file are not screened here: the same invoice sent twice is refused by the send itself, as for single invoices.

Refusalsโ€‹

Statuserror_codeWhy
400INTAKE_FILE_EMPTYNo bytes, or none once inflated.
400INTAKE_GZIP_INVALIDThe gzip stream is broken or truncated.
409INTAKE_DUPLICATE_FILESame content as an earlier file.
413INTAKE_FILE_TOO_LARGEMore than 100 MB as sent.
413INTAKE_DECOMPRESSED_TOO_LARGEMore than 1 GB inflated.
422INTAKE_FORMAT_INVALID, INTAKE_FIELD_INVALIDA field is not one of its allowed values.
503INTAKE_STORAGE_UNAVAILABLEThe file could not be stored; nothing was taken. Retry.
503INTAKE_QUEUE_DISABLEDFile intake is paused on this platform; nothing was taken. Send it later.
503INTAKE_STORAGE_NOT_CONFIGUREDThis deployment has no document store for intake files.

The control recordโ€‹

Declare what the file holds and GoRoute checks it before anything is sent:

  • control_count: the number of invoice records in the file (every non-blank line of an NDJSON file; every invoice and every refused row of a CSV file).
  • control_taxable_total: the sum of totals.net_amount over the records.
  • control_vat_total: the sum of totals.tax_amount over the records.

The totals are summed over every record whose totals can be read, valid or not, so a control record checks the file as you wrote it. Amounts are compared exactly. A difference in any declared total rejects the file: nothing is sent, and the parsed receipt says which total differs:

"totals": {
"declared": {"count": 12500, "taxable_total": "1843250.75", "vat_total": "92162.54"},
"computed": {"count": 12499, "taxable_total": "1843100.75", "vat_total": "92155.04"},
"mismatches": [
{"total": "count", "declared": 12500, "computed": 12499},
{"total": "taxable_total", "declared": "1843250.75", "computed": "1843100.75"},
{"total": "vat_total", "declared": "92162.54", "computed": "92155.04"}
]
}

How a file is processedโ€‹

received -> parsing -> accepted -> processing -> completed
\-> rejected \-> completed_with_errors
\-> failed
  1. Parsing. Every line is read. A line that passes the invoice model becomes an item to send. A line that does not becomes an invalid item with its errors: it is in the status file and in the failure notices, and is not sent. A line that cannot be read at all (not UTF-8, not JSON, not a JSON object) is unparseable: the parsed receipt lists it by line number with the reason.
  2. Batches. Items are grouped in file order, 5,000 to a batch (the most a batch holds), so a large file becomes several batches. GET /api/v1/files/{file_id} lists them; each is also a normal batch under /api/v1/batches. A file's batches are sent one after another: a batch waiting its turn reads queued.
  3. Accepted or rejected. A control-record mismatch, a file with no records, or (with on_invalid=reject_file) any invalid or unparseable line rejects the file: its batches are cancelled and nothing is sent. Otherwise the file is accepted and its batches start sending.
  4. Completed. When every batch has finished the file is completed (every line sent), completed_with_errors (some sent, some not) or failed (nothing sent).

The three receiptsโ€‹

GET /api/v1/files/{file_id}/receipt answers all three; each appears once its stage is done.

  • received: id, bytes (as sent and inflated), sha256, format, your reference and control record, the time it was received.
  • parsed: outcome (accepted or rejected) and reasons; lines_read, items_accepted, items_invalid, lines_unparseable; unparseable (each line number and reason; the first 10,000 are listed, unparseable_truncated says when there are more); the declared and computed totals with any mismatches; the batch ids.
  • completed: outcome and the count of items in each final status (success, failed, invalid, skipped, โ€ฆ, and unparseable), with each batch's final status.

The status fileโ€‹

GET /api/v1/files/{file_id}/results?format=csv (or ndjson) answers one row per line of your file, in line order, across all its batches:

ColumnMeaning
lineThe line number in your file (a record number for CSV).
invoice_numberThe invoice number on that line, when it could be read.
statuspending, processing, success, failed, invalid, skipped or unparseable.
transaction_idThe transaction the invoice was sent as.
document_uuidThe document's UUID, where the format carries one.
qrThe QR payload, where the country requires one (Oman).
error_code, error_messageWhy the line was not sent.
batch_idThe batch the line is in.

Fetch it at any time: rows still being sent read pending or processing.

Deleting a fileโ€‹

DELETE /api/v1/files/{file_id} deletes a file that is received, accepted or rejected, with the batches it became and the stored file. Once processing has started it answers 409 INTAKE_FILE_NOT_DELETABLE; cancel the batches under /api/v1/batches instead.

Retentionโ€‹

The file itself is kept for 30 days after it was received, then deleted. The file's record, its receipts and the status file stay.

Larger filesโ€‹

There is no pre-signed upload: every file goes through POST /api/v1/files, at most 100 MB as sent. Compress with gzip, or split a larger run into several files, each with its own control record.