Enter your target URL:

Embed API

This API should can be used to embed thumbnails directly on your website. For the old API (not recommended), check this link.

Your API key and Secret can be found in the member section after you sign up for a free account.

Libraries

We provide a number of libraries and extensions for the major web frameworks and languages, along with code samples. Check out the libraries page.

API details

https://api.thumbalizr.com/api/v1/embed/EMBED_API_KEY/TOKEN/?url=https://www.google.com/&mode=page

TOKEN is the MD5 of the URL query string and secret:

TOKEN = md5(url=https://www.google.com/&mode=pageSECRET)

The list of options available is shown below. Only the url parameter is required, other values default to the option you choose in your profile.

Parameter value free silver gold platinum
api_key your key
url url
width (thumbnail) 1 - 2000 1-1280 1-1280 1-1600 1-2000
format (thumbnail) jpg, png
quality (for JPEG thumbnails only) 10 - 100
timestamp (generate a new thumbnail) any value not available
No watermark (thumbnail) watermark
size (full page or visible screen) page - screen screen
delay (time after page loaded) 1 - 30 5 5
bwidth (browser width) 1 - 2000 1280 1280 1-1600 1-2000
bheight (browser height) 1 - 1600 1024 1024 1-1600 1-2000
country (location of the browser) us, germany germany germany

You need to ensure that all parameters are encoded correctly, especially the url parameter.

timestamp: use a different timestamp to geenrate a new image. You can use any string but we recommend to use the current date: timestamp=2017-02-04:18:56:03

country: you can take screenshots from US or Germany. Contact us for other countries.

bwidth and bheight define the viewport of the browser.

Response

You can track the status of the screenshots through the HTTP headers sent back by thumbalizr.com:

X-Thumbalizr-Status: status of the screenshot:

  • QUEUED: screenshot is being processed
  • OK: screenshot is done, your received the thumbnail you requested
  • FAILED: screenshot has failed

X-Thumbalizr-Generated: date the screenshot was generated, for example 02 Apr 2014 11:03:24 GMT.

X-Thumbalizr-Error: reason why the screenshot failed.

Code samples

We provide a number of libraries and extensions for the major web frameworks and languages, along with code samples. Check out the libraries page.

PHP

<?php

function thumbalizr($url, $options = array()) {
	$embed_key = 'MY_EMBED_API_KEY'; # replace it with you Embed API key
	$secret = 'MY_SECRET'; # replace it with your Secret
	
	$query = 'url=' . urlencode($url);
	
	foreach($options as $key => $value) { 
		$query .= '&' . trim($key) . '=' . urlencode(trim($value)); 
		
	}
	
	
	$token = md5($query . $secret);
	

	return "https://api.thumbalizr.com/api/v1/embed/$embed_key/$token/?$query";
}


?>


<img src="<?php echo thumbalizr("https://browshot.com/", array('width' => 300, 'size' => 'page')); ?>" title="Screenshot done with Thumbalizr">
<img src="<?php echo thumbalizr("google.com"); ?>" title="Screenshot done with Thumbalizr">

Download code sample

Python

import hashlib
import urllib


def thumbalizr(url='', options={}):
  embed_key = 'MY_EMBED_API_KEY' # replace it with you Embed API key
  secret = 'MY_SECRET' # replace it with your Secret
  
  query = 'url=' + urllib.quote_plus(url)

  for key, value in options.items():
    query += '&' + key + '=' + urllib.quote_plus(str(value))
  
  
  token = hashlib.md5(query + secret).hexdigest()
  

  return "https://api.thumbalizr.com/api/v1/embed/%s/%s/?%s" % (embed_key, token, query)


print thumbalizr("https://browshot.com/", { 'width': 300, 'size': 'page' })
print thumbalizr("google.com")

Download code sample

Ruby

require 'url'
require 'digest'

def thumbalizr(url='', options={})
  embed_key = 'MY_EMBED_API_KEY' # replace it with you Embed API key
  secret = 'MY_SECRET' # replace it with your Secret
  
  query = 'url=' + CGI::escape(url.to_s)
  
  options.each_pair do |key, value|
    query += "&#{key}=" + CGI::escape(value.to_s)
  end
  
  token = Digest::MD5.hexdigest(query + secret)
  
  
  return "https://api.thumbalizr.com/api/v1/embed/#{embed_key}/#{token}/?#{query}"
end


puts thumbalizr("https://browshot.com/", {:width => 300, :size => 'page' })
puts thumbalizr("google.com")

Download code sample

Perl

#!/usr/bin/perl -w

use strict;
use warnings;
use Carp;

use URI::Escape qw(uri_escape);
use Digest::MD5 qw(md5_hex);
use Text::Trim;



print thumbalizr("https://browshot.com/", 'width' => 300, 'size' => 'page'), "\n";
print thumbalizr("google.com"), "\n";

exit(0);

sub thumbalizr  {
	my ($url, %options) = @_;
	
	my $embed_key = 'MY_EMBED_API_KEY'; # replace it with you Embed API key
	my $secret = 'MY_SECRET'; # replace it with your Secret
	
	my $query = 'url=' . uri_escape($url);

	foreach my $option (keys %options)  { 
		$query .= '&' . trim($option) . '=' . uri_escape(trim $options{$option}); 
	}
	
	
	my $token = md5_hex($query . $secret);
	

	return "https://api.thumbalizr.com/api/v1/embed/$embed_key/$token/?$query";
}

Download code sample

Bash

#!/bin/bash

EMBED_KEY="MY_EMBED_API_KEY" # replace it with you Embed API key
SECRET="MY_SECRET" # replace it with your Secret

URL="https://browshot.com/" # URL must be encoded appropriately
OPTIONS="width=300&size=page"

TOKEN=$(echo -n "url=$URL&$OPTIONS$SECRET" | md5sum | cut -d " " -f 1)

curl "https://api.thumbalizr.com/api/v1/embed/$EMBED_KEY/$TOKEN/?url=$URL&$OPTIONS"

# sh thumbalizr.sh > thumbnail.png

Download code sample