statement_pdf
Make the PDF of a client's statement of account (the same page statement_prepare's document_path shows), printed on A4 with the business's fonts, brand colours and logo, and kept, so asking again for an unchanged statement returns the stored file (cached: true) without printing it again. It prepares a file and sends nothing. Returns version, pdf_path (downloads while signed in) and closing_balances, and download_url when signed links are on; while they are off, download_url_unavailable says why and pdf_path still works. Refusals: a client_id that is not one of your clients is NOT_FOUND (find it with invoice_client_search or invoice_client_list); a date not written YYYY-MM-DD, a to after today, a from after to, or a period longer than 366 days is VALIDATION_ERROR naming the field; a client with more than 2000 issued invoices is PAYLOAD_TOO_LARGE SIMPLER_SALES_STATEMENT_TOO_LARGE (sales_receivables still ages them). More than 50 new PDFs (invoices and statements together) in 24 hours is refused RATE_LIMITED SIMPLER_SALES_PDF_DAILY_CAP (wait retry_after seconds; stored PDFs still download); when PDF printing is unavailable (no browser here, storage not set up, printer busy or failing) it answers SERVICE_UNAVAILABLE with a reason_code and retry_after, and the print-ready page stays the fallback. A read-only token or a viewer is refused FORBIDDEN before anything is made. Free.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| to | No | Last day of the period, YYYY-MM-DD in the business's time zone, today at the latest. Default: today. | |
| from | No | First day of the period, YYYY-MM-DD in the business's time zone. Default: the first day of the month of to. | |
| client_id | Yes | The client's id, from invoice_client_search (by name) or invoice_client_list. |