Webmaster API

Get your API key

You can find it on «Settings» page https://turbobit.net/user/settings
Also if you need links for hitfile.net, enable «Automatically upload files to all active services»
and «Automatically create and display links for hitfile.net» options

HTTP Upload

1. Get upload server details

[POST] https://turbobit.net/v001/upload/http/server

Headers
Key Value Description
X-API-KEY YOUR_API_KEY You can find api key on https://turbobit.net/user/settings page
Body
Key Value Description
none none none
Response
{
    "url": "http://s209.turbobit.net/uploadfile",
        "params": {
            "apptype": "fd1",
            "upload_info": "F+ZuaV6EN1a4cdftUSIX4ZwMCswN9jB58d0/"
        },
    "result": true
}

2. Upload file

[POST] server url (parameter from the previous query result)

Headers
Key Value Description
none none none
Body
Key Value Description
apptype fd1 Parameter from the previous query result
upload_info F+ZuaV6EN1a4cdftUSIX4ZwMCswN9jB58d0/ Parameter from the previous query result
folder_id 142 (optional) if your want upload file to a specific folder
Filedata file.zip Your file
Response
{
     "result":true,
     "id":"1i555e01nb3",
     "cid":"6dcUDq1",
     "message":"Everything is ok"
}

id - turbobit.net file id
cid - hitfile.net file id

Full example using PHP
reporting(E_ALL);
ini_set('display_errors', '1');


function turbobit_upload($apiKey, $file, $folderId = 0)
{
    // Get upload server
    $ch = curl_init('https://turbobit.net/v001/upload/http/server/');
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
    curl_setopt($ch, CURLOPT_POST, 1);
    curl_setopt($ch, CURLOPT_POSTFIELDS, array('api_key' => $apiKey));
    $postResult = curl_exec($ch);
    curl_close($ch);
    $res = json_decode($postResult);
    if (!$res->result) {
        print $res->message;
        return false;
    }

    // POST variables
    $postParams = array();
    foreach ($res->params as $field => $value) {
        $postParams[$field] = $value;
    }
    $postParams['folder_id'] = intval($folderId);
    if (function_exists('curl_file_create')) { // php 5.5+
        $postParams['Filedata'] = curl_file_create($file);
    } else { //
        $postParams['Filedata'] = '@' . realpath($file);
    }

    // Upload file
    $ch = curl_init($res->url);
    curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
    curl_setopt($ch, CURLOPT_POST, 1);
    curl_setopt($ch, CURLOPT_POSTFIELDS, $postParams);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
    $postResult = curl_exec($ch);
    if (curl_errno($ch)) {
        print curl_error($ch);
        print "Unable to upload file.";
       return false;
    }
    curl_close($ch);
    $res = json_decode($postResult, true);
    if (!($res['result'])) {
        print "Upload error:" . $res['message'];
        return false;
    }

    // Make file links from IDs
    $links = array();
    $links['turbobit'] = "https://turbobit.net/{$res['id']}.html";
    if (isset($res['cid'])) {
        $links['hitfiles'] = "https://hitfile.net/{$res['cid']}";
    }
    return $links;
}

$apiKey = 'YOUR_KEY';
// from https://turbobit.net/user/settings
$links = turbobit_upload($apiKey, '/home/user/tmp/file.zip', 0);
print_r($links);
/*

 Array
(
    [turbobit] => https://turbobit.net/1i555e01nb3.html
    [hitfiles] => https://hitfile.net/6dcUDq1
)
 */

Get file info

[GET] https://turbobit.net/v001/files/*fileId*

Headers
Key Value Description
X-API-KEY YOUR_API_KEY You can find api key on https://turbobit.net/user/settings page
Body
Key Value Description
none none none
Response
{
    "id":"nn9ll2t512ot",
    "name":"Archive.zip",
    "size":"1299992",
    "state":"active",
    "folder_id":"0",
    "created_date":"2018-09-17 23:58:00",
    "deleted_date":"2018-10-27 23:58:00"
}