Player API Documentation

Xtream API

Player API Endpoints
Action Endpoint
Authentication player_api.php?username=X&password=X
GET Live Stream Categories player_api.php?username=X&password=X&action=get_live_categories
GET VOD Stream Categories player_api.php?username=X&password=X&action=get_vod_categories
GET SERIES Categories player_api.php?username=X&password=X&action=get_series_categories
GET LIVE Streams player_api.php?username=X&password=X&action=get_live_streams (All LIVE Streams)
player_api.php?username=X&password=X&action=get_live_streams&category_id=X (Category specific)
GET VOD Streams player_api.php?username=X&password=X&action=get_vod_streams (All VOD Streams)
player_api.php?username=X&password=X&action=get_vod_streams&category_id=X (Category specific)
GET SERIES Streams player_api.php?username=X&password=X&action=get_series (All Series)
player_api.php?username=X&password=X&action=get_series&category_id=X (Category specific)
GET SERIES Info player_api.php?username=X&password=X&action=get_series_info&series_id=X
GET VOD Info player_api.php?username=X&password=X&action=get_vod_info&vod_id=X
GET short_epg for LIVE Streams player_api.php?username=X&password=X&action=get_short_epg&stream_id=X
player_api.php?username=X&password=X&action=get_short_epg&stream_id=X&limit=X
GET ALL EPG for LIVE Streams player_api.php?username=X&password=X&action=get_simple_data_table&stream_id=X
Full EPG List for all Streams xmltv.php?username=X&password=X

Server Actions

View Server List GET

Perform this request to view all your servers, main & load balancers including their status.

Endpoint
http://your_dns:port/api.php?action=server&sub=list
Example Request
curl "http://127.0.0.1:80/api.php?action=server&sub=list"

Stream Actions

View Online Streams GET

Perform this request to view only the online Live Streams.

Endpoint
http://your_dns:port/api.php?action=stream&sub=online
Example Request
curl "http://127.0.0.1:80/api.php?action=stream&sub=online"
View Offline Streams GET

Perform this request to view only the Offline Live Streams.

Endpoint
http://your_dns:port/api.php?action=server&sub=offline
Example Request
curl "http://127.0.0.1:80/api.php?action=server&sub=offline"
Start/Restart A Stream GET/POST

Perform this request to start or restart a Live Stream. The last argument is an array in which you can specify the stream ids. It works with POST method as well.

Endpoint
http://your_dns:port/api.php?action=stream&sub=start&stream_ids[]=1
Example Request
curl "http://127.0.0.1:80/api.php?action=stream&sub=start&stream_ids[]=51"
Stop A Stream GET/POST

Perform this request to stop a Live Stream. The last argument is an array in which you can specify the stream ids. It works with POST method as well.

Endpoint
http://your_dns:port/api.php?action=stream&sub=stop&stream_ids[]=1
Example Request
curl "http://127.0.0.1:80/pi.php?action=stream&sub=stop&stream_ids[]=557"

VOD Actions

Start VOD Encoding GET/POST

Perform this request to start a VOD Encoding process. The last argument is an array in which you can specify the stream ids. It works with POST method as well. Applies for series episodes as well.

Endpoint
http://your_dns:port/api.php?action=vod&sub=start&stream_ids[]=1
Example Request
curl "http://127.0.0.1:80/api.php?action=vod&sub=start&stream_ids[]=554"
Stop A VOD Encoding GET/POST

Perform this request to stop a VOD Encoding. The last argument is an array in which you can specify the stream ids. It works with POST method as well.

Endpoint
http://your_dns:port/api.php?action=vod=stop&stream_ids[]=1

User Management

Creating New Line POST

To create a Newline, call the following URL with POST method and specify arguments in an array called user_data.

Endpoint
http://dns:port/api.php?action=user&sub=create
Parameters
Parameter Description
username Username for the new line (optional - if empty, system will generate random username)
password Password for the new line (optional - if empty, system will generate random password)
max_connections Maximum connections allowed (optional)
is_restreamer Whether the user is a restreamer (optional)
exp_date Expiration date for the line (optional)
bouquet JSON encoded array of bouquet IDs (optional)
Example Request
$post_data = array(
    'username' => 'testuser',
    'password' => 'testpass',
    'max_connections' => 3,
    'is_restreamer' => 0,
    'exp_date' => '2023-12-31',
    'bouquet' => json_encode([1, 2, 3])
);

$opts = array(
    'http' => array(
        'method' => 'POST',
        'header' => 'Content-type: application/x-www-form-urlencoded',
        'content' => http_build_query($post_data)
    )
);

$context = stream_context_create($opts);
$api_result = json_decode(file_get_contents($panel_url . "api.php?action=user&sub=create", false, $context));
Success Response
{
    "result": true,
    "created_id": 14838,
    "username": "d4PSc5uCqF",
    "password": "2ZiuRRZk4b"
}
Error Responses
{"result": false, "error": "EXISTS"}
{"result": false, "error": "PARAMETER ERROR"}
Editing Line POST

Edit an existing user line with the following endpoint.

Endpoint
http://dns:port/api.php?action=user&sub=edit
Required Parameters
  • username - Existing username
  • password - Existing password
Optional Parameters (in user_data array)
  • max_connections
  • is_restreamer
  • exp_date
  • bouquet
  • member_id
  • admin_enabled
  • enabled
  • allowed_ips
  • allowed_ua
  • force_server_id
  • is_isplock
  • admin_notes
Example Request
$post_data = array(
    'username' => 'testuser',
    'password' => 'testpass',
    'user_data' => array(
        'max_connections' => 5,
        'is_restreamer' => 1,
        'exp_date' => '2024-12-31'
    )
);

$opts = array(
    'http' => array(
        'method' => 'POST',
        'header' => 'Content-type: application/x-www-form-urlencoded',
        'content' => http_build_query($post_data)
    )
);

$context = stream_context_create($opts);
$api_result = json_decode(file_get_contents($panel_url . "api.php?action=user&sub=edit", false, $context));
Success Response
{"result": true}
Error Responses
{"result": false, "error": "NOT EXISTS"}
{"result": false, "error": "PARAMETER ERROR"}
{"result": false, "error": "PARAMETER ERROR (user/pass)"}
View Line Information POST

Get all information about a user line including active connections.

Endpoint
http://dns:port/api.php?action=user&sub=info
Required Parameters
  • username
  • password
Example Request
$post_data = array(
    'username' => 'testuser',
    'password' => 'testpass'
);

$opts = array(
    'http' => array(
        'method' => 'POST',
        'header' => 'Content-type: application/x-www-form-urlencoded',
        'content' => http_build_query($post_data)
    )
);

$context = stream_context_create($opts);
$api_result = json_decode(file_get_contents($panel_url . "api.php?action=user&sub=info", false, $context), true);

if ($api_result['result']) {
    echo "Active Connections (Now): " . $api_result['user_info']['active_cons'];
    echo "\nCurrent Expire Date: " . ((empty($api_result['user_info']['exp_date'])) ? 'Unlimited' : strtotime($api_result['user_info']['exp_date']));
    echo "\nMax Connections: " . $api_result['user_info']['max_connections'];
    echo "\nAvailable Channel IDs: " . implode(',', $api_result['user_info']['channel_ids']);
} else {
    echo 'FAILED';
}

MAG Devices Management

Create New MAG Device POST

Create a new MAG device with the following endpoint.

Endpoint
http://dns:port/api.php?action=stb&sub=create
Required Parameters (in user_data array)
  • mac - MAC address of the device
Optional Parameters (in user_data array)
  • exp_date - Expiration date
  • bouquet - JSON encoded array of bouquet IDs
Example Request
$post_data = array(
    'user_data' => array(
        'mac' => '00:1A:79:XX:XX:XX',
        'exp_date' => '2023-12-31',
        'bouquet' => json_encode([1, 2, 3])
    )
);

$opts = array(
    'http' => array(
        'method' => 'POST',
        'header' => 'Content-type: application/x-www-form-urlencoded',
        'content' => http_build_query($post_data)
    )
);

$context = stream_context_create($opts);
$api_result = json_decode(file_get_contents($panel_url . "api.php?action=stb&sub=create", false, $context));
print_r($api_result);
Success Response
{"result": true}
Error Responses
{"result": false, "error": "EXISTS"}
{"result": false, "error": "PARAMETER ERROR"}
{"result": false, "error": "PARAMETER ERROR (mac)"}
Edit MAG Device POST

Edit an existing MAG device with the following endpoint.

Endpoint
http://dns:port/api.php?action=stb&sub=edit
Required Parameters
  • mac - MAC address of the device
Optional Parameters (in user_data array)
  • exp_date
  • bouquet
Example Request
$post_data = array(
    'mac' => '00:1A:79:XX:XX:XX',
    'user_data' => array(
        'exp_date' => '2024-12-31',
        'bouquet' => json_encode([1, 2, 3, 4])
    )
);

$opts = array(
    'http' => array(
        'method' => 'POST',
        'header' => 'Content-type: application/x-www-form-urlencoded',
        'content' => http_build_query($post_data)
    )
);

$context = stream_context_create($opts);
$api_result = json_decode(file_get_contents($panel_url . "api.php?action=stb&sub=edit", false, $context));
Success Response
{"result": true}
Error Responses
{"result": false}
{"result": false, "error": "PARAMETER ERROR"}
{"result": false, "error": "PARAMETER ERROR (mac)"}
View MAG Device Information POST

Get all information about a MAG device.

Endpoint
http://dns:port/api.php?action=stb&sub=info
Required Parameters
  • mac - MAC address of the device
Example Request
$post_data = array(
    'mac' => '00:1A:79:XX:XX:XX'
);

$opts = array(
    'http' => array(
        'method' => 'POST',
        'header' => 'Content-type: application/x-www-form-urlencoded',
        'content' => http_build_query($post_data)
    )
);

$context = stream_context_create($opts);
$api_result = json_decode(file_get_contents($panel_url . "api.php?action=stb&sub=info", false, $context), true);

if ($api_result['result']) {
    echo "Active Connections (Now): " . $api_result['user_info']['active_cons'];
    echo "\nCurrent Expire Date: " . ((empty($api_result['user_info']['exp_date'])) ? 'Unlimited' : strtotime($api_result['user_info']['exp_date']));
    echo "\nMax Connections: " . $api_result['user_info']['max_connections'];
    echo "\nAvailable Channel IDs: " . implode(',', $api_result['user_info']['channel_ids']);
} else {
    echo 'FAILED';
}