Download an invoice's credit notes
GET /api/v2/billing/invoices/{id}/credit-note
Download the credit notes for a refunded, partly refunded or cancelled invoice as one PDF, base64-encoded in JSON. Each refund or cancellation is its own credit note, numbered KR-<invoice number>, then KR-<invoice number>-2 and so on. The PDF has one page per credit note. A credit note never changes once issued. A later download returns the same pages, plus new ones for new refunds. Only organisation accounts have credit notes. Other accounts get 403. An invoice with no refund or cancellation returns 409 credit_note_unavailable.
Authentication: An API key with the scope read:billing. About keys and scopes
Request
Path parameters
idstringrequiredPublic invoice ID from
GET /api/v2/billing/invoices (inv_…).Example
curl "https://cloud.hostup.se/api/v2/billing/invoices/inv_01hxa3b4c5d6e7f8g9h0j1k2m3/credit-note" \ -H "Authorization: Bearer $HOSTUP_API_KEY"Responses
200 The credit notes as a base64-encoded PDF.
{ "contentBase64": "JVBERi0xLjQKJcTl8uXrp...", "contentType": "application/pdf", "filename": "credit-note-KR-202600001.pdf", "byteLength": 48231}Response fields
contentBase64stringThe PDF, base64-encoded.
contentTypestringOne of
application/pdf.filenamestringbyteLengthintegerAt least 1.
Errors
Errors are Problem Details with a stable code. Branch on the code, not on the text.
| 400 | Invalid request. The response body is an RFC 7807 Problem Details document. |
| 401 | Unauthorized. Authentication is required. |
| 403 | Forbidden. The caller lacks a required scope or does not own the resource. |
| 404 | Not found. The resource does not exist or is not owned by the caller; code is invoice_not_found. |
| 409 | credit_note_unavailable: the invoice has no refund or cancellation. |
| 429 | Rate limited. Retry after the limit resets. 429 responses include Retry-After seconds plus X-RateLimit-* headers. |
| 500 | Internal error. Retry later or contact support if the issue persists. |
| 502 | Upstream failure. A dependent provider request failed; the Problem Details code is upstream_failed. Retry later or contact support if the issue persists. |