Webhooks
Webhooks allow you to receive real-time HTTP notifications when events occur in your PDF-Sign account.
Plan Availability
Webhooks are available on Pro, Scale, and Enterprise plans.
Overview
When you configure a webhook, PDF-Sign will send an HTTP POST request to your specified URL whenever a subscribed event occurs. This enables you to:
- Automate workflows - Trigger actions in your system when PDFs are generated
- Monitor failures - Get instant alerts when PDF generation fails
- Track usage - Receive warnings when approaching quota limits
- Integrate seamlessly - Connect PDF-Sign with your existing tools and services
Quick Start
1. Create a Webhook
- Log in to your PDF-Sign Dashboard
- Navigate to Developer → Webhooks
- Click Create Webhook
- Enter your endpoint URL (must be HTTPS)
- Select the events you want to subscribe to
- Save your webhook and note the generated secret
2. Handle Webhook Requests
Your endpoint will receive POST requests with a JSON payload:
{
"event": "pdf.generated",
"timestamp": "2024-01-15T10:30:45.123Z",
"data": {
"template_id": "uuid",
"pdf_url": "https://api.pdf-sign.com/storage/...",
"file_size": 156789,
"render_time_ms": 2450
}
}
3. Verify the Request
Always verify the X-Webhook-Secret header matches your webhook secret:
const secret = req.headers['x-webhook-secret'];
if (secret !== process.env.WEBHOOK_SECRET) {
return res.status(401).send('Unauthorized');
}
Available Events
| Event | Description |
|---|---|
pdf.generated | A PDF was successfully generated |
pdf.failed | PDF generation failed |
quota.warning | Usage reached 80% of monthly quota |
quota.exceeded | Monthly quota limit was reached |
See Events for detailed payload information.
Webhook Headers
Each webhook request includes these headers:
| Header | Description |
|---|---|
Content-Type | Always application/json |
X-Webhook-Secret | Your webhook secret for verification |
X-Webhook-Event | The event type (e.g., pdf.generated) |
X-Webhook-Timestamp | Unix timestamp of the request |
User-Agent | PDF-Sign-Webhook/1.0 |
Testing Webhooks
You can send a test webhook from the dashboard:
- Go to Developer → Webhooks
- Find your webhook in the list
- Click the menu (three dots) → Send Test
The test payload looks like:
{
"event": "test",
"timestamp": "2024-01-15T10:30:45.123Z",
"data": {
"message": "This is a test webhook from PDF-Sign",
"webhook_id": "uuid",
"webhook_name": "My Webhook",
"subscribed_events": ["pdf.generated", "pdf.failed"]
}
}
Best Practices
- Respond quickly - Return a 2xx status within 5 seconds
- Process asynchronously - Queue long-running tasks instead of blocking
- Handle duplicates - Use idempotent processing in case of retries
- Verify secrets - Always validate the
X-Webhook-Secretheader - Use HTTPS - Webhook URLs must use HTTPS for security
Example Endpoint
Here's a complete example of a webhook endpoint in Node.js:
const express = require('express');
const app = express();
app.use(express.json());
app.post('/webhooks/pdf-sign', (req, res) => {
// Verify webhook secret
const secret = req.headers['x-webhook-secret'];
if (secret !== process.env.PDF_SIGN_WEBHOOK_SECRET) {
return res.status(401).json({ error: 'Invalid secret' });
}
const { event, timestamp, data } = req.body;
switch (event) {
case 'pdf.generated':
console.log(`PDF generated: ${data.pdf_url}`);
// Process the generated PDF...
break;
case 'pdf.failed':
console.error(`PDF generation failed: ${data.error_message}`);
// Handle the error...
break;
case 'quota.warning':
console.warn(`Quota warning: ${data.percentage}% used`);
// Send alert to team...
break;
case 'quota.exceeded':
console.error('Quota exceeded!');
// Upgrade plan or pause operations...
break;
}
res.status(200).json({ received: true });
});
app.listen(3000);