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.
- 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 path | What it does |
|---|---|
POST /api/v1/files | Upload a file (multipart). 202 with the received receipt. |
GET /api/v1/files | Your 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}/receipt | The three receipts. |
GET /api/v1/files/{file_id}/results | The 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"
| Field | Meaning |
|---|---|
file | The file. Required. |
format | ndjson or csv. Taken from the file name, or from the content, when omitted. |
client_reference | Your own reference for the file, returned on every view of it. |
control_count, control_taxable_total, control_vat_total | The control record (below). Optional. |
allow_duplicates | true to take a file whose content was already sent. Default false. |
on_invalid | accept_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โ
| Status | error_code | Why |
|---|---|---|
| 400 | INTAKE_FILE_EMPTY | No bytes, or none once inflated. |
| 400 | INTAKE_GZIP_INVALID | The gzip stream is broken or truncated. |
| 409 | INTAKE_DUPLICATE_FILE | Same content as an earlier file. |
| 413 | INTAKE_FILE_TOO_LARGE | More than 100 MB as sent. |
| 413 | INTAKE_DECOMPRESSED_TOO_LARGE | More than 1 GB inflated. |
| 422 | INTAKE_FORMAT_INVALID, INTAKE_FIELD_INVALID | A field is not one of its allowed values. |
| 503 | INTAKE_STORAGE_UNAVAILABLE | The file could not be stored; nothing was taken. Retry. |
| 503 | INTAKE_QUEUE_DISABLED | File intake is paused on this platform; nothing was taken. Send it later. |
| 503 | INTAKE_STORAGE_NOT_CONFIGURED | This 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 oftotals.net_amountover the records.control_vat_total: the sum oftotals.tax_amountover 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
- 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.
- 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 readsqueued. - 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. - Completed. When every batch has finished the file is
completed(every line sent),completed_with_errors(some sent, some not) orfailed(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(acceptedorrejected) andreasons;lines_read,items_accepted,items_invalid,lines_unparseable;unparseable(each line number and reason; the first 10,000 are listed,unparseable_truncatedsays when there are more); the declared and computed totals with any mismatches; the batch ids. - completed:
outcomeand the count of items in each final status (success,failed,invalid,skipped, โฆ, andunparseable), 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:
| Column | Meaning |
|---|---|
line | The line number in your file (a record number for CSV). |
invoice_number | The invoice number on that line, when it could be read. |
status | pending, processing, success, failed, invalid, skipped or unparseable. |
transaction_id | The transaction the invoice was sent as. |
document_uuid | The document's UUID, where the format carries one. |
qr | The QR payload, where the country requires one (Oman). |
error_code, error_message | Why the line was not sent. |
batch_id | The 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.