Skip to content

Download an invoice PDF

GET /api/v2/billing/invoices/{id}/pdf

Download an invoice as a PDF, returned as base64-encoded JSON. Decode contentBase64 and save it under filename. byteLength is the size of the decoded file. For the credit notes of a refunded or cancelled invoice, use GET /api/v2/billing/invoices/{id}/credit-note.

Authentication: An API key with the scope read:billing. About keys and scopes

Request

Path parameters

idstringrequired
Public invoice ID from GET /api/v2/billing/invoices (inv_…).

Example

GET /api/v2/billing/invoices/{id}/pdf
curl "https://cloud.hostup.se/api/v2/billing/invoices/inv_01hxa3b4c5d6e7f8g9h0j1k2m3/pdf" \
-H "Authorization: Bearer $HOSTUP_API_KEY"

Responses

200 The invoice as a base64-encoded PDF.

Response 200
{
"contentBase64": "JVBERi0xLjQKJcTl8uXrp...",
"contentType": "application/pdf",
"filename": "invoice-inv_01hxa3b4c5d6e7f8g9h0j1k2m3.pdf",
"byteLength": 51234
}
Response fields
contentBase64string
The PDF, base64-encoded.
contentTypestring
One of application/pdf.
filenamestring
byteLengthinteger
At least 1.

Errors

Errors are Problem Details with a stable code. Branch on the code, not on the text.

400Invalid request. The response body is an RFC 7807 Problem Details document.
401Unauthorized. Authentication is required.
403Forbidden. The caller lacks a required scope or does not own the resource.
404Not found. The resource does not exist or is not owned by the caller; code is invoice_not_found.
429Rate limited. Retry after the limit resets. 429 responses include Retry-After seconds plus X-RateLimit-* headers.
500Internal error. Retry later or contact support if the issue persists.
502Upstream failure. A dependent provider request failed; the Problem Details code is upstream_failed. Retry later or contact support if the issue persists.