WASIF TV API

Free, fast, and reliable Live TV streaming API. Integrate 100+ live TV channels into your website or app with just a few lines of code.

Authentication

Our public API endpoints do not require any API keys or tokens. You can make requests directly from your frontend (browser) or backend (server).

Note: The stream URLs are generated dynamically for security. You must request the stream URL from our API for each channel before playing it.

Rate Limits

To ensure fair usage and stability, we apply the following rate limits:

Endpoint Limit
/api/channel.php 120 requests / minute / IP
/api/categories.php 120 requests / minute / IP
/api/stream.php 120 requests / minute / IP
Warning: Exceeding the rate limit will result in a 429 Too Many Requests response.

List All Channels

Returns a list of all active live TV channels. You can optionally filter by category.

GET https://tv.wasifali.tech/api/channel.php

Query Parameters

ParameterTypeRequiredDescription
categorystringNoFilter by category slug (e.g., news, sports)
idintegerNoGet a single channel by ID

Example Request

GET https://tv.wasifali.tech/api/channel.php?category=news

Example Response

{
  "status": true,
  "data": {
    "count": 2,
    "category": "news",
    "data": [
      {
        "id": 26,
        "name": "ARY News",
        "category": "news",
        "logo": "https://tv.wasifali.tech/assets/img/logos/26.webp",
        "views": 4321
      },
      {
        "id": 27,
        "name": "Geo News",
        "category": "news",
        "logo": "https://tv.wasifali.tech/assets/img/logos/27.webp",
        "views": 3890
      }
    ]
  }
}

List Categories

Returns all available categories with channel counts.

GET https://tv.wasifali.tech/api/categories.php

Example Response

{
  "status": true,
  "data": {
    "count": 3,
    "data": [
      { "slug": "entertainment", "label": "Entertainment", "icon": "🎭", "count": 35 },
      { "slug": "news", "label": "News", "icon": "📰", "count": 28 },
      { "slug": "sports", "label": "Sports", "icon": "⚽", "count": 4 }
    ]
  }
}

Get Stream URL

Returns a secure proxy URL to play a specific channel. The URL is valid for 1 hour.

GET https://tv.wasifali.tech/api/stream.php?id=17

Query Parameters

ParameterTypeRequiredDescription
idintegerYesThe channel ID from the channel list

Example Response

{
  "status": true,
  "data": {
    "channel_id": 17,
    "name": "Green Entertainment",
    "category": "entertainment",
    "logo": "https://tv.wasifali.tech/assets/img/logos/17.webp",
    "play_url": "https://tv.wasifali.tech/backend/stream_proxy.php?ch=17&t=HMAC_TOKEN&exp=1735689600",
    "expires_in": 3600,
    "expires_at": 1735689600
  }
}
Important: Do not cache the play_url for more than an hour. Request a new one when expired.

JavaScript Example (HLS.js)

Here is how you can play a channel using our API and HLS.js.

<video id="video" controls></video>
<script src="https://cdn.jsdelivr.net/npm/hls.js@1"></script>
<script>
  async function playChannel(channelId) {
    // 1. Fetch the secure stream URL from our API
    const res = await fetch('https://tv.wasifali.tech/api/stream.php?id=' + channelId);
    const json = await res.json();
    
    if (!json.status) return alert('Channel not found');

    const playUrl = json.data.play_url;

    // 2. Play using HLS.js
    const video = document.getElementById('video');
    if (Hls.isSupported()) {
      const hls = new Hls();
      hls.loadSource(playUrl);
      hls.attachMedia(video);
      hls.on(Hls.Events.MANIFEST_PARSED, () => video.play());
    } else if (video.canPlayType('application/vnd.apple.mpegurl')) {
      video.src = playUrl;
      video.play();
    }
  }

  // Play channel ID 17
  playChannel(17);
</script>

PHP Example

Fetching the stream URL using PHP cURL.

<?php
$channelId = 17;
$apiUrl = 'https://tv.wasifali.tech/api/stream.php?id=' . $channelId;

$ch = curl_init($apiUrl);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);
curl_close($ch);

$data = json_decode($response, true);

if ($data['status']) {
    echo "Stream URL: " . $data['data']['play_url'];
} else {
    echo "Error: " . $data['message'];
}
?>

Python Example

Fetching the stream URL using Python requests.

import requests

channel_id = 17
api_url = f"https://tv.wasifali.tech/api/stream.php?id={channel_id}"

response = requests.get(api_url)
data = response.json()

if data.get("status"):
    print("Stream URL:", data["data"]["play_url"])
else:
    print("Error:", data.get("message"))

Error Codes

Our API uses standard HTTP response codes.

CodeMeaningDescription
200OKRequest was successful
400Bad RequestMissing required parameters
403ForbiddenInvalid token or access denied
404Not FoundChannel not found or inactive
429Too Many RequestsRate limit exceeded
500Internal ErrorSomething went wrong on our end

Sitemap API

Returns an XML sitemap of all channels, useful for SEO.

GET https://tv.wasifali.tech/api/sitemap.php