API & Webhook Integration
Generate Documents using Webhooks & APIs

Webhook Integration

You can configure webhook in your CRM, Forms to send data to Docupilot to create your document.

Webhook Endpoint

1
Http Method : POST
2
3
Content-Type : application/json
4
5
https://api.docupilot.app/documents/create/{org_unique}/{document_unique}
6
7
Sample Endpoint
8
https://api.docupilot.app/documents/create/46ac75c3/5e7d03ec
9
10
You can find this URL in Create section in template's details page.
Copied!
Sample Template
1
Hello {{name}},
2
3
{{email}}
4
{{address}} {{state}} {{country}}
5
Copied!
sample data in JSON format
1
{
2
"name":"John",
3
4
"address":"XYZ Street",
5
"state":"CA",
6
"country":"USA"
7
}
Copied!
Please note that the tokens(merge fields) defined in the template should match the keys in the webhook data.

API Integration

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

1
curl -X POST \
2
https://api.docupilot.app/documents/create/46ac75c3/5e7d03ec \
3
-H 'Content-Type: application/json' \
4
-d '{
5
"customer_name":"John",
6
"customer_email":"[email protected]",
7
"line_items":[
8
{
9
"description":"Design",
10
"quantity":1,
11
"price":"230"
12
},
13
{
14
"description":"Development",
15
"quantity":4,
16
"price":"130"
17
}
18
]
19
}'
Copied!

Python

1
import requests
2
3
url = "https://api.docupilot.app/documents/create/46ac75c3/5e7d03ec"
4
5
payload = {
6
"customer_name":"John",
7
"customer_email":"[email protected]",
8
"line_items":[
9
{
10
"description":"Design",
11
"quantity":1,
12
"price":"230"
13
},
14
{
15
"description":"Development",
16
"quantity":4,
17
"price":"130"
18
}
19
]
20
}
21
headers = {
22
'Content-Type': "application/json"
23
}
24
25
response = requests.post(url, data=payload, headers=headers)
26
27
print(response.text)
Copied!

API Response

API response with download parameter or no deliveries configured.
1
{
2
"status": "success",
3
"data": {
4
"file_url": "https://docupilot-documents.s3.amazonaws.com/temp/1a2cadd4-33f7-4f0c-9d9a-3e87803d3e7b/contract.pdf?AWSAccessKeyId=AKIAJTKZBQI56EOPGLFQ&Signature=BHG3mejXO3f1ymBcZVjMB04Sr6U%3D&Expires=1530277229",
5
"file_name": "contract.pdf"
6
}
7
}
Copied!
1
API response with deliveries configured.
2
3
{
4
"status": "success",
5
"data": null
6
}
Copied!