- HTML to PDF APIConvert HTML and URLs into PDFsExtract PDF Form Data APIEasily extract data from PDFsWatermark PDF APIAdd custom watermarks to PDFsProtect PDF APISecure your PDFs with passwordCompress PDF APIReduce file size without losing qualityFlatten PDF APIFlatten PDFs to make form permanentDigital Signature APISend documents for signing
- API DocumentationAPI DocumentationFull REST API referenceNodeJS SDKClient library for Node.jsJava SDKClient library for JavaC# SDKClient library for C#PHP SDKClient library for PHPPython SDKClient library for Python
- Pricing
- Contact Us
Getting Started with Digital Signatures
Learn how to send documents for signature by preparing your document, creating an envelope, and managing the signing workflow.
Overview
This guide walks through the basic digital signing flow. We will prepare a document with signing fields, create an envelope using the generated document, send the envelope to the recipient, and track live updates using webhooks.
Prepare document for signing
The first step is to prepare a PDF document that contains the fields needed for the signing process. There are two ways to do this:
- Generate a new PDF from HTML using the HTML to PDF API with
enableFormFields: true. - Add form fields to an existing PDF using the Add Form Fields API using placeholder tags embedded in the document, or by specifying field positions and dimensions directly in the request without modifying the source PDF.
In this example, we will use the HTML to PDF API to prepare a PDF with:
- A text field for the recipient name
- A signature field where the recipient will sign
- A date field with the
pdfgate-auto-fill="true"attribute, which is automatically populated by the server with the signing date and time.
You can generate the PDF by sending the HTML and enabling form fields:
1curl -H "Content-Type: application/json" \2 -H "Authorization: Bearer YOUR_API_KEY" \3 --request POST \4 --data '{5 "pageSizeType": "a4",6 "html": "<html><body style=\"font-family: Arial, sans-serif; padding: 40px;\"><h2>Agreement</h2><p>This agreement is entered into between the company and the recipient. Please review the document and complete the required fields below.</p><div style=\"margin-top: 30px;\"><label>Full Name</label><br /><input type=\"text\" name=\"recipient-name\" style=\"width: 300px; height: 30px;\" /></div><div style=\"margin-top: 30px;\"><label>Signature</label><br /><pdfgate-signature-field name=\"signature\" style=\"width: 200px; height: 200px;\"></pdfgate-signature-field></div><div style=\"margin-top: 30px;\"><label>Date</label><br /><input type=\"datetime-local\" name=\"signature-date\" pdfgate-auto-fill=\"true\" style=\"width: 200px; height: 30px;\" /></div></body></html>",7 "enableFormFields": true,8 "jsonResponse": true,9 "preSignedUrlExpiresIn": 30010 }' \11 https://api.pdfgate.com/v1/generate/pdfOnce the PDF is generated, keep the returned document ID. You will use it in the next step when creating the envelope.
Create an envelope
After generating the document, create an envelope using the document ID from the previous step as the value of sourceDocumentId field. The envelope can accept multiple document and recipients for signing, however, in this example we will keep it simple and add only one document and one recipient.
1curl \2 -H "Content-Type: application/json" \3 -H "Authorization: Bearer YOUR_API_KEY" \4 --request POST \5 --data '{6 "requesterName": "PDFGate Team",7 "documents": [8 {9 "sourceDocumentId": "69c2da76486b40749734ab00",10 "name": "Agreement",11 "recipients": [12 {13 "email": "RECIPIENT_EMAIL",14 "name": "John Peterson"15 }16 ]17 }18 ]19 }' \20 https://api.pdfgate.com/envelopeSee the full API reference here: Create Envelope
Send envelope
Once the envelope is created, the next step is to send it. This will trigger the signing flow and deliver the signing request to the recipient’s email.
1curl \2 -H "Authorization: Bearer YOUR_API_KEY" \3 --request POST \4 https://api.pdfgate.com/envelope/{envelopeId}/sendSee the full API reference here: Send Envelope
After the envelope is sent, the recipient receives an email with a secure link to review and sign the document through the PDFGate signing interface.
Once the document is signed, the recipient receives a follow-up email that includes:
- The final signed document
- A detailed audit log with timestamps, IP address, and verification steps
You can view example outputs below:
Test Agreement
Test Agreement - Audit Log
Track live envelope updates using webhooks
To receive live updates about the signing flow, you can configure webhooks. This allows your application to react to important envelope events such as sending, or completion.
See the webhook documentation here: Webhooks documentation
Webhooks are the recommended way to keep your application in sync with envelope status changes in real time.