Create and share a document in realtime
Prerequisites
- You have authenticated via OAuth (see Authentication process) or have an API key (see API key authentication process).
- You have created a template (see Save time with templates).
Get your template ID
In the PandaDoc app, navigate to the template you would like to use for this particular document. When you are viewing the template the ID is the final part of the URL. For example, in
https://app.pandadoc.com/a/#/templates/ustHNnVaPCD6MzuoNBbZ8L the template ID is “ustHNnVaPCD6MzuoNBbZ8L”
Structure your Document details
Use the create document endpoint description to decide what metadata and details you need to pass to your document. The simplest possible document schema consists of a name, template ID, and at least one recipient. Include your template ID under “template_uuid”
{
"name": "My minimal document",
"template_uuid": "ustHNnVaPCD6MzuoNBbZ8L",
"recipients": [
{
"email":"[email protected]"
}
]
}
Create the Document
Using your authentication token or API key, and the Content-type: application/json
POST https://api.pandadoc.com/public/v1/documents
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 draft status
See Listening for changes in document status. If you are actively polling your document ID is “id” from the previous step.
Update the Document to Sent status
Even though you don’t plan to send this Document via email, it’s still necessary to move it to “sent” status to lock in changes from the draft and enable a shared session. If you don’t want an email to go out as part of this process you can use the "silent": true
option in the sending endpoint.
POST https://api.pandadoc.com/public/v1/documents/{id}/send
Where {id} is the document ID from above.
{
"silent": true
}
Generate a shared session
After the Document is updated to “Sent” you can generate a shared session ID
POST https://api.pandadoc.com/public/v1/documents/{id}/session
Where {id} is the document ID from above.
{
"recipient": "[email protected]",
"lifetime": 90000
}
You must choose a recipient, even though this won’t be used in silent mode. Lifetime determines the number of seconds that the document link will live for and is optional. It will default to 3600 seconds.
This endpoint will respond with an ID and expiration timestamp
{
"id": "QYCPtavst3DqqBK72ZRtbF",
"expires_at": "2022-08-29T22:18:44.315Z"
}
Embed the shared session in your page or app
This process creates a page at
https://app.pandadoc.com/s/{id}
where {id} in this instance is QYCPtavst3DqqBK72ZRtbF
from above. This page can be embedded in an iframe in your application, or you can send it to recipients to open directly. Learn more: Embedded Signing.
Updated 10 months ago