Comment on page
API & Webhook Integration
Generate Documents using Webhooks & APIs
You can configure webhook in your CRM, Forms to send data to Docupilot to create your document.
Http Method : POST
Content-Type : application/json
https://api.docupilot.app/documents/create/{org_unique}/{document_unique}
Sample Endpoint
https://api.docupilot.app/documents/create/46ac75c3/5e7d03ec
You can find this URL in Create section in template's details page.
Sample Template
Hello {{name}},
{{email}}
{{address}} {{state}} {{country}}
sample data in JSON format
Please note that the tokens(merge fields) defined in the template should match the keys in the webhook data.
If you want to download the created document along with triggering deliveries you need to append download=true parameter in the URL. A secure file url with 24 hour expiry is provided to download the document.
https://api.docupilot.app/documents/create/{org_unique}/{template_unique}?download=true
If you want to download the created document directly along with triggering deliveries you need to append download=file parameter in the URL. The created document is returned in the API response.
https://api.docupilot.app/documents/create/{org_unique}/{template_unique}?download=file
curl -X POST \
https://api.docupilot.app/documents/create/46ac75c3/5e7d03ec \
-H 'Content-Type: application/json' \
-d '{
"customer_name":"John",
"customer_email":"[email protected]",
"line_items":[
{
"description":"Design",
"quantity":1,
"price":"230"
},
{
"description":"Development",
"quantity":4,
"price":"130"
}
]
}'
import requests
url = "https://api.docupilot.app/documents/create/46ac75c3/5e7d03ec"
payload = {
"customer_name":"John",
"customer_email":"[email protected]",
"line_items":[
{
"description":"Design",
"quantity":1,
"price":"230"
},
{
"description":"Development",
"quantity":4,
"price":"130"
}
]
}
headers = {
'Content-Type': "application/json"
}
response = requests.post(url, data=payload, headers=headers)
print(response.text)
API response with download parameter or no deliveries configured.
{
"status": "success",
"data": {
"file_url": "https://docupilot-documents.s3.amazonaws.com/temp/1a2cadd4-33f7-4f0c-9d9a-3e87803d3e7b/contract.pdf?AWSAccessKeyId=AKIAJTKZBQI56EOPGLFQ&Signature=BHG3mejXO3f1ymBcZVjMB04Sr6U%3D&Expires=1530277229",
"file_name": "contract.pdf"
}
}
API response with deliveries configured.
{
"status": "success",
"data": null
}
Last modified 3yr ago