Download Invoice PDF

Download invoices as professionally formatted PDF documents. PDFs include all invoice details and are suitable for sending to customers or archiving.

Endpoint

GET
/api/v1/invoices/{invoice_id}/pdf

Path Parameters

FieldTypeRequiredDescriptionExample
invoice_idstring
Required
The ID of the invoice to download as PDFinv_01HXYZ123ABC

Response

Returns a PDF file with:

  • Content-Type: application/pdf
  • Content-Disposition: attachment; filename="invoice-{number}.pdf"

Code Examples

import requests
invoice_id = "inv_01HXYZ123ABC"
url = f"http://localhost:8000/api/v1/invoices/{invoice_id}/pdf"
headers = {
"Authorization": "Bearer your-api-key"
}
response = requests.get(url, headers=headers)
# Save PDF to file
if response.status_code == 200:
filename = f"invoice_{invoice_id}.pdf"
with open(filename, "wb") as f:
f.write(response.content)
print(f"PDF saved to {filename}")
else:
print(f"Error: {response.status_code}")

PDF Contents

The generated PDF includes:

  • Invoice number and date
  • Customer information (name, email)
  • Invoice amount and currency
  • Payment details (wallet address if provided)
  • Due date (if set)
  • Payment status
  • Professional formatting suitable for business use

Error Scenarios

404 Not Found

  • Invoice ID does not exist
  • Invoice belongs to a different organization

401 Unauthorized

  • Missing or invalid API key
  • API key does not have permission to read invoices

500 Internal Server Error

  • PDF generation service unavailable
  • Template rendering error

Related Documentation