Webhook & Download
Handle long-running processes or fetch external assets without keeping persistent connections open.
Webhooks
By default, Gotenberg handles requests synchronously: you send a file, wait, and get a PDF back. However, for large files or batch operations, you may prefer an asynchronous workflow.
When Webhook headers are provided:
- Gotenberg immediately validates the request.
- Returns a
204 No Contentresponse. - Processes the conversion in the background.
- Uploads the resulting PDF to the URL specified in
Gotenberg-Webhook-Url.
You can customize retries, timeouts, and allowed URLs. See the Webhook module configuration for details.
Tools like PipeDream or Webhook.site are excellent for testing these callbacks without setting up a dedicated server.
NoneNonePOSTPOSTNonecurl \
--request POST http://localhost:3000/forms/chromium/convert/url \
--header 'Gotenberg-Webhook-Url: https://my.webhook/success' \
--header 'Gotenberg-Webhook-Error-Url: https://my.webhook/error' \
--header 'Gotenberg-Webhook-Extra-Http-Headers: {"Authorization": "Bearer 123"}' \
--form url=https://my.url
- 204 No Content
- 400 Bad Request
- 403 Forbidden
- Success Callback
- Error Callback
Content-Type: text/plain; charset=UTF-8
Gotenberg-Trace: {trace}
Body: {error}
Content-Type: text/plain; charset=UTF-8
Gotenberg-Trace: {trace}
Body: Forbidden
Content-Disposition: attachment; filename={output-filename.ext}
Content-Type: {content-type}
Content-Length: {content-length}
Gotenberg-Trace: {trace}
User-Agent: Gotenberg
Body: {output-file}
Content-Type: application/json; charset=UTF-8
Gotenberg-Trace: {trace}
User-Agent: Gotenberg
{
"status": "{status}",
"message": "{message}"
}
Download From
All multipart/form-data endpoints accept the downloadFrom form field. This allows you to instruct Gotenberg to fetch files from remote URLs (e.g., S3, Azure Blob, or an internal CDN) instead of uploading them directly.
This feature is enabled by default. It can be disabled via the API_DISABLE_DOWNLOAD_FROM environment variable.
For further details, refer to the API module configuration.
Object Structure
The downloadFrom field accepts a JSON-formatted array. Each item in the array must be an object with the following keys:
| Key | Description | Default |
|---|---|---|
url | URL of the file. The remote server MUST return a Content-Disposition header with a filename parameter. | Required |
extraHttpHeaders | A JSON object containing extra HTTP headers to send when fetching this specific URL. | None |
embedded | Whether this file should be embedded. | false |
Currently, a bug in Go prevents Gotenberg from parsing responses with an empty media type.
AWS S3 Users: Ensure your S3 objects have the Content-Disposition metadata set (e.g., attachment; filename="doc.pdf") to avoid this issue.
Nonecurl \
--request POST http://localhost:3000/forms/libreoffice/convert \
--form 'downloadFrom=[{
"url": "http://url/to/file.docx",
"extraHttpHeaders": {
"X-My-Header": "MyValue"
}
}]' \
-o my.pdf
- 400 Bad Request
- 403 Forbidden
Content-Type: text/plain; charset=UTF-8
Gotenberg-Trace: {trace}
Body: {error}
Content-Type: text/plain; charset=UTF-8
Gotenberg-Trace: {trace}
Body: Forbidden
