get-invoice-pdf
dci get-invoice-pdf <id>
Returns the PDF document for the invoice specified by the invoice number. The response body is the PDF bytes.
The PDF is returned decompressed by default. It is only gzip-compressed when the request advertises Accept-Encoding: gzip, in which case the response carries Content-Encoding: gzip with a Content-Length for the compressed bytes and must be decoded as a standard Content-Encoding: gzip body. HTTP clients whose stack negotiates the encoding automatically also decode it automatically; a client that sets the header by hand may instead receive the raw gzip bytes (for example curl decodes only with --compressed). Omit Accept-Encoding (or send identity) to always receive the decompressed PDF. A very large invoice may exceed the decompressed-response size limit and respond with 500; request it with Accept-Encoding: gzip to stream the compressed bytes without that limit.
A 404 is returned both when no invoice with the given number exists for the authenticated tenant and when the invoice exists but has no PDF document available.
id— Invoice number.
Output
OK - The invoice PDF document.
By default dci renders the result as a table. Use --output json to get the full structure described below — see Output formats.
Returns: string (binary)
Raw JSON schema
{
"type": "string",
"format": "binary"
}
Errors
On failure, dci prints a single error message — with a hint when one is available — and exits with a typed code your scripts can branch on. See Errors and exit codes for the full contract.
HTTP status to exit code mapping
| HTTP status | Exit code | Error code | Meaning |
|---|---|---|---|
| 400 | 30 | VALIDATION_ERROR | The arguments or request body were rejected. Review the command's flags and payload. |
| 401 | 10 | AUTHENTICATION_FAILED | Not signed in, or the API token is invalid. Run dci login or check DCI_API_KEY. |
| 403 | 11 | PERMISSION_DENIED | The DoiT user or the active customer context does not have access. |
| 404 | 20 | RESOURCE_NOT_FOUND | The requested resource does not exist. Check the identifier argument. |
| 500 | 40 | API_SERVER_ERROR | The API failed to process the request. Retryable; contact DoiT support if it persists. |
Related
- get-invoice — Retrieve an invoice
- list-invoices — List invoices
- API reference: GET /billing/v1/invoices/{id}/pdf
Aliases: getinvoicepdf