bestdebrid API Documentation


  • Methods are grouped by namespaces (e.g. "unrestrict", "user").
  • Supported HTTP verbs are GET, POST, PUT, and DELETE. If your client does not support all HTTP verbs you can overide the verb with X-HTTP-Verb HTTP header.
  • Unless specified otherwise in the method's documentation, all successful API calls return an HTTP code 200 with a JSON object.
  • Errors are returned with an HTTP code 4XX or 5XX, a JSON object with properties "error" (an error message) and "error_code" (optional, an integer).
  • Every string passed to and from the API needs to be UTF-8 encoded. For maximum compatibility, normalize to Unicode Normalization Form C (NFC) before UTF-8 encoding.
  • The API sends ETag headers and supports the If-None-Match header.
  • Dates are formatted according to the Javascript method date.toJSON.
  • Unless specified otherwise, all API methods require authentication.

The Base URL of the Rest API is:

https://bestdebrid.com/api/v1/

GET /newkey

request new api key

Disable current access token, generate a new one for your account

Parameters:
  Name Type Description
GET pass string Your account password
Return value:

true

Possible HTTP error codes:
HTTP Status Code Reason
401 argument missed
401 Bad token (expired, invalid) or invalid password

GET /time

Get server time

Get server time, raw data returned. This request do not require authentication.

Return value:

Y-m-d H:i:s

/user

GET /user

Get current user info

Returns some informations on the current user.

Return value:

User show schema

Possible HTTP error codes:
HTTP Status Code Reason
401 Bad token (expired, invalid)

GET /downloadsHistory

Get user downloads history list

Get user downloads history list

Parameters:
  Name Type Description
GET num int Num must be between 0 and 300 default : 10
Return value:

show schema

Possible HTTP error codes:
HTTP Status Code Reason
401 Bad token (expired, invalid)
403 Permission denied (account locked)

/links

GET /generateLink

Unrestrict a link

Unrestrict a hoster link and get a new unrestricted link

Parameters:
  Name Type Description
POST || GET link string The original hoster link
POST || GET ip string client ip
Return value for a unique generated link:

show schema

Return value for multiple generated links (ex Youtube):

show schema

Possible HTTP error codes:
HTTP Status Code Reason
401 Bad token (expired, invalid)
403 Permission denied (account locked)

/hosts

GET /hosts

Get current hosts status

Returns some informations of hosts.

Return value:

Hosts show schema

Possible HTTP error codes:
HTTP Status Code Reason
401 Bad token (expired, invalid)

GET /hostscount

Get the number of supported hosts , and number of offline / Online hosts

Returns some informations of hosts.

Return value:

Hosts show schema

Possible HTTP error codes:
HTTP Status Code Reason
401 Bad token (expired, invalid)

/torrents

GET /gettorrentList

Get user torrents list

Get user torrents list

Return value:

show schema

Possible HTTP error codes:
HTTP Status Code Reason
401 Bad token (expired, invalid)
403 Permission denied (account locked)

DELETE /deltorrentFile

Delete a torrent from torrents list

POST /torrentFile

Add magnet link
{
    "username""string",
    "email""string",
    "credit"int// credit coints
    "ID"int,
    "premium""string"// "premium" or "free"
    "expire""string" // jsonDate
}
{
    "id""string",
    "filename""string",
    "mimeType""string"// Mime Type of the file, guessed by the file extension
    "filesize"int// Filesize in bytes, 0 if unknown
    "link""string"// Original link
    "host""string"// Host main domain
    "chunks"int// Max Chunks allowed
    "crc"int// Disable / enable CRC check 
    "download""string"// Generated link
    "streamable"int // Is the file streamable on website
}
{
    "id""string",
    "filename""string",
    "filesize"int// Filesize in bytes, 0 if unknown
    "link""string"// Original link
    "host""string"// Host main domain
    "chunks"int// Max Chunks allowed
    "crc"int// Disable / enable CRC check 
    "download""string"// Generated link
    "streamable"int// Is the file streamable on website
    "quality""string"// Quality of the file
    "alternative": [
        {
            "id""string",
            "filename""string",
            "download""string",
            "quality""string"
        },
        {
            "id""string",
            "filename""string",
            "download""string",
            "quality""string"
        }
    ]
}
[
    {
        "id""string",
        "filename""string",
        "mimeType""string"// Mime Type of the file, guessed by the file extension
        "filesize"int// bytes, 0 if unknown
        "link""string"// Original link
        "host""string"// Host main domain
        "chunks"int// Max Chunks allowed
        "download""string"// Generated link
        "generated""string" // jsonDate
    },
    {
        "id""string",
        "filename""string",
        "mimeType""string",
        "filesize"int,
        "link""string",
        "host""string",
        "chunks"int,
        "download""string",
        "generated""string",
        "quality""string" // Quality of the file
    }
]
{
    "string": { // Host main domain
        "left"int// Available bytes / links to use
        "bytes"int// Bytes downloaded
        "links"int// Links unrestricted
        "limit"int,
        "type""string"// "links", "gigabytes", "bytes"
        "extra"int// Additional traffic / links the user may have buy
        "reset""string" // "daily", "weekly" or "monthly"
    },
    "string": {
        "left"int,
        "bytes"int,
        "links"int,
        "limit"int,
        "type""string",
        "extra"int,
        "reset""string"
    }
}
{
    "YYYY-MM-DD": {
        "host": { // By Host main domain
            "string"int// bytes downloaded on concerned host
            "string"int,
            "string"int,
            "string"int,
            "string"int,
            "string"int
        },
        "bytes"int // Total downloaded (in bytes) this day
    },
    "YYYY-MM-DD": {
        "host": {
            "string"int,
            "string"int,
            "string"int,
            "string"int,
            "string"int,
        },
        "bytes"int
    }
}
[
    {
        "id""string",
        "filename""string",
        "hash""string"// SHA1 Hash of the torrent
        "bytes"int// Size of selected files only
        "host""string"// Host main domain
        "split"int// Split size of links
        "progress"int// Possible values: 0 to 100
        "status""downloaded"// Current status of the torrent: magnet_error, magnet_conversion, waiting_files_selection, queued, downloading, downloaded, error, virus, compressing, uploading, dead
        "added""string"// jsonDate
        "links": [
            "string" // Host URL
        ],
        "ended""string"// !! Only present when finished, jsonDate
        "speed"int// !! Only present in "downloading", "compressing", "uploading" status
        "seeders"int // !! Only present in "downloading", "magnet_conversion" status
    },
    {
        "id""string",
        "filename""string",
        "hash""string",
        "bytes"int,
        "host""string",
        "split"int,
        "progress"int,
        "status""downloaded",
        "added""string",
        "links": [
            "string",
            "string"
        ],
        "ended""string"
    },
]
[
    {
        "id""string",
        "filename""string",
        "original_filename""string"// Original name of the torrent
        "hash""string"// SHA1 Hash of the torrent
        "bytes"int// Size of selected files only
        "original_bytes"int// Total size of the torrent
        "host""string"// Host main domain
        "split"int// Split size of links
        "progress"int// Possible values: 0 to 100
        "status""downloaded"// Current status of the torrent: magnet_error, magnet_conversion, waiting_files_selection, queued, downloading, downloaded, error, virus, compressing, uploading, dead
        "added""string"// jsonDate
        "files": [
            {
                "id"int,
                "path""string"// Path to the file inside the torrent, starting with "/"
                "bytes"int,
                "selected"int // 0 or 1
            },
            {
                "id"int,
                "path""string"// Path to the file inside the torrent, starting with "/"
                "bytes"int,
                "selected"int // 0 or 1
            }
        ],
        "links": [
            "string" // Host URL
        ],
        "ended""string"// !! Only present when finished, jsonDate
        "speed"int// !! Only present in "downloading", "compressing", "uploading" status
        "seeders"int // !! Only present in "downloading", "magnet_conversion" status
    }
]
{
    "id""string",
    "uri""string" // URL of the created ressource
}
{
    "id""string",
    "uri""string" // URL of the created ressource
}
[
    {
        "host""string"// Host main domain
        "max_file_size"int // Max split size possible
    },
    {
        "host""string"// Host main domain
        "max_file_size"int // Max split size possible
    }
]
[
    "string"// URL
    "string",
    "string"
]
[
    "string"// URL
    "string",
    "string"
]
[
    "string"// Domain
    "string",
    "string"
]
[
    "string"// RegExp
    "string",
    "string"
]
{
    "string": { // Host main domain
        "id""string",
        "name""string",
        "image""string" // URL
    },
    "string": {
        "id""string",
        "name""string",
        "image""string"
    }
}
{
    "string": { // Host main domain
        "id""string",
        "name""string",
        "image""string"// URL
        "supported"int// 0 or 1
        "status""string"// "up" / "down" / "unsupported"
        "check_time""string"// jsonDate
        "competitors_status": {
            "string": { // Competitor domain
                "status""string"// "up" / "down" / "unsupported"
                "check_time""string" // jsonDate
            },
            "string": {
                "status""string",
                "check_time""string"
            },
            "string": {
                "status""string",
                "check_time""string"
            }
        }
    },
    "string": {
        "id""string",
        "name""string",
        "image""string",
        "supported"int,
        "status""string",
        "check_time""string",
        "competitors_status": {
            "string": {
                "status""string",
                "check_time""string"
            },
            "string": {
                "status""string",
                "check_time""string"
            },
            "string": {
                "status""string",
                "check_time""string"
            }
        }
    }
}
{
    "string": [ // Category name
        {
            "id"int// Forum ID
            "name""string"// Forum name
            "description""string"// Forum description
            "topics"int// Number of topics inside the concerned forum
            "posts"int// Number of posts inside the concerned forum
            "unread_content"int// 0 or 1
            "last_post": { // Last post details
                "id"int,
                "topic_id"int,
                "user_id"int,
                "user_name""string",
                "user_level""string"// "user", "banned", "moderator", "administrator"
                "date""string" // jsonDate
            }
        },
        {
            "id"int,
            "name""string",
            "description""string",
            "topics"int,
            "posts"int,
            "unread_content"int,
            "last_post": {
                "id"int,
                "topic_id"int,
                "user_id"int,
                "user_name""string",
                "user_level""string",
                "date""string"
            }
        }
    ],
    "string": [
        {
            "id"int,
            "name""string",
            "description""string",
            "topics"int,
            "posts"int,
            "unread_content"int,
            "last_post": {
                "id"int,
                "topic_id"int,
                "user_id"int,
                "user_name""string",
                "user_level""string",
                "date""string"
            }
        },
        {
            "id"int,
            "name""string",
            "description""string",
            "topics"int,
            "posts"int,
            "unread_content"int,
            "last_post": {
                "id"int,
                "topic_id"int,
                "user_id"int,
                "user_name""string",
                "user_level""string",
                "date""string"
            }
        }
    ]
}
{
    "host""string"// Host main domain
    "link""string",
    "filename""string",
    "filesize"int,
    "supported"int
}
{
    "apple": { // M3U8 Live Streaming format
        "quality""string",
        "quality""string"
    },
    "dash": { // MPD Live Streaming format
        "quality""string",
        "quality""string"
    },
    "liveMP4": { // Live MP4
        "quality""string",
        "quality""string"
    },
    "h264WebM": { // Live H264 WebM
        "quality""string",
        "quality""string"
    }
}
{
    "filename""string"// Cleaned filename
    "hoster""string"// File hosted on
    "link""string"// Original content link
    "type""string"// "movie" / "show" / "audio"
    "season""string"// if found, else null
    "episode""string"// if found, else null
    "year""string"// if found, else null
    "duration"float// media duration in seconds
    "bitrate"int// birate of the media file
    "size"int// original filesize in bytes
    "details": {
        "video": {
            "und1": { // if available, lang in iso_639 followed by a number ID
                "stream""string",
                "lang""string"// Language in plain text (ex "English", "French")
                "lang_iso""string"// Language in iso_639 (ex fre, eng)
                "codec""string"// Codec of the video (ex "h264", "divx")
                "colorspace""string"// Colorspace of the video (ex "yuv420p")
                "width"int// Width of the video (ex 1980)
                "height"int // Height of the video (ex 1080)
            }
        },
        "audio": {
            "und1": { // if available, lang in iso_639 followed by a number ID
                "stream""string",
                "lang""string"// Language in plain text (ex "English", "French")
                "lang_iso""string"// Language in iso_639 (ex fre, eng)
                "codec""string"// Codec of the audio (ex "aac", "mp3")
                "sampling"int// Audio sampling rate
                "channels"float // Number of channels (ex 2, 5.1, 7.1)
            }
        },
        "subtitles": [
            "und1": { // if available, lang in iso_639 followed by a number ID
                "stream""string",
                "lang""string"// Language in plain text (ex English, French)
                "lang_iso""string"// Language in iso_639 (ex fre, eng)
                "type""string" // Format of subtitles (ex "ASS" / "SRT")
            }
        ]
    },
    "poster_path""string"// URL of the poster image if found / available
    "audio_image""string"// URL of the music image in HD if found / available
    "backdrop_path""string" // URL of the backdrop image if found / available
}
{
    "download_ports": [ // Possible "download_port" value to update settings
        "string",
        "string"
    ],
    "download_port""string"// Current user download port
    "locales": { // Possible "locale" value to update settings
        "string""string",
        "string""string"
    },
    "locale""string"// Current user locale
    "streaming_qualities": [ // Possible "streaming_quality" value to update settings
        "string",
        "string",
        "string",
        "string"
    ],
    "streaming_quality""string"// Current user streaming quality
    "mobile_streaming_quality""string"// Current user streaming quality on mobile devices
    "streaming_languages": { // Possible "streaming_language_preference" value to update settings
        "string""string",
        "string""string"
    },
    "streaming_language_preference""string"// Current user streaming language preference
    "streaming_cast_audio": [ // Possible "streaming_cast_audio_preference" value to update settings
        "string",
        "string"
    ],
    "streaming_cast_audio_preference""string" // Current user audio preference on Google Cast devices
}
{
    "meta": {
        "id"int,
        "name""string",
        "description""string",
        "topics"int,
        "autorisation_topic"int// User allowed to make a new topic: 0 or 1
        "autorisation_post"int// User allowed&nnbsp;to post in a topic: 0 or 1
        "autorisation_stick"int// User allowed to stick a topic: 0 or 1
        "autorisation_moderation"int// User allowed to use moderation tools: 0 or 1
    },
    "topics": {
        "string": [ // "normal" or "sticky"
            {
                "id"int,
                "title""string",
                "author": {
                    "user_id"int,
                    "username""string",
                    "level""string"
                },
                "posts"int,
                "views"int,
                "unread_content"int,
                "last_post": {
                    "id"int,
                    "user_id"int,
                    "user_name""string",
                    "user_level""string",
                    "date""string"
                }
            },
            {
                "id"int,
                "title""string",
                "author_user_id"int,
                "author_user_name""string",
                "posts"int,
                "views"int,
                "unread_content"int,
                "last_post": {
                    "id"int,
                    "user_id"int,
                    "user_name""string",
                    "user_level""string",
                    "date""string"
                }
            }
        ]
    }
}

Here are some example calls, using cURL

Getting user informations:

Show/hide example

curl -X GET \
     -H "Authorization: your_api_token" \
     "https://bestdebrid.com/api.php/user"
HTTP/1.1 200 OK
Content-Type: application/json
etag: fd6e5a758cf66fe4e92bc2bc7061d9f32dc542af
date: Fri, 12 Jul 2013 12:12:12 GMT

{
    "username""string",
    "email""string",
    "credit"int// credit coints
    "ID"int,
    "premium""string"// "premium" or "free"
    "expire""string" // jsonDate
}

Here are some example calls, using file_get_contents

Getting user informations:

Show/hide example

$opts = array(
  'http'=>array(
    'method'=>"GET",
    'header'=>"Authorization: your_api_key\r\n"
  )
);
$context = stream_context_create($opts);
$file = file_get_contents('https://bestdebrid.com/api.php/user', false, $context);
$ok = json_decode($file);
echo $ok->ID;

Here are some example calls, using file_get_contents to Unrestrick your link

Getting user informations:

Show/hide example

		$ipclient = "xxx.xxx.xxx.xxx";
		$apikey = "your api key";														
		$url = urlencode("your hoster link");
		$opts = array(
		   "ssl"=>array(
			"verify_peer"=>false,
			"verify_peer_name"=>false,
			),
		  'http'=>array(
			'timeout' => 7,
			'method'=>"GET",
			'header'=>"Authorization: ".$apikey."\r\n"
		  )
		);
		$context = stream_context_create($opts);
		$file = file_get_contents('https://bestdebrid.com/api/v1/generateLink?link='.$url.'&ip='.$ipclient.'', false, $context);
		$object = json_decode($file);
		if (isset($object->link))
		{
			echo $object->link."
"; if (isset($object->streammp4)) { echo $object->streammp4."
"; } if (isset($object->mp3)) { echo $object->mp3; } }

Here are some example calls, using cURL

Getting user informations:

Show/hide example

$ipclient = "xxx.xxx.xxx.xxx";
$key = "your api key";
$link = "your hoster link";	
$url = 'https://bestdebrid.com/api/v1/generateLink?auth='.$key.'';
$fields = array(
	'link' => urlencode($link),
	'ip' => $ipclient
);
foreach($fields as $key=>$value) { $fields_string .= $key.'='.$value.'&'; }
rtrim($fields_string, '&');
$ch = curl_init();
curl_setopt($ch,CURLOPT_URL, $url);
curl_setopt($ch,CURLOPT_POST, count($fields));
curl_setopt($ch,CURLOPT_POSTFIELDS, $fields_string);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($cURL, CURLOPT_HTTPHEADER, array(
    'Content-Type: application/json',
    'Accept: application/json'
));
$result = curl_exec($ch);
$json = json_decode($result, true);
echo "

DOWNLOAD LINK :


".$json['link']."
"; echo "

STREAM LINK :


".$json['link']."
"; echo "

MP3 DOWNLOAD :


".$json['mp3']; curl_close($ch);

Calls that require authentication expect an HTTP header Authorization bearing a token, using the following format:

Authorization: your_api_key

If you can not send an Authorization HTTP header you can also send your token as a parameter in REST API URLs, the parameter is called auth:

/api.php/method?auth=your_api_key