Webhooks
Webhooks allow you to receive real-time notifications for specific events in your account. This can be useful for integrating PDF-API.io with your own systems or third-party services.
Available Events
Currently, the following event is supported:
pdf.created
: Triggered when a new PDF is generated from one of your templates.
Managing Webhooks
You can manage your webhooks through the web interface of PDF-API.io.
Web Interface
To manage your webhooks:
- Log in to your PDF-API.io account.
- Navigate to the Webhooks page.
- Here you can view existing webhooks, create new ones, or delete existing ones.
Creating a Webhook
When creating a webhook, you need to specify the following information:
Event
: The name of the event you want to listen for (e.g.,pdf.created
).URL
: The URL where you want to receive the webhook payload.Template
(optional): If you want to receive notifications only for a specific template, you can select it from the dropdown.
Webhook Payload
When an event occurs, we'll send a POST request to your specified URL with a JSON payload. The payload will include information about the event and any relevant data.
For the
pdf.created
event, the payload will look like this:
{
"type": "pdf.created",
"data": {
"template_id": "template_id",
"pdf": "base64_encoded_pdf_content"
}
}
When the PDF is generated with the output parameter set to "url", the payload will be slightly different. Instead of including the base64-encoded PDF content, it will provide a URL where the generated PDF can be downloaded. Here's an example of the payload in this case:
{
"type": "pdf.created",
"data": {
"template_id": "template_id",
"url": "https://link.to.pdf"
}
}
In this scenario, the
url
field contains a temporary URL where you can download the generated PDF. This URL is valid for a limited time. Make sure to download the PDF or process it as soon as possible after receiving the webhook, as the link will expire after 15 minutes.
Retry Mechanism
If your webhook endpoint is temporarily unavailable, we will retry sending the webhook payload up to 3 times with an exponential backoff strategy.