PDFMonkey main generation mechanism is asynchronous. Your Document is queued for generation and you can either use a webhook or call our API in a loop to get notified of the generation success.
The sync generation feature allows you to skip this, and simplify your workflow. It will queue the Document as usual but will wait for the generation to either succeed or fail before responding.
How does it work?
In order to use the sync feature, call the POST /api/v1/documents/sync endpoint when generating your Document.
Be careful that the response from the API call will be a DocumentCard and not a Document. This means that the payload property will not be included in the response and the properties like id or status will be accessible through document_card instead of document.
{"document_card": {"id":"12345678-1234-1234-1234-123456789012","app_id":"ID-OF-YOUR-WORKSPACE","document_template_id":"ID-OF-YOUR-TEMPLATE","document_template_identifier":"My Awesome 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"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" }}