Skip to main content

MidnightStreamer Docs & API

Server Api Lines

Learn how to add, edit, view and delete IPTV lines programmatically using the MidnightStreamer Pro Server API.

🔐 MidnightStreamer Pro API Guide – Server API Lines

Meta Description: Learn how to add, edit, view and delete IPTV lines programmatically using the MidnightStreamer Pro Server API.

Keywords: midnightstreamer api, server api lines, midnightstreamer create line, iptv api guide, midnightstreamer automation, iptvtools api tutorial, midnightstreamer php api

📘 Overview

MidnightStreamer Pro includes a powerful Server API that allows you to programmatically manage IPTV lines. You can create, edit, delete and view lines using simple HTTP requests. This is ideal for automation systems, reseller tools and external panel integrations.


✅ Step 1: Enable API Access

To begin using the API:

  • Navigate to General Settings → API Settings
  • Add your server IP to Allowed IPs
  • Save settings
  • Generate an API Key

You can send the API key in two ways:

  • As POST parameter: api_key
  • As URL segment: /api_key/

🆕 Creating a New Line

Endpoint:

http://your-domain:8000/api/line/new

Method: POST

Example PHP Code:

$panel_url = 'http://your-domain:8000/';
$api_key = 'your_api_key';
$username = 'test_user';
$password = 'test_pass';
$max_connections = 1;
$restreamer = 1;
$subscription_plan = 1;
$expire_date = strtotime("+1 month");

$post_data = array(
  'api_key' => $api_key,
  'data' => array(
    'username' => $username,
    'password' => $password,
    'max_allowed_connections' => $max_connections,
    'restreamer' => $restreamer,
    'expire_date' => $expire_date,
    'subscription_plan_id' => $subscription_plan
  )
);

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

$context = stream_context_create($options);
$result = json_decode(file_get_contents($panel_url . "api/line/new", false, $context), true);

Success Response:

{"result":true,"created_id":14838,"username":"d4PSc7uCqF","password":"2ZiSRRZk4b"}

Error Example:

{"result":false,"error":"Username exists."}

✏️ Editing an Existing Line

Endpoint:

http://your-domain:8000/api/line/update

Required: username

PHP Example:

$post_data = array(
  'api_key' => $api_key,
  'username' => 'test_user',
  'data' => array(
    'password' => 'new_pass',
    'max_allowed_connections' => 10,
    'restreamer' => 1,
    'expire_date' => strtotime("+1 month")
  )
);

Success Response:

{"result":true,"modified_id":1234,"username":"test_user","password":"new_pass"}

❌ Deleting a Line

Endpoint:

http://your-domain:8000/api/line/delete

Required: username

Example:

$post_data = array(
  'api_key' => $api_key,
  'username' => 'test_user'
);

🔍 Viewing Line Info

Endpoint:

http://your-domain:8000/api/line/info

Example:

$post_data = array(
  'api_key' => $api_key,
  'username' => 'test_user'
);

Sample Output:

{
  "result":true,
  "info":{
    "expire_date":"2024-12-01",
    "max_allowed_connections":3
  },
  "conn_info":{
    "current_connections":1
  },
  "channel_ids":[12, 14, 18]
}

🧠 Pro Tips

  • Leave username or password blank to auto-generate them
  • You can pass arrays for: allowed_ips, user_agents, notes, server_id, isp_lock
  • All API errors can be found under: LOGS → Panel Error Log

This guide gives you all essential tools to integrate and automate IPTV line management using the MidnightStreamer Pro Server API.