API Reference and Developer Documentation

HTTP Status Codes

A successful optimization run will result in the 200 OK HTTP status code:

HTTP/1.1 200 OK

{
    "success": true,
    "file_name": "header.png",
    "original_size": 324520,
    "kraked_size": 165358,
    "saved_bytes": 159162,
    "original_width": 640,
    "original_height": 480,
    "kraked_url": "http://dl.kraken.io/ec/df/a5/c55d5668b1b5fe9e420554c4ee/header.png"
}

Sending invalid JSON will result in a 400 Bad Request response:

HTTP/1.1 400 Bad Request

{
    "success": false,
    "message": "Incoming request body does not contain a valid JSON object"
}

Sending an invalid API Key or API Secret will result in a 401 Unauthorized response:

HTTP/1.1 401 Unauthorized

{
    "success": false,
    "message": "Unnknown API Key. Please check your API key and try again"
}

When a Kraken.io account is overdue the request will result in a 402 Payment Required response:

HTTP/1.1 Payment Required

{
    "success": false,
    "message": "Your account is overdue. Please log in to your account to settle outstanding invoice(s)."
}

When a Kraken.io account is suspended the request will result in a 403 Forbidden response:

HTTP/1.1 403 Forbidden

{
    "success": false,
    "message": "Your account has been temporarily suspended"
}

Uploading a file with a file size larger than that set by your plan's limit will result in a
413 Request Entity Too Large response:

HTTP/1.1 413 Request Entity Too Large

{
    "success": false,
    "message": "File size too large. The maximum file size is 33554432 bytes (32 MB)"
}

Uploading an unsupported image type will result in a 415 Unsupported Media Type response:

HTTP/1.1 415 Unsupported Media Type

{
    "success": false,
    "message": "File type not supported"
}

Sending invalid JSON properties will result in a 422 Unprocessable Entity response:

HTTP/1.1 422 Unprocessable Entity

{
    "success": false,
    "message": "You need to specify either callback_url or wait flag"
}

Any unexpected server error will result in a standard 500 Internal Server Error response:

HTTP/1.1 500 Internal Server Error

{
    "success": false,
    "message": "Kraken.io has encountered an unexpected error and cannot fulfill your request"
}