Features

November 22, 2022

Screenshots by Webhook

No need to keep a request open while your screenshot is rendered

Jonathan Markwell
Jonathan Markwell
1 min read
Share this article:

Website screenshots, especially those of complex web pages do not render instantly. Keeping a request open for seconds when you're capturing loads of pages quickly adds up to minutes or hours spent waiting.

What if your app could send us 30 screenshot requests in less than a second? Your app could get on with what it's doing while Urlbox does its thing.

Now you can do just that by providing a webhoook endpoint for Urlbox to send your screenshot to.

"webhook_url": "https://example.com/your_webhook_url"

To keep overhead to a minimum you can (optionally) use a HEAD request like the following:

curl -I "https://api.urlbox.io/v1/32a24502-34b4-4d10-9284-f678c9ff4a42/bef9d473d40cb491a8446e6fdeba2688ed672d2a/png?webhook_url=https%3A%2F%2Fexample.com%2Fyour_webhook_url&url=https%3A%2F%2Fwww.bbc.co.uk%2Fnews%2Fbusiness-63709754&format=png"

Then, a few seconds later you'll receive something like this at your webhook endpoint:

{
  "meta": {
    "endTime": "2022-11-22T11:13:30.400Z",
    "startTime": "2022-11-22T11:13:24.650Z"
  },
  "event": "render.succeeded",
  "result": {
    "size": 503502,
    "renderUrl": "https://renders.urlbox.io/urlbox1/renders/5799274d37a8b4e60496ce39/2022/11/22/4382ca89-4dd6-4b3e-8a58-07f5c0c0bf27.png"
  },
  "renderId": "4382ca89-4dd6-4b3e-8a58-07f5c0c0bf27"
}

If you use a POST request you'll probably want to use the asynchronous endpoint:

https://api.urlbox.io/v1/render

rather than the synchronous one:

https://api.urlbox.io/v1/render/sync

This, of course, works great in combination with storing your renders in your own S3 bucket.

Index

All Features

Free Trial

Designers, law firms and infrastructure engineers trust Urlbox to accurately and securely convert HTML to images at scale. Experience it for yourself.