NAV Navbar
php javascript

Recent modifications

23/05/2018

Introduction

Welcome to the Uptobox API ! You can use our API to access Uptobox services.

We have language bindings in Shell and JS! You can view code examples in the dark area to the right, and you can switch the programming language of the examples with the tabs in the top right.

Authentication

Uptobox uses token to allow access to the API. There are no endpoints to trigger an authentication, you just need to provide the token in all your call

The token is expected in the request body and will fallback to query params otherwise. If the token is not found, an error is returned.

My account

Some options in my account page can also be modified by using the API. Please find below a quick description of the feature and how to change it.

Retrieve user data

<?php

$url = 'https://uptobox.com/api/user/me?token=[USR_TOKEN]';
$result = file_get_contents($url);

?>

import axios from 'axios'

axios({
  method: 'get',
  url: 'https://uptobox.com/api/user/me?token=[USR_TOKEN]',
})

The above request returns a JSON structured like this :

{
    "statusCode": 0,
    "message": "Success",
    "data": {
        "login": "my_login",
        "email": "my_email@gmail.com",
        "point": "8.00000",
        "premium_expire": "2018-05-24 11:40:25",
        "securityLock": 0,
        "directDownload": 1,
        "sslDownload": 1,
        "token": "USR_TOKEN",
        "premium": 1,
    }
}

But triggers an error if the token is wrong. For instance :

{
    "statusCode": 13,
    "message": "Invalid token"
}

You can retrieve all your account's informations anytime.

To do so, send a GET request to : https://uptobox.com/api/user/me

Query params expected :

Parameter Description
token your user token


Return values :

Parameter Description
statusCode (Int) Status Code
message (String) Status message
data (User) your infos
(on error) (String) Error message


User :

Name Description
login (string) Your username
email (string) Your email
point (string) Your fidelity points
premium_expire (string) Premium time expire date
securityLock (bool) Security lock state
directDownload (bool) Direct download state
sslDownload (bool) Ssl download state
token (string) Your token
premium (bool) Is premium

SSL Download

<?php

$url = 'https://uptobox.com/api/user/settings';
$data = [
  'token' => 'USER_TOKEN',
  'ssl' => 1
];

$curl = curl_init();
curl_setopt($curl, CURLOPT_CUSTOMREQUEST, "PATCH");
curl_setopt($curl, CURLOPT_POSTFIELDS, json_encode($data));
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl, CURLOPT_URL, $url);

$result = curl_exec($curl);
curl_close($curl);

echo $result;

?>

import axios from 'axios'

axios({
  method: 'patch',
  url: 'https://uptobox.com/api/user/settings',
  data: {
    token: [USR_TOKEN],
    ssl: 1
  }
})

The above request returns a JSON structured like this :

{
    "statusCode": 0,
    "message": "Success"
}

But triggers an error if ssl parameter is wrong. For instance :

{
    "statusCode": 7,
    "message": "Invalid parameter",
    "data": "Expect a bool"
}

This feature allows you to force the https when downloading file on Uptobox.

To enable or disable SSL Download, send a PATCH request to : https://uptobox.com/api/user/settings

Request body expected :

Parameter Description
token your user token
ssl a boolean. can be 1 or 0

Return values :

Parameter Description
statusCode (Int) Status Code
message (String) Status message
data (string - optional) The error message

Direct Download

<?php

$url = 'https://uptobox.com/api/user/settings';
$data = [
  'token' => 'USER_TOKEN',
  'directDownload' => 1
];

$curl = curl_init();
curl_setopt($curl, CURLOPT_CUSTOMREQUEST, "PATCH");
curl_setopt($curl, CURLOPT_POSTFIELDS, json_encode($data));
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl, CURLOPT_URL, $url);

$result = curl_exec($curl);
curl_close($curl);

echo $result;

?>

import axios from 'axios'

axios({
  method: 'patch',
  url: 'https://uptobox.com/api/user/settings',
  data: {
    token: [USR_TOKEN],
    directDownload: 1
  }
})

The above request returns a JSON structured like this :

{
    "statusCode": 0,
    "message": "Success"
}

But triggers an error if directDownload parameter is wrong. For instance :

{
    "statusCode": 7,
    "message": "Invalid parameter",
    "data": "Expect a bool"
}

This feature, if enabled, will trigger your download immediately when visiting an Uptobox download link.

To enable or disabled Direct download, send a PATCH request to : https://uptobox.com/api/user/settings

Request body expected :

Parameter Description
token your user token
directDownload a boolean. can be 1 or 0

Return values :

Parameter Description
statusCode (Int) Status Code
message (String) Status message
data (string - optional) The error message

Security Lock

<?php

$url = 'https://uptobox.com/api/user/securityLock';
$data = [
  'token' => 'USER_TOKEN',
  'securityLock' => 1
];

$curl = curl_init();
curl_setopt($curl, CURLOPT_CUSTOMREQUEST, "PATCH");
curl_setopt($curl, CURLOPT_POSTFIELDS, json_encode($data));
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl, CURLOPT_URL, $url);

$result = curl_exec($curl);
curl_close($curl);

echo $result;
?>

import axios from 'axios'

axios({
  method: 'patch',
  url: 'https://uptobox.com/api/user/securityLock',
  data: {
    token: [USR_TOKEN],
    securityLock: 1
  }
})

The above request returns a JSON structured like this :

{
    "statusCode": 0,
    "message": "Success"
}

But triggers an error if securityLock parameter is wrong. For instance :

{
    "statusCode": 7,
    "message": "Invalid parameter",
    "data": "Expect a bool"
}

This feature, if enabled, enforce your account safety by preventing login from another country.

To enable or disabled Security Lock, send a PATCH request to : https://uptobox.com/api/user/securityLock

Request body expected :

Parameter Description
token your user token
securityLock a boolean. can be 1 or 0

Return values :

Parameter Description
statusCode (Int) Status Code
message (String) Status message
data (string - optional) The error message

Point conversion

<?php

$url = 'https://uptobox.com/api/user/requestPremium';
$data = [
    'token' => 'USER_TOKEN',
    'points' => 10
];

$curl = curl_init();
curl_setopt($curl, CURLOPT_CUSTOMREQUEST, "POST");
curl_setopt($curl, CURLOPT_POSTFIELDS, json_encode($data));
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl, CURLOPT_URL, $url);

$result = curl_exec($curl);
curl_close($curl);

echo $result;

?>

import axios from 'axios'

axios({
  method: 'POST',
  url: 'https://uptobox.com/api/user/requestPremium',
  data: {
    token: [USR_TOKEN],
    points: 10
  }
})

The above request returns a JSON structured like this :

{
    "statusCode": 0,
    "message": "Success",
    "data": "2019-07-18 13:24:19"
}

But triggers an error if the parameter is wrong. For instance :

{
    "statusCode": 15,
    "message": "Unsupported conversion"
}

This endpoint allows you to convert your points into additional premium time. Here are the supported values :

Point Premium days
10 30
25 90
50 180
100 365

To convert your points, send a POST request to https://uptobox.com/api/user/requestPremium

Request body expected :

Parameter Description
token your user token
points points to convert

Return values :

Parameter Description
statusCode (Int) Status Code
message (String) Status message
data (string) Updated expire premium date

Reseller

Create voucher

We provide 2 different methods to create a voucher. One using user token (recommended) and the other using login/password for authentication (deprecated).

<?php

$url = 'https://uptobox.com/api/user/createVoucher';
$data = [
    'token' => 'USER_TOKEN',
    'time' => '30d',
    'quantity' => 1
];

$curl = curl_init();
curl_setopt($curl, CURLOPT_CUSTOMREQUEST, "POST");
curl_setopt($curl, CURLOPT_POSTFIELDS, json_encode($data));
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl, CURLOPT_URL, $url);

$result = curl_exec($curl);
curl_close($curl);

echo $result;

?>

import axios from 'axios'

axios({
  method: 'POST',
  url: 'https://uptobox.com/api/user/createVoucher',
  data: {
    token: [USR_TOKEN],
    time: '30d',
    quantity: 1
  }
})

The above request returns a JSON structured like this :

{
    "statusCode": 0,
    "message": "Success",
    "data": [
        {
            "key_code": "21307H4hKVS0daljIPt",
            "key_time": "30",
            "key_created": 1524611887,
            "activated": false,
            "key_activated": "0000-00-00 00:00:00"
        }
    ]
}

But triggers an error if the parameter is not correct. For instance :

{
    "statusCode": 7,
    "message": "Invalid parameter",
}

This is the recommended way to create a voucher using our API. You can specify what type of voucher you want as well as the quantity.

To create some vouchers, send a POST request to : https://uptobox.com/api/user/createVoucher

Request body expected :

Parameter Description
token your user token
time the duration for the voucher
quantity the number of voucher to generate


Return values :

Parameter Description
statusCode (Int) Status Code
message (String) Status message
data (Array of Voucher) Created vouchers
(on error) (string) Error message


Voucher :

Name Description
key_code (string) The keycode
key_time (string) Voucher type
key_created (timestamp) Created at
activated (bool) Is activated
key_activated (timestamp) Activation date

Deprecated

<?php

$url = "https://uptobox.com/?op=api_reseller&u=[login]&p=[password]&t=[time]";

$return = file_get_contents($url);

?>

import axios from 'axios'

axios({
  method: 'GET',
  url: 'https://uptobox.com/?op=api_reseller&u=[login]&p=[password]&t=[time]',
})

The above request returns the keycode :

21308FyuiyP4qDuRoU7

But triggers an error if a parameter is missing. For instance :

{
    "statusCode": 6,
    "message": "Missing parameter",
    "data": "u (login) is missing",
}

Alternatively, you can use our api_reseller route to create a voucher.
This particular endpoint doesn't expect a token but you need to provide your login and password for authentication.

To create a voucher, send a GET request to : https://uptobox.com/?op=api_reseller

Request body expected :

Parameter Description
token your user token
u your login
p your password
t 30d, 365d, 730d

Return values :

On success, returns the key code in plain text format.

On error, return a JSON object :

Parameter Description
statusCode (Int) Status Code
message (String) Status message
data (string - optional) Error message

Generate a download link

You can generate a download link by using our API. As a free member, you need to wait 30 seconds before each download and 30 minutes between downloads. The API response is different depending on which step you're in.

What is a file id ?

For example, in this link : https://uptobox.com/m5f0ce9h197j
The string m5f0ce9h197j is the file id. A unique identifier for a file hosted on Uptobox. You need to provide the file_id as well as your user token in order to generate a download link.

JSON response on error :

{
    "statusCode": "[statusCode]",
    "message": "[Status message]",
    "data": "[Error object]"
}

If an error happens, here is the returned value :

Parameter Description
statusCode (Int) Status Code
message (String) Status message
data (Object or String) Error

Get a waiting token

<?php

$url = "https://uptobox.com/api/link?token=[USR_TOKEN]&id=[FILE_ID]";

$return = file_get_contents($url);

?>

import axios from 'axios'

axios({
  method: 'GET',
  url: 'https://uptobox.com/api/link?token=[USR_TOKEN]&id=[FILE_ID]',
})

The above request returns a JSON structured like this :

{
    "statusCode": 16,
    "message": "Waiting needed",
    "data": {
        "waiting": 30,
        "waitingToken": "5901651ef57c0b2fa336ad7f7f029986p7qsjf-p7rpv5"
    }
}

But triggers an error if the id is wrong. For instance :

{
    "statusCode": 7,
    "message": "Invalid parameter",
    "data": "bad id"
}

To generate the download link, first send a GET request to : https://uptobox.com/api/link

Query params expected :

Parameter Description
token (string) your user token
id (string) the file id
password (string) File password

The 30 seconds countdown will start and the call returns a waitingToken which is a unique identifier for this download link generation attempt.

Return values :

Parameter Description
waiting (string) n seconds to wait
waitingToken (string) a unique identifier to generate a download link

If you've downloaded a file recently. You need to wait about 30 minutes before generating a link again.

<?php

$url = "https://uptobox.com/api/link?token=[USR_TOKEN]&id=[FILE_ID]&waitingToken=[WAITING_TOKEN]";

$return = file_get_contents($url);

?>

import axios from 'axios'

axios({
  method: 'GET',
  url: 'https://uptobox.com/api/link?token=[USR_TOKEN]&id=[FILE_ID]&waitingToken=[WAITING_TOKEN]',
})

The above request returns a JSON structured like this :

{
    "statusCode": 0,
    "message": "Success",
    "data": {
        "dlLink": "[DL_LINK]",
    }
}

After getting the waitingToken in the previous step and after waiting 30 seconds,
send a GET request to : https://uptobox.com/api/link

Query params expected :

Parameter Description
token (string) your user token
id (string) the file id
waitingToken (string) the waiting token

Return values :

Parameter Description
dlLink (string) the generated download link

Status Code

Here is the list of statusCode currently supported in uptobox API calls.

Code Description
0 Success
1 An error occured
2 Invalid Credentials
3 Expect at least one value
4 Wrong format
5 Need premium account
6 Missing Parameter
7 Invalid Parameter
8 Insufficient credit
9 Unsupported field
10 Unprocessable request
11 Too much fail attempt
12 Missing token
13 Invalid token
14 Voucher is already used
15 Unsupported conversion
16 Waiting needed
17 Password required
18 Data unchanged
19 Invalid voucher

Changelog

23/05/2018