Generate a batch's Certificate of Analysis (COA) PDF
Get the Certificate of Analysis (COA) PDF for a single batch and download it directly, get a signed link to it, or email it (see format). The PDF is the batch's designated primary test result (the lab result flagged as primary among the batch's test results). Returns 404 when the batch has no primary test result, or that result has no attached file, with the message This batch has no lab results attached, which tells it apart from an unknown ID (Not Found). A deleted batch returns Not Found. This serves a document already stored in Distru; it does not re-run or fetch anything from a lab or a state traceability system.
The same permissions that govern downloading this PDF in the Distru web app apply to this endpoint; when format is email, the web app's permission for emailing it applies instead (documents the web app cannot email keep the download permission).
format selects how the generated PDF is delivered and has three modes: binary returns the raw PDF bytes as the response body (Content-Type: application/pdf); url returns a JSON envelope {"data": {"url": ..., "expires_datetime": ...}} with a temporary signed download URL; email sends the PDF to the addresses in email_addresses and returns a JSON envelope {"data": {"emailed_to": [...]}}. format is required, but for backward compatibility omitting it defaults to binary.
All PDF download endpoints share a single, combined rate limit for your account: 20 requests per minute and 1000 per day in total across every PDF endpoint (not per endpoint). Requests over the limit return 429 with a Retry-After header, and only successful downloads count toward it.
Request
- Base URLhttps://app.distru.com
- AuthHTTP bearer
Path parameters
The Distru batch ID whose COA to download.
Request body
Response
When format is binary (or omitted), the raw PDF file (Content-Type: application/pdf). When format is url, a JSON body with a temporary signed download URL; when format is email, a JSON body listing the addresses the PDF was emailed to (see the PdfResponse schema).
Changes
No recorded changes to this operation across all 17 revisions of this API.