Download a Lucid invoice PDF
Input
number optionalThe invoice number as returned by lucid.app/list_invoices (e.g. 19888678). The invoices table is opened and the row with this number is downloaded. Required unless pdfUrl is given.
pdfUrl optionalA direct Lucid invoice PDF URL (https://payment.lucid.app/accounts/<accountId>/pdfInvoice/<number>), if you already have one. Skips opening the billing UI entirely.
Output
filename requiredFilename from the file's Content-Disposition, falling back to Lucidchart-<number>.pdf. Lucid's own suggested name is the bare invoice number with no extension, so it is not used as-is.
pdf_base64 requiredThe PDF bytes, base64-encoded. Decode and write it yourself — the script is sandboxed and cannot write to disk.
number optionalThe invoice number that was downloaded.
pdfUrl optionalThe PDF URL the bytes were read from — reusable as this script's pdfUrl input to skip the UI next time.
size_bytes optionalByte length of the decoded PDF.
