Download Business Documents as PDF
With the Xentral API, you can easily download key business documents in PDF format. This allows you to export documents such as orders, invoices, or delivery notes directly from your application or system.
Supported Document Types
You can currently download the following document types as PDFs:
- Sales Order (
salesOrders
) - Invoice (
invoices
) - Delivery Note (
deliveryNotes
) - Credit Note (
creditNotes
) - Purchase Order (
purchaseOrders
) - Return (
returns
)
How It Works
Downloading works via the respective VIEW endpoint of the document. Instead of requesting a JSON response, you simply set the Accept
header to application/pdf
to receive the raw PDF file.
Steps
-
Send a
GET
request to the document’s VIEW endpoint. -
Set the following accept header:
Accept: application/pdf
-
The API will respond with a binary/raw PDF file, which you can save or use directly.
Note: The
Accept
header must be set correctly. If it is missing or incorrect, the response will default to JSON.
Example: Download a Sales Order as PDF
Request
GET https://{xentralId}.xentral.biz/api/v1/salesOrders/12345
Accept: application/pdf
Authorization: Bearer <your_api_token>
Response
The response body contains the PDF in binary/raw format. Save it with the .pdf
file extension.
Example using curl
curl
curl -X GET \
https://xentralId.xentral.biz/api/v1/salesOrders/12345 \
-H "Authorization: Bearer YOUR_API_TOKEN" \
-H "Accept: application/pdf" \
--output sales_order_12345.pdf
More Examples
Download an Invoice
GET https://{xentralId}.xentral.biz/api/v1/invoices/67890
Accept: application/pdf
Download a Delivery Note
GET https://{xentralId}.xentral.biz/api/v1/deliveryNotes/45678
Accept: application/pdf
Download a Credit Note
GET https://{xentralId}.xentral.biz/api/v1/creditNotes/11223
Accept: application/pdf
Important Notes
- The
Accept: application/pdf
header is required to receive a PDF. - The document ID (
{id}
) must be valid and accessible to your API user. - If the document is already sent/archived you will receive the archived PDF, otherwise the PDF will be generated on the fly.
Developer Tips
- In API tools like Postman or Insomnia, you can manually set the
Accept
header and download the PDF directly. - In programming languages (e.g. Python, JavaScript, PHP), use a standard HTTP client to download and save the response as a
.pdf
file.