Product and API guide

Preview links

Viewer and embed settings

Configure appearance, title visibility and page navigation in the account’s embedded viewer settings. Branding removal and embedding depend on plan entitlements; check the availability shown in the panel.

Allowed sites

Add the sites where you will embed the viewer to the allowed sites. Embed permission and share validity are separate checks: allowing a site does not reactivate an expired or revoked share. Never put an API key in browser code or an iframe URL.

Check before sharing

Test the link under the conditions your recipient will use. Check page count, chart and table layout, available download formats and expiry. Also test embedding on a site that is not allowed; a working account preview alone does not prove external access is enabled.

Creates an expiring view link your customer can open without an account. A single call can hand back both PDF and DOCX download links.

Request
curl -X POST https://api.pdfgine.com/api/v1/preview \
  -H "X-PDFgine-Key: $PDFGINE_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "templateCode": "invoice", "formats": ["pdf", "docx"], "data": { } }'
Response
{
  "previewId": "prv_481fac83d9f14a4493021eb128d0876b",
  "previewUrl": "/p/prv_481fac83d9f14a4493021eb128d0876b",
  "expiresAt": "2026-08-29T13:23:43+00:00",
  "pageCount": 1,
  "downloads": [
    { "format": "pdf", "downloadUrl": "/api/v1/previews/prv_481f.../download/pdf?expires=...&token=..." },
    { "format": "docx", "downloadUrl": "/api/v1/previews/prv_481f.../download/docx?expires=...&token=..." }
  ]
}

The link carries an unguessable signature and closes at expiresAt.

How long documents stay available

PDFgine generates and delivers documents; keeping a generated document is your choice. The product holds only its own inputs (templates, brand assets) and temporary outputs. Every output stays for the period you choose in the request — accessProfile: short 24 hours (default), standard 7 days, extended 30 days (7 and 30 days on Go and above), quarter 90 days (on Max). A share link stays open for that period; a production document (/render, /documents/render) can be downloaded again through the API for that period. When it ends, downloads return 410 and the output is deleted within 24 hours; the generation record, page count and usage data remain. To keep a document permanently, store it in your own system right after generation.

Ninety-day links

Beside the standard and extended profiles there is a quarter profile that keeps a link alive for 90 days, for a contract the other side has to be able to reopen for a whole quarter. It is available on the top plan; every plan sees the profiles it may use in its own plan entitlements.

Closing a link early

A share link normally closes at expiresAt. When the document should not be seen any longer, revoke it: the answer is 204 and the link stops working immediately.

cURL
curl -i -X POST https://api.pdfgine.com/api/v1/previews/prv_481fac83d9f14a4493021eb128d0876b/revoke \
  -H "X-PDFgine-Key: $PDFGINE_KEY"

HTTP/1.1 204 No Content

What usually goes wrong

  • Creating a preview answers 201, not 200, and revoking answers 204 with no body. A client that parses every answer as JSON fails on the revoke.
  • accessProfile decides how long the link lives and the longer profiles need the right plan. Asking for quarter on a plan that does not include it is rejected, not silently shortened.
  • The download links inside downloads carry a signature and an expiry. Store the previewId, not those addresses; a stored address stops working when it expires.
  • Revoking closes the link, not the document. The file is still yours and can still be downloaded through the API until retention ends.
  • A preview consumes preview pages, not production quota. Producing the same document again with /render is a separate, billable page count.