Skip to main content
Version: 6.x

Webhook

All endpoints accept a form field named webhookURL.

If provided, the API will send the resulting PDF file in a POST request with the application/pdf Content-Type to given URL.

By doing so, your requests to the API will be over before the conversions are actually done!

Examples#

curl --request POST \     --url http://localhost:3000/convert/html \     --header 'Content-Type: multipart/form-data' \     --form files=@index.html \     --form webhookURL='http://myapp.com/webhook/'

Timeout#

If a webhookURL is provided, you may also send a form field named webhookURLTimeout.

The API will wait the given seconds before it considers the sending of the resulting PDF to be unsucessful.

It takes a float as value (e.g 2.5 for 2.5 seconds).

tip

You may also define this value globally: see the environment variables section.

curl --request POST \     --url http://localhost:3000/convert/html \     --header 'Content-Type: multipart/form-data' \     --form files=@index.html \     --form webhookURL='http://myapp.com/webhook/' \     --form webhookURLTimeout=2.5

Custom HTTP headers#

You may send your own HTTP headers to the webhookURL.

For instance, by adding the HTTP header Gotenberg-Webhookurl-Your-Header to your request, the API will send a request to the webhookURL with the HTTP header Your-Header.

caution

The API uses a canonical format for the HTTP headers: it transforms the first letter and any letter following a hyphen to upper case; the rest are converted to lowercase. For example, the canonical key for accept-encoding is Accept-Encoding.

curl --request POST \     --url http://localhost:3000/convert/html \    --header 'Content-Type: multipart/form-data' \    --header 'Gotenberg-Webhookurl-Your-Header: Foo' \     --form files=@index.html \     --form webhookURL='http://myapp.com/webhook/'