Skip to main content
All CollectionsIntegrationsAPI
API recipes: Upload, create, and send a document from a local PDF
API recipes: Upload, create, and send a document from a local PDF
M
Written by Marya Maksimchuk
Updated over a week ago

Availability: Enterprise*

* Additional volume charge will be applied for document generation via production API.

These instructions assume:

Create the original PDF

If you want to include PandaDoc native elements such as signature or text fields in your PDF-derived document, you’ll need to use either the PDF native form fields structure or add manual field tags to the PDF.

An example of form fields is available here.

An example of field tags is available here.

You can read more about the structure and respective benefits of form fields versus field tags in the Create document from PDF documentation. If you choose to use form fields, make sure you set "parse_form_fields": true; otherwise set "parse_form_fields": false.

Once you’ve finalized your PDF, you’re ready for the next step.

POST the document to PandaDoc

To inform PandaDoc to ingest and parse your PDF, use the following with content type multipart/form-data:

You should have two sections within your POST. First, the encoded content of your PDF file itself:

mceclip0.png

Second, a JSON block to identify the document:

mceclip1.png


The response will contain the document ID as the element “id”:

mceclip3.png

Wait for the document to enter draft status

See Listening for changes in document status. If you’re actively polling your document, the ID is “id” from the previous step.

Send the document

Once you’ve determined that the document has entered “document.draft” status, you can send it by adding the following ({id} is the document ID from above):

You can also include these optional parameters in your POST to set a subject line and body text:

mceclip5.png

Don’t set the “silent” parameter to “true” unless you don’t want an email to go out with the document link. For more information about why you might want to send silently, see “Create a document and share it in real-time.”

Note:

When sending documents via API, the sender is the person who generated the API key, even if the document was created on another member’s behalf. You can set up a different document sender by adding an email address or membership_id to the "Send document" body request.

Did this answer your question?