Storage/Traffic API Endpoint

This is an unofficial script that is provided for your convenience. The script is provided as-is and may not be updated or maintained by Ultra.cc. Customers are welcome to use and customize unofficial scripts for their unique needs and requirements. Unofficial support may be offered via Discord only and at the sole discretion of Ultra.cc staff. Use at your own risk.

The Storage/Traffic API Endpoint script will provide three API endpoints to your Ultra.cc service. The script will be installed as a Flask application in ~/scripts/Ultra_API and run in a screen session called UltraAPIpoints. At the moment, three API endpoints are provided, as shown below.

Installation

Before you can proceed with installing the API Endpoint script, Python needs to be version 3.6 or above.

Upgrade Python

With Python updated to version 3.6 or above, you can proceed the installation.

Script Installation

bash <(wget -qO- https://scripts.usbx.me/util/API-EndPoints/main.sh)
Script has been installed successfully.
Creating SQLite3 database and table...
Token successfully generated: <YOUR-AUTH-TOKEN>
 Ultra service API End points to get your service stats:
  ■ Complete Stats........:  https://username.hostname.usbx.me/ultra-api/get_stats
  ■ Storage Stats.........:  https://username.hostname.usbx.me/ultra-api/get_quota
  ■ Traffic Stats.........:  https://username.hostname.usbx.me/ultra-api/get_bandwidth
The script has been installed.

Usage

Request Script

Once you have successfully installed the script, you are ready to start sending request to the API endpoints. Execute the below command to download a basic request script that we offer as a demonstration.

wget https://scripts.usbx.me/util/API-EndPoints/Requester.py
nano Requester.py
url = "https://username.hostname.usbx.me/ultra-api/endpoint"  # Replace with your desired URL
auth_token = "YOUR_AUTH_TOKEN"  # Replace with your actual auth token
url = "https://coolguy69.spica.usbx.me/ultra-api/get_stats"  # Replace with your desired URL
auth_token = "0JQ3LJOnXq7IiJyujlPFzR9S"  # Replace with your actual auth token
python Requester.py
Data from GET request:
{"service_stats_info":{"free_storage_bytes":9664750157824,"free_storage_gb":9001.0,"last_traffic_reset":"2023-08-22T00:00:00","next_traffic_reset":"2023-08-22T00:00:00","total_storage_unit":"G","total_storage_value":11176,"traffic_available_percentage":97.51,"traffic_used_percentage":2.489999999999995,"used_storage_unit":"G","used_storage_value":2175}}

GET request via curl

curl -X GET -H "Authorization: Bearer YOUR-AUTH-TOKEN" https://username.hostname.usbx.me/ultra-api/endpoint

Uninstallation

bash <(wget -qO- https://scripts.usbx.me/util/API-EndPoints/main.sh)

Revision #10
Created 2 October 2023 09:53:44 by varg
Updated 8 February 2024 11:44:27 by varg