{"document": {"id":"12345678-1234-1234-1234-123456789012","document_template_id":"ID-OF-YOUR-TEMPLATE","status":"generating",// Document is queued (could also still be "pending")"failure_cause":null,// Filled in case of error"filename":"2050-03-14 Peter Parker.pdf","download_url":null,// Not filled until generation success"preview_url":"https://...",// Usable to embed a preview of the PDF in your app"public_share_link":null,// Filled upon generation success on a Pro+/Premium plan"payload": {"clientName":"Peter Parker","orderDate":"2050-03-14","products": [ { "name":"Spider silk","quantity": 12,"unitPrice": 123.50 }, { "name":"Spandex fabric","quantity": 2,"unitPrice": 28.90 } ] },"meta": {"_filename":"2050-03-14 Peter Parker.pdf","clientRef":"spidey-616" },"created_at":"2050-03-13T12:34:56.181+02:00","updated_at":"2050-03-13T12:34:56.181+02:00" }}
Sample HTTP request to fetch details about a document
When you interact with your Documents, there are two objects you need to be aware of: Document and DocumentCard.
The main distinction between the two is that DocumentCard does not include the payload attribute of the Document. This matters because in many cases, this attribute will have a important size and will thus have an impact on performance on both your side and ours.
Rules of thumb
Always prefer DocumentCard unless you really need access to payload
Store any data you need later on in meta instead of (or in addition to) payload that way you won't need access to payload
The Document object
The Document object represents a single document (PDF), with its status, data and meta-data. It is used to manipulate the data used to generate a PDF.
(String, UUID) Unique identifier of the Document's Workspace.
checksum
(String) Internal checksum of the Document's content, mainly used for the Document's preview.
created_at
(String, Date) Time at which the object was created.
document_template_id
(String, UUID) Unique identifier of the Document's Template.
download_url
(String, URL) The URL at which the Document can be downloaded.
Valid for 1 hour
Any time you fetch the details of a document, you get a fresh download URL. It is valid for 1 hour. Once that time has passed, you'll need to fetch the Document's details again to get a fresh URL.
failure_cause
(String) In case the Document's status is failure, this field will contain the reason of the failure. In any other case, this will be null.
filename
(String) Name of the generated file when the Document's status is success, will be null otherwise.
generation_logs
(Array of Objects) Logs collected during the Document's generation. Can be especially useful in case of generation failure.
type: Can be info or errormessage: The log message
timestamp: The date and time of the log message
Will default to an empty array [] before the generation.
meta
(String, JSON) The meta-data of the Document. Can be null or an arbitrary object containing data that you want to attach to a Document. This can be useful when using integrations, like Zapier or Integromat, as the payload will not be accessible.
payload
(String, JSON) The dynamic data used to build the content of the Document. Must represent a JSON object, not an array.
preview_url
(String, URL) This URL is especially useful if you want to embed a preview of the PDF in your own UI. A good example of this is the preview in our own dashboard, when you create a new Document.
This is not a Download URL!
This attributes is often mixed up with the Download URL but it cannot be used to download a generated PDF, it should only be used in an iframe.
public_share_link
(String, URL) This URL will be present if your account has Share Links enabled. It is a permalink to the generated PDF.
Premium plan only
The share links feature is only available for Premium plans.
(String, UUID) Unique identifier of the Document's Workspace.
created_at
(String, Date) Time at which the object was created.
document_template_id
(String, UUID) Unique identifier of the Document's Template.
document_template_identifier
(String) The name you gave to the Document's Template.
download_url
(String, URL) The URL at which the Document can be downloaded.
Valid for 1 hour
Any time you fetch the details of a document, you get a fresh download URL. It is valid for 1 hour. Once that time has passed, you'll need to fetch the Document's details again to get a fresh URL.
failure_cause
(String) In case the Document's status is failure, this field will contain the reason of the failure. In any other case, this will be null.
filename
(String) Name of the generated file when the Document's status is success, will be null otherwise.
meta
(String, JSON) The meta-data of the Document. Can be null or an arbitrary object containing data that you want to attach to a Document. This can be useful when using integrations, like Zapier or Integromat, as the payload will not be accessible.
public_share_link
(String, URL) This URL will be present if your account has Share Links enabled. It is a permalink to the generated PDF.
Premium plan only
The share links feature is only available for Premium plans.