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. Clients 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

bash <(wget -qO- https://scripts.ultra.cc/util-v2/Ultra-API/main.sh)
[INFO] Screen session Ultra-API is running.
[SUCCESS] Ultra service API Endpoints to get your service stats:
  ■ Complete Stats........:  https://username.hostname.usbx.me/ultra-api/total_stats
  ■ Storage Stats.........:  https://username.hostname.usbx.me/ultra-api/get_diskquota
  ■ Traffic Stats.........:  https://username.hostname.usbx.me/ultra-api/get_traffic

Usage

Request Script

The python script below is just an example. It will only work if run from your home directory, not a subdirectory.

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.ultra.cc/util-v2/Ultra-API/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/total_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.ultra.cc/util-v2/Ultra-API/main.sh)

Revision #14
Created 2 October 2023 09:53:44 by varg
Updated 1 November 2024 19:02:50 by warp