TestResult

Generate a test result's Certificate of Analysis (COA) PDF

Generate the Certificate of Analysis (COA) PDF for a single test result — its attached lab result file — and download it directly, get a signed link to it, or email it (see format). Returns 404 when the test result has no attached lab result file.

The same permissions that govern downloading this PDF in the Distru web app apply to this endpoint.

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.

post/public/v1/test-results/{id}/pdf

Path parameters

idstring required

The ID of the test result whose Certificate of Analysis (COA) PDF you want. This is the same id returned by the list and get endpoints.

Request body

format'binary' | 'url' | 'email' required

How the generated PDF is delivered. One of binary — the raw PDF bytes as the response body (Content-Type: application/pdf); url — a JSON body with a short-lived signed download URL (see the PdfResponse response); or email — emails the PDF to the addresses in email_addresses and returns a JSON body listing who it was emailed to. Required, but omitting it defaults to binary for backward compatibility.

email_addressesstring[]

Recipient email addresses, used only when format is email (required in that case, ignored otherwise). At least one address is required and every address must be valid, otherwise the request is rejected with a 400. At most 200 addresses may be given.

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 endpoint across all 2 revisions of this API.