Upload and send a local PDF
This recipe assumes:
- You have authenticated via OAuth (see Authentication process) or have an API key (see API key authentication process)
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.
You can read more about the structure and respective benefits of form fields vs. field tags in the create document from pdf documentation. If you choose to use form fields, makes sure you set "parse_form_fields": true
, otherwise set "parse_form_fields": false
When you’ve finalized your PDF document you’re ready for the next step.
POST the Document to PandaDoc
To inform PandaDoc to ingest and parse your PDF use
POST https://api.pandadoc.com/public/v1/documents/
With content type multipart/form-data. You should have 2 sections within your POST: the encoded content of your PDF file itself
------BoundaryXXXXXXXXX
Content-Disposition: form-data; name="file"; filename="Sample PandaDoc PDF with Field Tags.pdf"
Content-Type: application/pdf
[file contents here]
------BoundaryXXXXXXXXX
and a JSON block to identify the Document
------BoundaryXXXXXXXXX
Content-Disposition: form-data; name="data"
{
"name": "My minimal document",
"url": "https://example.com/path/to/mydocument.pdf",
"recipients": [
{
"email":"[email protected]"
}
],
"parse_form_fields": false
}
------BoundaryXXXXXXXXX
The response will contain the document ID as the element “id”
{
"id":"XHjv8z3SfDuTseFSnhprML",
"name":"My minimal document",
"Status":"document.uploaded",
"date_created":"2021-07-05T15:05:27.787341Z",
"date_modified":"2021-07-05T15:05:27.787341Z",
"Expiration_date":null,
"Version":null,
"uuid":"XHjv8z3SfDuTseFSnhprML"
}
Wait for the Document to enter a draft status
See Listening for changes in document status. If you are actively polling your document 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 with a
POST https://api.pandadoc.com/public/v1/documents/{id}/send
Where {id} is the document ID from above. If you want you can include the optional parameters in your POST to set a subject line and body text
{
"message": "Hello! This document was sent from the PandaDoc API.",
"subject": "Please check this test API document from PandaDoc"
}
Do not 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”
Updated 10 months ago