Download a PDF

distru-download-pdfRead

Creates a PDF of an invoice, order slip, purchase order, work order, COA or Metrc manifest, and returns a download link.

Inputs

Every tool also takes the common inputs.

FieldTypeRequiredDescription
documentenum
INVOICEINVOICE_COASALES_ORDERSALES_ORDER_COAPURCHASE_ORDERASSEMBLYBATCH_COAPACKAGE_COATEST_RESULT_COAMETRC_MANIFEST
YesWhich PDF to generate. INVOICE: the invoice. INVOICE_COA: the invoice's COA (Certificate of Analysis) — the lab result file of the primary test result of each line item's batch and package, duplicates removed, combined into one PDF. SALES_ORDER: the sales order's order slip. SALES_ORDER_COA: the sales order's COA, combined from its line items the same way. PURCHASE_ORDER: the purchase order. ASSEMBLY: the assembly's work order. BATCH_COA / PACKAGE_COA: the lab result file of the batch's / package's primary test result. TEST_RESULT_COA: that test result's lab result file. A COA errors when it finds no lab result file. METRC_MANIFEST: the Metrc transfer manifest, fetched from Metrc with the user's Metrc API key for the manifest's license; it errors when the user has no working key for that license. No Distru permission applies.
idstringYesID of the entity `document` is for. INVOICE, INVOICE_COA: invoice ID ("inv_…"), resolve via distru-search-invoices. SALES_ORDER, SALES_ORDER_COA: sales order ID ("so_…"), resolve via distru-search-sales-orders. PURCHASE_ORDER: purchase order ID ("po_…"), resolve via distru-search-purchase-orders; draft purchase orders are refused. ASSEMBLY: assembly ID ("asm_…"), resolve via distru-search-assemblies. BATCH_COA: batch ID ("batch_…"), resolve via distru-search-batches; deleted batches are not found. PACKAGE_COA: package ID ("pkg_…"), resolve via distru-search-packages. TEST_RESULT_COA: test result ID ("test_…"), resolve via distru-search-test-results. METRC_MANIFEST: Metrc manifest number, e.g. 0000012345, resolve via distru-search-metrc-manifests.

Output

FieldTypePresence
urlstringAlways
expiresDatetimestringAlways
filenamestringAlways
What the AI reads

Generates a Distru PDF — an invoice, a sales order slip, a purchase order, an assembly work order, or a COA (lab results) — or fetches a Metrc transfer manifest PDF from Metrc, and returns a link to download it. To email the PDF instead, use distru-email-pdf. `url` is a signed link that works for anyone who has it until `expiresDatetime`, 1 hour after the call. Except for a Metrc manifest, the same permissions as downloading the PDF in the Distru web app apply.