Docupilot
HomeLoginSignup
  • Docupilot Help Documentation
  • Getting Started
  • Building Templates
    • Tokens (Merge Field)
    • Document Builder
    • AI-Powered Template Builder
    • Word Document (DOCX) & PowerPoint (PPTX)
    • Excel (XLSX)
    • Fillable PDF
    • Template Preferences
    • Formatting Your Data
    • Numerical Calculations
    • Advanced usage
  • Test your document template
  • Deliveries
    • Email
    • Webhook
    • Dropbox
    • Google Drive
    • One Drive
    • DropboxSign (formerly Hellosign)
    • DocuSign
    • SignNow
    • Xodo sign (formerly Eversign)
    • Signable
    • Yousign
    • Amazon S3
    • Azure Blob Delivery
    • SFTP
  • Create document
    • Data Capture Form
    • API & Webhook Integration
    • Bulk Create
    • Integrate with Zapier
    • Integrate with Make
    • Integrate with Zoho Flow
    • Integrate with Integrately
  • Integrations
    • Google Forms
    • Google Sheets
    • Airtable Extension
    • Microsoft Word Add-In
  • Collaborating with multiple users
    • Invite users
    • Manage & delete users
  • Reports
  • Settings
    • Workspace
    • API Settings
    • Manage Subscription
    • Linked Accounts
  • Folders & Templates management
    • Manage Folders
    • Manage Templates
    • Share Templates & Folders
  • Profile & Account Security
  • Frequently Asked Questions (FAQs)
  • Developers
    • API Overview
    • Templates API
    • Folders API
  • Updates
    • Scheduled Downtime Notification
Powered by GitBook
On this page
  • Creating an API Endpoint
  • Using the API Endpoint
  • Quickstart with a CURL Script
  • Python
  • Deleting the API Endpoint

Was this helpful?

  1. Create document

API & Webhook Integration

Generate Documents using Webhooks & APIs

PreviousData Capture FormNextBulk Create

Last updated 18 days ago

Was this helpful?

Docupilot allows you to simplify your document generation process by integrating with other systems through Unauthenticated API endpoints which can also be configured as Webhooks in other applications.

Creating an API Endpoint

To create an API Endpoint, follow these steps:

  • Click on the Create tab to access the Create Document view and select API Integrations from the left sidebar.

  • Click on Create API Endpoint button to create the Url for document generation.

If you want to download the generated document along with triggering deliveries you need to append download=true query parameter in the URL.

If you want to receive the generated document as a file in response, append download=file query parameter in the URL. This will include the secure file URL in the Content-Location response header. If you do not prefer the secure file URL to be created, send an additional query parameter includeUrl=false. This will not return the Content-Location header in the response.

Using the API Endpoint

The API Endpoint can be configured in various locations – Ex: Configure it as a Webhook in your CRM, or configure it as a Webhook in your the Forms/Survey software you use, or configure this URL inside your custom built application, and send data to it.

For example, if this is your template:

Sample Template
Hello {{name}},

{{email}}
{{address}} {{state}} {{country}}

You should send a POST request to the API Endpoint, with Content-Type as application/json and body with JSON payload structured like in the example below:

Sample Request
Method: POST
URL: https://api.docupilot.app/documents/create/{org_unique}/{template_unique}/

Headers:
Content-Type: application/json

Body:
{
    "name":"John",
    "email":"johj@example.com",
    "address":"XYZ Street",
    "state":"CA",
    "country":"USA"
}

Please note that the tokens (merge fields) defined in the template should match the keys in the webhook data.

Sample response when at-least 1 delivery configured:

{
    "status": "success",
    "data": null
}

Sample response with no deliveries configured -or- with download=true query parameter

{
    "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"
    }
}

Sample response when download=file query parameter is appended

To avoid creating the Secure file URL, add the includeUrl=false parameter to the API Endpoint, which will remove the Content-Location from the API response header.

Quickstart with a CURL Script

The API Integration tab shows an example CURL request for the respective template.

Python

import requests

# update your API Endpoint URL here
api_endpoint = "https://api.docupilot.app/documents/create/46ac75c3/5e7d03ec"

payload = {
  "customer_name":"John",
  "customer_email":"john@example.com",
  "line_items":[
    {
      "description":"Design",
      "quantity":1,
      "price":"230"
    },
    {
      "description":"Development",
      "quantity":4,
      "price":"130"
    }
  ]
}
headers = {
  'Content-Type': "application/json"
}

response = requests.post(api_endpoint, data=payload, headers=headers)

print(response.text)

Deleting the API Endpoint

To delete the API Endpoint, click the Delete button available on the right side of the API Integrations section.

To create or delete these links, users must have Manage or Write permissions on the templates. Please note that deleting the API Endpoint link will also remove the link created for Data Capture Form.

When data is sent to the API Endpoint, it generates a Document and sends it to configured delivery locations. If no deliveries are configured, then it will return a secure file URL to download the generated document. This secure URL is valid for 24 hours by default which can be customized under .

Data Retention Preferences
Create an API Endpoint
API Integration
Returns the File in Body
Response includes Content-Location in Header
Sample CURL Script
Deleting API Endpoint