Order-X Validation PDF Report API Reference
Technical reference for the PDF report variant of Order-X validation. It runs the exact same checks as POST /v1/validate/order-x, with the same profile detection and rule sets, but returns a printable PDF compliance report instead of a JSON body. The pass/fail verdict is returned in the X-Invoice-Valid response header, and the report downloads as a PDF named after your upload. One credit per call, the same as JSON validation.
https://api.invoicexml.com/v1/validate/order-x/report
Code Example
curl -X POST https://api.invoicexml.com/v1/validate/order-x/report \ -H "Authorization: Bearer YOUR_API_KEY" \ -F "[email protected]" \ -D - \ -o order-report.pdf
-o saves the returned PDF to disk and -D - prints the response headers so you can read X-Invoice-Valid. The invoice profile and version are detected automatically from the uploaded file, exactly as on the JSON endpoint. The optional validationLanguage form field is accepted as on the JSON endpoint: add -F "validationLanguage=de" or "validationLanguage=fr" to get the whole report in German or French.
Request
| Parameter | Type | Description |
|---|---|---|
| file * | binary | The order file to validate. Accepted formats: an Order-X hybrid PDF (the embedded order-x.xml attachment is extracted automatically) or a standalone Cross-Industry Order XML file. |
| validationLanguage | string | Optional. Language of the PDF report: en (default), de or fr, in any letter case. The whole report is written in it: the verdict, the labels and dates, the EN 16931 business-term names next to the BT codes, and the finding messages. Rule ids and BT codes stay the same. Order-X rule findings keep the rule set's own English wording in every language. Any other value, regional tags such as de-DE included, is rejected with a 400 (errorCode 4002). See localized error messages. |
Content-Type: multipart/form-data
That is the whole request. The Order-X profile (BASIC, COMFORT, or EXTENDED) is detected automatically from the order's guideline identifier and the matching Order-X rule set is applied.
Headers
| Header | Value |
|---|---|
| Authorization * | Bearer YOUR_API_KEY |
| Content-Type | multipart/form-data |
Response
200 PDF report
The response body is the PDF document itself, served as an attachment named order-report.pdf (derived from your upload's filename). The compliance verdict is returned in the X-Invoice-Valid response header as true or false, so you can branch on the outcome without opening the PDF. A completed validation always returns HTTP 200 and a PDF whether the invoice passed or failed; read X-Invoice-Valid to tell the two apart.
Content-Type: application/pdf Content-Disposition: attachment; filename="order-report.pdf" X-Invoice-Valid: true
Handling the PDF response
Read the verdict from the X-Invoice-Valid header and stream the body to a file. Do not parse the body as JSON on a 200 response, it is binary PDF.
C#
using var client = new HttpClient();
client.DefaultRequestHeaders.Authorization =
new System.Net.Http.Headers.AuthenticationHeaderValue("Bearer", "YOUR_API_KEY");
using var form = new MultipartFormDataContent();
form.Add(new StreamContent(File.OpenRead("order.pdf")), "file", "order.pdf");
var response = await client.PostAsync("https://api.invoicexml.com/v1/validate/order-x/report", form);
response.EnsureSuccessStatusCode();
var valid = response.Headers.TryGetValues("X-Invoice-Valid", out var values)
&& values.FirstOrDefault() == "true";
await using var pdf = File.Create("order-report.pdf");
await response.Content.CopyToAsync(pdf);
Console.WriteLine(valid ? "Invoice is compliant." : "Validation failed, see the PDF report.");
Node.js
const fs = require('fs');
const FormData = require('form-data');
const form = new FormData();
form.append('file', fs.createReadStream('order.pdf'));
const response = await fetch('https://api.invoicexml.com/v1/validate/order-x/report', {
method: 'POST',
headers: { 'Authorization': 'Bearer YOUR_API_KEY', ...form.getHeaders() },
body: form,
});
const valid = response.headers.get('x-invoice-valid') === 'true';
fs.writeFileSync('order-report.pdf', Buffer.from(await response.arrayBuffer()));
console.log(valid ? 'Invoice is compliant.' : 'Validation failed, see the PDF report.');
Error Reference
A completed validation always returns HTTP 200 with the PDF body. Transport-level problems never return a PDF: they come back as the standard RFC 7807 JSON problem response, the same shape and status codes as the JSON validation endpoint. Check the response status, or the Content-Type, before treating the body as a PDF.
| Status | Meaning | Action |
|---|---|---|
| 200 | Validation completed. The body is the PDF report. | Read X-Invoice-Valid for the pass/fail verdict. |
| 401 | Missing or invalid API key. | Check the Authorization header. |
| 422 | File is not a valid PDF or XML document. | Ensure you are uploading a supported file format. |
Need the findings as JSON?
The /v1/validate/order-x endpoint runs the identical validation and returns every finding as structured JSON, with rule ids, layers, friendly messages, and field paths.