Webshot Documentation

Introduction

Webshot API Introduction

Snapito supports a simple copy/paste integration using our standard URL based API. Please note that if you plan on saving images to your server (using fopen() or file_get_contents() or cURL), you need to also make sure you check the response headers for “404 Not Ready” to avoid saving “queued” or “error” thumbnails.

http://api.snapito.io/v2/webshot/<api-key>?url=<URL>&size=<size>[advanced parameters]

Back To Top

Basic Usage

Basic Parameters

URL

The url parameter should be URL encoded (i.e. percentage encoding) before supplying it to us.

The http:// component is optional.

http://api.snapito.io/v2/webshot/<api-key>?url=cnn.com

Sizes

Snapito supports the following pre built sizes: Default: 120×90

Size Value Description Dimensions
full Full Page 1024×0
lc Large Cropped 1024×768
mc Medium Cropped 800×600
sc Small Cropped 320×240
tc Thumbnail Cropped 120×90
th Thumbnail 120×0
http://api.snapito.io/v2/webshot/<api-key>?size=full&url=cnn.com
http://api.snapito.io/v2/webshot/<api-key>?size=sc&url=cnn.com

You can also specify a custom size, in pixels: <width>x<height>.

http://api.snapito.io/v2/webshot/<api-key>?size=900x200&url=cnn.com

 

Back To Top

Advanced Usage

Advanced Parameters

Advanced (Adv)

Developer Note: If building a custom integration, app, or plugin, use the “adv” parameter to make an advanced request that will return an XML or JSON encoded response containing the image location for retrieval and any details about status, error conditions, remaining usage limits, etc. Default: embedded image

http://api.snapito.io/v2/webshot/<api-key>?url=<URL>&adv=json

If you are seeking a more powerful, scripted integration, check out ShrinkTheWeb’s PagePix Website Screenshot service.

Cache

The cache parameter tells us approximately how old, in seconds, you are happy for the screenshot to be (e.g. cache=86400 for anything up to one day). A value of cache=-1 will generate a new webshot. Default: “yes” (2592000)

  • If the webshot comes from our cache, response times can be significantly faster – assuming the webshot is already in the cache.
  • There is a five minute wait time before a new webshot will be generated. If you do request one during this period, you’ll receive the cached image or a “queued” placeholder.
http://api.snapito.io/v2/webshot/<api-key>?url=cnn.com&cache=no

The following presets are also available:

Preset Description Actual value
no Generate new image -1
yes Within a month 2592000
true Within a month 2592000
recent Within last 15 minutes 900
hour Within last hour 3600
day Within last 24 hours 86400
week Within last 7 days 604800
month Within last 30 days 2592000
http://api.snapito.io/v2/webshot/<api-key>?url=cnn.com&cache=recent

Delay

The delay parameter delay=5 tells Snapito how long, in seconds, to delay the rendering of the snapshot, maximum of 45 seconds. This is helpful if you have items on the page that need more time to load. This is not needed for slow-loading sites, as we will wait up to 120 seconds for a site to load. However, sometimes things load “after” a site is officially loaded (like Flash, ads, video, external content, CDN-hosted elements, iframes, certain types of redirects, etc) and this feature overcomes that issue. Default: 0

http://api.snapito.com/v2/webshot/<api-key>?url=cnn.com&delay=10

Quality

The quality parameter expresses your preference of quality vs speed & size. The acceptable values are any number between 1 to 100 (omit the % sign). Default: 95

http://api.snapito.com/v2/webshot/<api-key>?url=cnn.com&quality=95

Screen

The screen parameter specifies the size of the browser screen (viewport) that is capturing the web page. This value can be in the width x height format. Default: 1024×768

http://api.snapito.com/v2/webshot/<api-key>?url=cnn.com&screen=1024x768

Pre-defined screen values have been deprecated, since everyone passes the specific resolution they want.

Reload

The reload parameter tells the system to load the URL, accept all cookies (normally blocked for security), close, reopen the URL, and then capture and save. This feature overcomes “first-time visit” popups, overlays, and lightboxes in many cases. You may “reload” up to X times. Default: 0

http://api.snapito.com/v2/webshot/<api-key>?url=cnn.com&reload=1

Note: Each reload is a full process, so it will delay your capture by the multiple of reloads requested.

Type (deprecated)

The type parameter tells Snapito what format to render the image in, the default is type=jpg at 95%. At some point, we may add type=png for lossless, high quality captures.

http://api.snapito.com/v2/webshot/<api-key>?url=cnn.com&type=jpg

Back To Top