GET
/
invoices
/
{id}
/
pdf
curl https://api.contazen.ro/v1/invoices/inv_9z8y7x6w5v/pdf \
  -H "Authorization: Bearer sk_live_YOUR_API_KEY" \
  -o invoice.pdf
{
  "success": true,
  "data": {
    "id": "inv_9z8y7x6w5v",
    "object": "invoice_pdf",
    "url": "https://api.contazen.ro/v1/invoices/inv_9z8y7x6w5v/pdf/download?token=abc123def456&expires=1710464400&signature=xyz789",
    "expires_at": 1710464400,
    "content_type": "application/pdf",
    "filename": "CTZ-2024-00123.pdf"
  },
  "meta": {
    "version": "v1",
    "response_time": "23.45ms"
  }
}

Request

id
string
required
The invoice ID (ID) to download
mode
string
default:"download"
Download mode:
  • download - Returns the PDF file directly (default)
  • url - Returns a temporary signed URL to download the PDF
options
string
PDF generation options (optional). Can include customization parameters.
Draft invoices cannot be downloaded as PDF. The invoice must be finalized first.

Response

Download Mode (default)

When mode=download or not specified, the response is the PDF file itself:
  • Content-Type: application/pdf
  • Content-Disposition: attachment; filename="invoice_number.pdf"
  • X-Invoice-ID: The invoice ID in the response header

URL Mode

When mode=url, the response is a JSON object containing a temporary download URL:
success
boolean
Indicates if the request was successful
data
object
meta
object
Response metadata including version and response time
curl https://api.contazen.ro/v1/invoices/inv_9z8y7x6w5v/pdf \
  -H "Authorization: Bearer sk_live_YOUR_API_KEY" \
  -o invoice.pdf
{
  "success": true,
  "data": {
    "id": "inv_9z8y7x6w5v",
    "object": "invoice_pdf",
    "url": "https://api.contazen.ro/v1/invoices/inv_9z8y7x6w5v/pdf/download?token=abc123def456&expires=1710464400&signature=xyz789",
    "expires_at": 1710464400,
    "content_type": "application/pdf",
    "filename": "CTZ-2024-00123.pdf"
  },
  "meta": {
    "version": "v1",
    "response_time": "23.45ms"
  }
}

Use Cases

Direct Download

Best for:
  • Desktop applications
  • Immediate file saving
  • One-time downloads

URL Mode

Best for:
  • Webhook integrations
  • Async processing
  • Sharing download links
  • Mobile applications
The temporary URL expires after 1 hour for security. Generate a new URL if needed after expiration.