Skip to main content

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 statusExit codeError codeMeaning
40030VALIDATION_ERRORThe arguments or request body were rejected. Review the command's flags and payload.
40110AUTHENTICATION_FAILEDNot signed in, or the API token is invalid. Run dci login or check DCI_API_KEY.
40311PERMISSION_DENIEDThe DoiT user or the active customer context does not have access.
40420RESOURCE_NOT_FOUNDThe requested resource does not exist. Check the identifier argument.
50040API_SERVER_ERRORThe API failed to process the request. Retryable; contact DoiT support if it persists.

Aliases: getinvoicepdf