You can use our API Builder Tool to visually see how the most common parameters are used in the API requests!
https://api.pagelr.com or http://api.pagelr.com
The PageLr API uses simple Urls (Http GET) requests designed to minimize the amount of parameters required, every API parameter has a default value, except the uri
parameter that is required.
A minimum valid request looks like:
A request like this using all default parameters would return the full length page, captured in a viewport
The above example returned an image with a width of 1024 pixels, and the height corresponding to the full page.
If you want the same page capture but at a different size, you can get a scaled down version by append the desired image width e.g. &width=600
to the api call.
/capture?uri=apple.com&width=600
The above example returned an image with a width of 600 pixels, and the height corresponding to the full page scaled down from a width of 1024 pixels.
Now when you want different browser size for instance 128, and at a 4/3 aspect ratio can get a scaled down version by append the desired parameters e.g. &width=600&b_width=1280&height=450
to the url.
/capture?uri=apple.com&width=600&b_width=1280&height=450
Some web pages requires javascript to run for them to render their content. When loading and running JavaScript in a web page, it can slow down a page considerably. We do not enable JavaScript in the API per default to make sure you can get the quickest screenshot possible without any extra work.
To enable javascript when generating a page screenshot, add javascript to the service url, like:
/capture/javascript?uri=apple.com&width=600&b_width=1280&height=450
The uri
to the page you want to capture. If it contains anything more than a simple path it need to be urlencoded.
/capture?uri=apple.com&width=600&b_width=1280&height=450
/capture?uri=amazon.com%2Fb%3Fnode%3D5521637011&width=400&height=300
HTTP is used as default protocol in the request, if you require SSL/HTTPS you add that to the uri parameter.
/capture?uri=https://apple.com&width=600&b_width=1280&height=450
The viewport or browser width in pixels is defined by b_width
and is used layout and render the page. Default is 1024 pixels.
Most webpages are designed to fill up the width of a 1024 pixel wide screen, commonly with a content width around 980 pixels with
some space and chrome around.
To capture a page rendering at a larger width, e.g. 1280 pixels, add &b_width=1280
to the request.
/capture?uri=apple.com&width=600&b_width=1280&height=450
The width of the image returned, scaled down from the browser width,
if no width
is specified image will have the same width as the viewport (b_width
).
/capture?uri=apple.com**&width=600&**b_width=1280&height=450
The height of the image returned, if a width
is specified and is smaller than b_width
the image height will be scaled down with the same proportions as width/b_width.
/capture?uri=apple.com&width=600&b_width=1280&height=450
If no height
is specified in the request the image will have the full height of the web page, this is how you get a fullpage screenshot capture.
/capture?uri=apple.com&width=400&b_width=1280
/capture/javascript?uri=stripe.com&width=600&b_width=1280&height=450&delay=500
/capture?uri=stripe.com&width=600&b_width=1280&height=450
There are also pages that changes their look dynamically over time, with a slider or animations. To capture such a page at different points in time you can use the delay
parameter with different values.
Maximum delay
supported is 30 seconds, &delay=30000
.
If you need your screenshots with resolution optimizied for high resolution displays, e.g. retina displays.
The PageLr service has built in caching, there are two important reasons to avail of the caching in the service. Foremost it allows to server already captured images really fast, in fractions of a second, secondly captured screenshots served from the cache does NOT count against your Used Capture count in the subscriptions.
If for some reason you normally use default or bigger maxage, i.e. a week or a few days, but a cached image need to be updated before it becomes too old.
You can request the screenshot with the same parameters, and add &maxage=0
, this will refresh the image in the cache. After which your normal request will return
the fresh image, and you don't have to change any code or change the orginial request parameters.
/capture?uri=apple.com&width=400&b_width=1280&maxage=0
/capture?uri=apple.com&width=400&b_width=1280&format=jpg
When you need to capture screenshots without advertisement, maybe to avoid adult unrelated content, due to speed or whatnot you can specify &ads=0
in the request,
and request for content on the captured page coming from known adservers will be excluded.
The service currently blocks ads from this ad server list.
&key=1234ABCD1234ABCD1234ABCD1234ABCD
to your urls.
You can find your key in your subscription details at Manage Subscription