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.
fetch is trickier to use than wget and curl because it does not follow all redirections. Instead of one command to retrieve the screenshot with the simple API, you will need to run a small loop:
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:
$ FILE="/tmp/mobilito.png"; for I in {1..10}; do fetch -o $FILE "https://api.browshot.com/api/v1/simple?url=http://mobilito.net/&key=my_api_key";
if [ -e $FILE ] ; then break; fi ; done;
fetch: https://api.browshot.com/api/v1/simple?url=http://mobilito.net/6&key=my_api_key: Moved Temporarily
fetch: https://api.browshot.com/api/v1/simple?url=http://mobilito.net/6&key=my_api_key: Moved Temporarily
fetch: https://api.browshot.com/api/v1/simple?url=http://mobilito.net/6&key=my_api_key: Moved Temporarily
/tmp/mobilito.png 100% of 5055 B 31 MBps
$ file /tmp/mobilito.png
/tmp/mobilito.png: PNG image data, 1024 x 768, 8-bit/color
RGB, non-interlaced
This runs the same command up to 10 times until the screenshot is sent back by Browshot and saved to disk.
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:
By default, the screenshot of the screen is taken. To take a screenshot of the full page, add size=page:
$ FILE="/tmp/mobilito.png"; for I in {1..10}; do fetch -o $FILE "https://api.browshot.com/api/v1/simple?url=http://mobilito.net/&key=my_api_key&width=640&size=page"; if [ -e $FILE ] ; then break; fi ; done;
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:
$ FILE="/tmp/mobilito.png"; for I in {1..10}; do fetch -o $FILE "https://api.browshot.com/api/v1/simple?url=http://mobilito.net/&key=my_api_key&width=640"; if [ -e $FILE ] ; then break; fi ; done;
You can also choose to specify both the width and height for the thumbnail:
$ FILE="/tmp/mobilito.png"; for I in {1..10}; do fetch -o $FILE "https://api.browshot.com/api/v1/simple?url=http://mobilito.net/&key=my_api_key&width=640&height=480"; if [ -e $FILE ] ; then break; fi ; done;
Browshot offers a large choice of Mobile browsers (iPhone, iPad, Android, etc.) and Desktop resolutions (up to 5000x10000). 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:
$ FILE="/tmp/mobilito.png"; for I in {1..10}; do fetch -o $FILE "https://api.browshot.com/api/v1/simple?url=http://mobilito.net/&key=my_api_key&instance_id=22"; if [ -e $FILE ] ; then break; fi ; done;
Another way to pick up a virtual browser is to specify the screen resolution, for example screen=1024x768:
$ FILE="/tmp/mobilito.png"; for I in {1..10}; do fetch -o $FILE "https://api.browshot.com/api/v1/simple?url=http://mobilito.net/&key=my_api_key&screen=1024x768"; if [ -e $FILE ] ; then break; fi ; done;
All the options can be combined. You can get the full list on the API page.
no credit card required
Browshot is a web service to create real time web screenshots in a multitude of virtual devices, including mobile devices like the iPhone 3 & 4, iPad, Android Nexus, etc.
You can use the web dashboard, or our full-featured API.
Real time screenshots
15+ mobile devices: iPhone, iPad, Android, etc.
30+ desktop resolutions
Fast and reliable
Thumbnails of any size, any ratio
Full API, open-source libraries