API Reference and Developer Documentation

API Sandbox

Our API Sandbox is designed to allow you to take all the time you need to integrate with our API. Our endpoints will parse your request, validate your JSON, process uploads, etc. Everything will reflect production usage on a fully-featured Kraken.io API plan apart from the actual optimization process itself. Instead Kraken.io API will return randomized optimization results. To use the API Sandbox in developer mode, set a parameter "dev": true.

    "auth": {
        "api_key": "your_api_key",
        "api_secret": "your_api_secret"
    "url": "https://example.com/image.png",
    "wait": true,
    "dev": true


$kraken = new Kraken("your_api_key", "your_api_secret");

$params = array(
    "url" => "https://example.com/image.png",
    "wait" => true,
    "dev" => true

$data = $kraken->url($params);

if ($data["success"]) {
    echo "Success. Optimized image URL: " . $data["kraked_url"];
} else {
    echo "Fail. Error message: " . $data["message"];
var Kraken = require("kraken");

var kraken = new Kraken({
    "api_key": "your_api_key",
    "api_secret": "your_api_secret"

var params = {
    url: "https://example.com/image.png",
    wait: true,
    dev: true

kraken.url(params, function(status) {
    if (status.success) {
        console.log("Success. Optimized image URL: %s", status.kraked_url);
    } else {
        console.log("Fail. Error message: %s", status.message);
require 'rubygems'
require 'kraken-io'

kraken = Kraken::API.new(
    :api_key => 'your_api_key',
    :api_secret => 'your_api_secret'

params = {
    :wait => true,
    :dev => true

data = kraken.url('https://example.com/image.png', params)

if data.success
    puts 'Success! Optimized image URL: ' + data.kraked_url
    puts 'Fail. Error message: ' + data.message
package main

import (

func main() {
    kr, err := kraken.New("your_api_key", "your_api_secret")

    if err != nil {

    params := map[string]interface {} {
        "url": "https://example.com/image.png"
        "wait": true,
        "dev": true

    data, err := kr.URL(params)

    if err != nil {

    if data["success"] != true {
        log.Println("Failed, error message ", data["message"])
    } else {
        log.Println("Success, Optimized image URL: ", data["kraked_url"])
using Kraken;
using Kraken.Http;

//The difference from other examples is the third parameter
//that enables the sandbox mode.
var connection = Connection.Create("your_api_key", "your_api_secret", true);
var client = new Client(connection);
var response = client.OptimizeWait(
    new Uri("https://example.com/image.png")

if (response.Result.StatusCode == HttpStatusCode.OK) {
    var url = response.Result.Body.KrakedUrl;
from krakenio import Client

api = Client('your_api_key', 'your_api_secret')

data = {
    'wait': True,
    'dev': True

result = api.url('https://example.com/image.png', data);

if result.get('success'):

Free Testing Quota

Once you have completed integration with our API, you can perform real live tests which will yield optimized images, using the free 100 MB quota you receive with your Free account.

To perform real optimizations on your Free account simply remove "dev": true property from your JSON request or set this property to "dev": false.