How to download invoice PDFs from Sage Business Cloud Accounting
The Apideck Accounting unified API doesn't expose invoice PDF download as a unified operation, but you can retrieve them via the Proxy API. This guide shows how to do this for Sage Business Cloud Accounting.
The flow is two steps: use the unified GET /accounting/invoices endpoint to find the invoice you want, then use its id in a Proxy API call to download the PDF.
Sage's sales invoice endpoint serves both JSON and PDF off the same URL - only the Accept header changes the response type.
Prerequisites
An active Apideck Vault connection for Sage Business Cloud Accounting (
service-id: sage-business-cloud-accounting)The Apideck
consumer-id,app-id, andapi-keyA sales invoice in Sage
Step 1: Find the invoice ID
Use the unified Accounting API to list invoices and find the one you want:
curl --location 'https://unify.apideck.com/accounting/invoices' \
--header 'Authorization: Bearer {APIDECK_API_KEY}' \
--header 'x-apideck-app-id: {APP_ID}' \
--header 'x-apideck-consumer-id: {CONSUMER_ID}' \
--header 'x-apideck-service-id: sage-business-cloud-accounting'
The response contains an array of invoices. Copy the id of the invoice you want as a PDF — you'll use it in the next step. The unified id is the same as Sage's invoice GUID.
Step 2: Download the PDF via Proxy
curl --location 'https://unify.apideck.com/proxy' \
--header 'Authorization: Bearer {APIDECK_API_KEY}' \
--header 'x-apideck-app-id: {APP_ID}' \
--header 'x-apideck-consumer-id: {CONSUMER_ID}' \
--header 'x-apideck-service-id: sage-business-cloud-accounting' \
--header 'x-apideck-downstream-url: https://api.accounting.sage.com/v3.1/sales_invoices/{INVOICE_ID}' \
--header 'Accept: application/pdf' \
--output sage-invoice.pdf
The Apideck Proxy detects the binary response and base64-encodes it internally; API Gateway decodes it back to raw bytes before delivery, so your HTTP client receives a normal PDF binary.
Gotchas
The same URL serves JSON and PDF. Sage uses content negotiation - Accept: application/json returns the invoice details, Accept: application/pdf returns the rendered PDF. Always set the header explicitly.
Sage Start tier limitations. If your end users are on Sage Start (the entry-tier UK plan), some fields are restricted at the API level. PDF download itself works, but if you're also creating invoices via the Proxy, watch out for fields like due_date and terms_and_conditions - these are auto-derived from the contact's payment terms and can't be set explicitly. This doesn't affect PDF retrieval directly, but is a common follow-on issue.
