Welcome to Mega-Debrid API

General :

All requests are in the same pattern : https://www.mega-debrid.eu/?action=[action_name]. Some requests needs more parameters.
All requests return a json encoded response with at least the response "response_code" : "ok" or the error code. When an error is triggered, the parameter "response_text" give a text description of the error.

You must use https for all request on this API.

WARNING : After 4 login failed (bad login/password), your IP address will be banned for 1 day.
WARNING : If you send more than 50 requests per seconds, your IP address will be banned for 1 day.

Only Premium members can use this API.
If free members try to connect on their accounts with this API, we return "vip_end" at the token generation and debrid link doesn't work.
We recommend an error message on your software for these accounts.

We can offer you a Premium account for your tests. Don't hesitate to contact us : contact[AT]mega-debrid.eu

Get hosters list :

URL: https://www.mega-debrid.eu/api.php?action=getHostersList

params : no params
response: "response_code", "hosters" => [{name, status, img, domains (array), regexps (array)}]

Connect user :

URL: https://www.mega-debrid.eu/api.php?action=connectUser&login=[user_login]&password=[user_password]

params : no post param. Send User login & password without encode (exemple : https://www.mega-debrid.eu/api.php?action=connectUser&login=Usertest&password=UsertestPassword)
response: "response_code" => "ok", "debridLink" => debrided link, "token" => User's token

The token will be valid until the next connection attempt. You don't need to ask for a new token every time. You must use the token until it is obsolete (API return "Token error, please log-in" at the debrid link).

Get debrid link :

URL: https://www.mega-debrid.eu/api.php?action=getLink&token=[token]

params : POST fields : 'link' : link to debrid. User password is md5 encoded
response: "response_code" => "ok", "debridLink" => debrided link

Get user history :

URL: https://www.mega-debrid.eu/api.php?action=getUserHistory&token=[token]

[optional] : GET fields : 'start' : skip [start] results
[optional] : GET fields : 'limit' : number of result
response: "response_code" => "ok", "history" => [user's history]

Get Torrents :

URL: https://www.mega-debrid.eu/api.php?action=getTorrents&token=[token]

response: "response_code" => "ok", "torrents" => [array of torrents (name, status, progress, speed) ]

Upload torrent :

URL: https://www.mega-debrid.eu/api.php?action=uploadTorrent&token=[token]

params : POST fields : 'file' : base64 encoded .torrent file
response: "response_code" => "ok", "newTorrent" => { name, size }