Skip to content

Documents

Every render made with persist=true (the default) is stored and shows up here — the same records visible in the workspace under Renders. Renders made with persist=false never appear.

Operation Endpoint
List documents GET /v1/documents
Get a document GET /v1/documents/{id}
Download the PDF GET /v1/documents/{id}/file

List the most recent documents, then download one to disk.

Terminal window
# Most recent 20 documents
curl -G "https://pagr-prd-api-public.azurewebsites.net/v1/documents" \
-H "Authorization: Bearer pagr_prod_xxxxxxxx" \
--data-urlencode "take=20" \
--data-urlencode "sortBy=renderedAt" \
--data-urlencode "sortDirection=desc"
# Download one
curl "https://pagr-prd-api-public.azurewebsites.net/v1/documents/f61aeff4-2c9d-4b7a-8e10-3a5b9c2d1e00/file" \
-H "Authorization: Bearer pagr_prod_xxxxxxxx" \
--output invoice.pdf
GET /v1/documents

The shared skip / take / sortBy / sortDirection / search / filters[i] set.

  • Sortable: documentName, versionNumber, fileSizeBytes, pageCount, renderedAt (the default), renderDuration, environment, createdAt, updatedAt.
  • Filterable: documentName, template.guid, versionNumber, fileSizeBytes, pageCount, renderedAt, createdAt, updatedAt, environment, language — see Filterable fields → Documents for each field’s operators.
  • search matches documentName.

200 → a paged result of document metadata:

{
"items": [
{
"id": "f61aeff4-2c9d-4b7a-8e10-3a5b9c2d1e00",
"documentName": "Acme Q3 Invoice",
"templateId": "8bec66ff-6f3d-4c1e-9a2b-1f0e5d7c4a90",
"versionNumber": 3,
"environment": "production",
"fileSizeBytes": 24815,
"pageCount": 1,
"renderedAt": "2026-07-24T09:46:01Z",
"renderDuration": 412.7,
"viewUrl": "https://…",
"documentType": "Template",
"isPdfDeleted": false,
"language": null
}
],
"total": 1,
"skip": 0,
"take": 25
}
Field Type Description
id string (UUID) The document id — pass it to Get a document or Download the PDF.
documentName string The document’s name, from the version’s document-name template. No file extension.
templateId string (UUID) The template it was rendered from.
versionNumber number The template version used.
environment string test or production, decided by the API key that rendered it.
fileSizeBytes number Size of the stored PDF.
pageCount number Number of pages.
renderedAt string (ISO 8601) When it rendered.
renderDuration number Server-side render time in milliseconds.
viewUrl string Signed, time-limited download link.
documentType string Template or Invoice.
isPdfDeleted boolean true when the stored PDF was purged by retention while the metadata remains.
language string or null The language variant rendered, or null.
GET /v1/documents/{id}
Parameter Type Required Description
id string (UUID) Yes The document’s id.

Response: 200 → a single document object, same shape as one items entry above. This returns metadata only — no PDF bytes. 404 if it doesn’t exist or belongs to a different organisation.

GET /v1/documents/{id}/file
Parameter Type Required Description
id string (UUID) Yes The document’s id.

Response: 200 with Content-Type: application/pdf — the raw file bytes. Every SDK returns them as its native byte type (bytes, Uint8Array, byte[], String, std::vector<std::uint8_t>).

Status code When
404 DocumentNotFound No such document, or it belongs to another organisation.
410 PdfDeleted The metadata still exists but the PDF was purged by your organisation’s retention policy.

TODO: Work here with a language selection. Maybe a text without toggle that changes based on the language you have selected from the snippet.

Operation Python TypeScript Java C# Ruby C++
List documents get_documents getDocuments getDocuments GetDocumentsAsync documents get_documents
Get a document get_document getDocument getDocument GetDocumentAsync document get_document
Download the PDF download_document downloadDocument downloadDocument DownloadDocumentAsync download_document download_document

The purged-PDF flag follows each language’s convention: is_pdf_deleted (Python), isPdfDeleted (TypeScript), isPdfDeleted() (Java), IsPdfDeleted (C#), pdf_deleted? (Ruby), is_pdf_deleted (C++).

See Errors for the full status code table.