Command line curl


Linux, Mac OS X, FreeBSD

Use of the API requires authentication with your API key. Your key is displayed in the right column in your dashboard. If you do not yet have an account, please register for a free account.

The simple API makes it easy to requests and retrieve screenshots with curl.

Browshot will send 302 redirections, so you need to use the -L option to follow them. To request a screenshot of the website http://mobilito.net/ with the default option, and save the image to /tmp/mobilito.png, use:

$ curl -L "https://api.browshot.com/api/v1/simple?url=http://mobilito.net/&key=my_api_key" -o /tmp/mobilito.png
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100  188k  100  188k    0     0   5692      0  0:00:33  0:00:33 --:--:--  118k

$ file /tmp/mobilito.png
/tmp/mobilito.png: PNG image data, 1024 x 768, 8-bit/color 
RGB, non-interlaced

You can use any of the options listed on the API page to get thumbnails of different sizes, to use different browsers, etc. Here are some common use cases:

Full page

By default, the screenshot of the screen is taken. To take a screenshot of the full page, add size=page:

$ curl -L "https://api.browshot.com/api/v1/simple?url=http://mobilito.net/&key=my_api_key&width=640&size=page" -o /tmp/mobilito.png

Thumbnail

To have a thumbnail with a width of 640 pixels, same as ratio as the original browser, add the parameter width=640 to the URL:

$ curl -L "https://api.browshot.com/api/v1/simple?url=http://mobilito.net/&key=my_api_key&width=640" -o /tmp/mobilito.png

You can also choose to specify both the width and height for the thumbnail:

$ curl -L "https://api.browshot.com/api/v1/simple?url=http://mobilito.net/&key=my_api_key&width=640&height=480" -o /tmp/mobilito.png

Choose a virtual browser

Browshot offers a large choice of Mobile browsers (iPhone, iPad, Nook, etc.) and Desktop resolutions (60x480 to 1920x1200). You can pick the browser to use for the screenshots from you dashboard or you can get the list in a programmatic manner from the API.

For example, to create a screenshot of http://mobilito.net/ from a virtual iPhone4 held vertically, pick the instance #22:

$ curl -L "https://api.browshot.com/api/v1/simple?url=http://mobilito.net/&key=my_api_key&instance_id=22" -o /tmp/mobilito.png

Another way to pick up a virtual browser is to specify the screen resolution, for example screen=1024x768:

$ curl -L "https://api.browshot.com/api/v1/simple?url=http://mobilito.net/&key=my_api_key&screen=1024x768" -o /tmp/mobilito.png

 

All the options can be combined. You can get the full list on the API page.


close

Sign up for a free account