Mastering XUI Panel Commands: Guide for IPTV Providers

As an IPTV Provider, you understand the importance of having a reliable and efficient IPTV panel to manage your business. XUI Panel, also known as XUI ONE, is a powerful and user-friendly IPTV panel that has gained popularity among IPTV providers worldwide. One of the key features that make XUI Panel stand out is its comprehensive set of commands that can help you streamline your IPTV operations and enhance the viewing experience for your customers.

In this article, we will dive into the world of XUI Panel commands and explore how you can use them to take your IPTV business to the next level. Whether you are a seasoned IPTV provider or just starting out, this guide will equip you with the knowledge and tools to maximize the potential of XUI Panel commands. So, let's get started!

Looking for a step-by-step XUI Panel installation tutorial? Read on:
How to Install XUI ONE - Step by Step Tutorial

Basics for XUI.ONE

Service Commands

service xuione

service xuione start

Generate License

To generate a license after installing, go to http://yoursite.com/accesscode and replace it with the unique access code for your installation.

If it doesn't work, follow the Access Code instructions. If you need to regenerate the license, follow the instructions below.

  • Visit the XUI Billing Panel, log in and Reissue your license (for Main server only). Load balancers can skip this step.
  • Ensure your license number is in /home/xui/config/config.ini
  • Run the following commands on the server via SSH:
rm /home/xui/config/license
sudo -u xui /home/xui/bin/php/bin/php /home/xui/crons/license.php

The license.php will output information about your license and whether it is valid or not. If this doesn’t work, and your license is definitely in the reissued state, then you’ll have to contact support.

No Access Code

If you can't access the admin interface because your access code isn't working, check the /home  /xui/bin/nginx/conf/codes/  directory for a code that ends with .conf. If you find one, try using it as your access code.

If there are no codes that end with .conf, or the ones that do are not for an admin interface login, then copy template to admin.conf and make the following changes:

  • Replace #CODE# with admin
  • Replace #TYPE# with admin
  • Delete #WHITELIST#
  • Enter mysql via your preferred method and run: USE `xui`; INSERT INTO `access_codes`( `code`, `type`, `enabled`, `groups`) VALUES ('admin', 0, 1, '[1]');
  • Run the following command via SSH: service xuione reload
  • You should now be able to access the admin panel via: http://yoursite.com:8080/admin

Login Error: “You do not have access”

This error is related to the access code you're using. It means the access code belongs to a different user group than the one you're in. Make sure you're using the correct user or access code. If you can't access the panel due to this error, follow the instructions in the "No Access Code" section to create a new access code for admins.

MySQL Access Denied

If you’re getting access denied on the main server, you’re going to need to edit  /home/xui/config/config.ini  and change the username and password in the Encrypted section to match the credentials you were given when installing XUI, like this:

[Encrypted]
username = "username"
password = "password"

Save and restart the panel.

For load balancers, you can either follow the steps above or regenerate MySQL authentication using the "General" option in Management -> Tools -> Quick Tools. If the issue persists, it may be because the XUI MySQL user doesn't have permission to authorize external users. To fix this, you'll need to grant the privilege or manually allow the load balancer IP. If neither option works, it's an advanced procedure that may require external help.

Load Balancer Offline

To diagnose why the load balancer isn't going online, access it via SSH and run

/etc/init.d/xuione stop 
/etc/init.d/xuione start

This will give you information about the issue, which could be related to MySQL, the license, or missing libraries. Follow the trail to troubleshoot the problem.

Reset Admin User

To reset the admin user, run the following command via MySQL to restore user ID 1 to the default username and password, which is admin for both. Afterward, make sure to change the username and password.

USE `xui`; REPLACE INTO `users`(`id`, `username`, `password`, `member_group_id`, `status`, `owner_id`, `date_registered`) VALUES(1, 'admin', '$6$rounds=20000$xui$eQfRsD2gsIUhoY5RnnYN82qiB5VeZTcHICQrFxXpa98J2R1454b6lzVHVjiJ.NP0gi0X3K7NXVgxeR1VhVhg61', 1, 1, 0, UNIX_TIMESTAMP());

XUI.ONE How to Use / Add Admin API

  1. Open the Panel, go to Management > Access Control > Access Codes
  2. Add Access Code, select from Access Type: Admin API and click next.
  3. Select as Group “Administrators”.
  4. If you want restrict the API to a cretain IP, add the IP and save it.
  5. To get the Admin API Key, open the Admin Profile.

​You can then access the API via: http://yoursite.com/accesscode/?api_key=#APIKEY#

Example:
https://[domain]:[port]/[accesscode]/?api_key=[api_key]&action=[api_command]

https://bestdomain.com:9000/rnVKrSLe/?api_key=1A2C5C80056A80F5AB6ECAD3937875DE&action=packages

If you're a developer, use this as your API endpoint and set the "action" parameter to one of the available API commands:

GET INFO
mysql_query
user_info
get_lines
get_mags
get_enigmas
get_users
get_streams
get_channels
get_stations
get_movies
get_series_list
get_episodes

LOGS & EVENT API
activity_logs
live_connections
credit_logs
client_logs
user_logs
stream_errors
watch_output
system_logs
login_logs
restream_logs
mag_events

LINE API
get_line
create_line
edit_line
delete_line
disable_line
enable_line
unban_line
ban_line

USER API
get_user
create_user
edit_user
delete_user
disable_user
enable_user

MAG API
get_mag
create_mag
edit_mag
delete_mag
disable_mag
enable_mag
unban_mag
ban_mag
convert_mag

ENIGMA API
get_enigma
create_enigma
edit_enigma
delete_enigma
disable_enigma
enable_enigma
unban_enigma
ban_enigma
convert_enigma

BOUQUETE API
get_bouquets
get_bouquet
create_bouquet
edit_bouquet
delete_bouquet

ACCESS CODE API
get_access_codes
get_access_code
create_access_code
edit_access_code
delete_access_code

HMAC API
get_hmacs
get_hmac
create_hmac
edit_hmac
delete_hmac

EPG API
get_epgs
get_epg
create_epg
edit_epg
delete_epg
reload_epg

GROUPS API
get_groups
get_group
create_group
edit_group
delete_group

PACKAGES API
get_packages
get_package
create_package
edit_package
delete_package

TRANSCODING PROFILE API
get_transcode_profiles
get_transcode_profile
create_transcode_profile
edit_transcode_profile
delete_transcode_profile

RTMP API
get_rtmp_ips
get_rtmp_ip
create_rtmp_ip
edit_rtmp_ip
delete_rtmp_ip

CATEGORIES API
get_categories
get_category
create_category
edit_category
delete_category

SUB RESELLER API
get_subresellers
get_subreseller
create_subreseller
edit_subreseller
delete_subreseller

WATCH FOLDERS API
get_watch_folders
get_watch_folder
create_watch_folder
edit_watch_folder
delete_watch_folder
reload_watch_folder

BLOCKED ISP & IP API
get_blocked_isps
add_blocked_isp
delete_blocked_isp
get_blocked_uas
add_blocked_ua
delete_blocked_ua
get_blocked_ips
add_blocked_ip
delete_blocked_ip
flush_blocked_ips

STREAMS API
get_stream
create_stream
edit_stream
start_stream
stop_stream
delete_stream

CHANNEL API
get_channel
create_channel
edit_channel
start_channel
stop_channel
delete_channel

STATION API
get_station
create_station
edit_station
start_station
stop_station
delete_station

MOVIE API
get_movie
create_movie
edit_movie
start_movie
stop_movie
delete_movie

SERIES API
get_series
create_series
edit_series
delete_series

EPISONE API
get_episode
create_episode
delete_episode
edit_episode
start_episode
stop_episode

SERVERS API
get_servers
get_server
install_server
delete_server
edit_server
install_proxy
edit_proxy

SETTINGS, STATS AND OTHER API
get_settings
edit_settings
get_server_stats
get_fpm_status
get_rtmp_stats
get_free_space
get_pids
get_certificate_info
reload_nginx
clear_temp
clear_streams
update_blacklist
get_directory
kill_pid
kill_connection
reload_cache

The upcoming API information will explain each function and its parameters. In the meantime, you can explore by enabling Developer Tools in the Admin Interface and logging traffic to post.php. The parameters sent there are the same ones you can use for the related API function.

For instance, if you add a stream in the "Streams" section, you can log post.php and send the same request to the "create_stream" function to replicate it. To edit a stream, pass the ID along with the request.

Some of the functions are server specific, so send server_id with them, for example:
get_server_stats, get_fpm_status, get_rtmp_stats, get_free_space, get_pids, get_certificate_info, reload_nginx, clear_temp, clear_streams, update_blacklist, get_directory

If you have any questions or suggestions, please feel free to leave them in the comments below. We're always happy to help you on your IPTV journey!


This is a companion discussion topic for the original entry at https://iptvblog.net/mastering-xui-panel-commands-guide-for-iptv-providers/