Skip to content

AVideo Platform API

Daniel Neto edited this page Nov 30, 2026 · 23 revisions

AVideo API

The API is for connecting another application to AVideo. If you only want to upload, manage or embed videos manually, use the normal AVideo interface and embed URL guide; you do not need API credentials.

API secrets can provide powerful server access. Use them only in a trusted server-side application, never in browser JavaScript, a mobile app package, an iframe URL or a public support ticket.

Quick Start

  1. Enable the API plugin.
  2. Enable the Live plugin if you need live-stream information.
  3. Use the simplified /api/ endpoints when URL rewriting is available.
  4. Use user credentials only when an endpoint requires a user account.
  5. Use an API secret only for trusted server-to-server applications.
  6. Read the JSON response and check for errors before using its data.

Playback URLs follow the video's publication status. Without a valid API secret, video_file refuses scheduled, unpublished, draft and other non-viewable videos unless the signed-in user can edit or moderate them. The video listing retains descriptive information while removing media URLs the caller cannot play. The Date Added feeds (video_from_program and audio_from_program without playlists_id) and subscribed tags feeds instead omit videos the caller cannot play, including password-protected videos without the matching video_password. Their indexes refer to the remaining videos. A valid API secret preserves those feeds' existing listing behavior; program and series playlist members retain their existing rules. Unlisted videos remain accessible by link; group, subscription and password requirements still apply where supported by the endpoint. Owners and administrators also need the matching video password in these feeds when they do not use a valid API secret. Keep API secrets in trusted server-side integrations.

Working React example

If you are building a separate web interface, see the AVideo React Sample. It is a working reference frontend that uses the API for video browsing and search, account access, reactions, favorites, comments, and playlists, while using the AVideo embed player for playback. Follow Build Your Own Frontend for setup notes and production security considerations.


1. Enable the Required Plugins

In the AVideo administration panel, open:

Admin → Plugins

Enable:

  • API for /api/... endpoints.
  • Live for live streaming.
  • LiveLinks if the site uses external live-stream sources.

The interactive API documentation is available at (also the Info button on the API plugin row):

https://YOUR-DOMAIN/plugin/API/

Only administrators can open it. To let a developer open it without an admin account, add their exact IP address to the API plugin option Documentation allowed IPs (documentationAllowedIPs). See OpenAPI Documentation.


2. Endpoint Formats

AVideo supports a simplified format and a legacy format.

Read data with GET

Purpose Simplified format Legacy format
Sign in /api/signIn /plugin/API/get.json.php?APIName=signIn
List videos /api/video /plugin/API/get.json.php?APIName=video
List live streams /api/livestreams /plugin/API/get.json.php?APIName=livestreams
List categories /api/categories /plugin/API/get.json.php?APIName=categories

Example:

GET https://video.example.com/api/video?rowCount=10

Equivalent legacy request:

GET https://video.example.com/plugin/API/get.json.php?APIName=video&rowCount=10

The simplified /api/... URLs work only when AVideo is installed at the root of the domain (for example https://video.example.com/). If AVideo is in a subfolder (for example https://example.com/AVideo/), use the legacy format.

Create, update, or delete data

For simplified endpoints, use the HTTP method required by the endpoint:

POST /api/signUp
POST /api/video_save
DELETE /api/video_delete

For legacy requests, write operations use set.json.php:

POST /plugin/API/set.json.php?APIName=signUp
POST /plugin/API/set.json.php?APIName=video_save

Do not replace every legacy URL with /api/... without also using the correct HTTP method. With the simplified format, GET is sent to get.json.php and POST/DELETE to set.json.php.

Send credentials (the API secret, or user and pass) with every write request. A write request without them is accepted only as a POST coming from a page of the same AVideo site; from another site or application it is refused (HTTP 405 for non-POST, 403 for other sites). A session cookie alone is not enough.


3. Authentication

Not every endpoint requires authentication. Public videos, categories, and public live streams can normally be read without signing in.

AVideo supports three different authentication cases.

3.1 Username and password

Send user and pass to endpoints that accept user authentication:

GET https://video.example.com/api/signIn?user=USERNAME&pass=PASSWORD

Use HTTPS. A password must never be sent over plain HTTP.

3.2 Encoded password or returned login token

Some AVideo clients use an already encoded credential:

GET /api/signIn?user=USERNAME&pass=ENCODED_VALUE&encodedPass=true

Important:

  • This value is not a simple MD5 hash.
  • Do not calculate it with md5(password).
  • A successful sign-in response contains a pass value (it starts with _user_hash_) that AVideo clients can reuse with encodedPass=true.
  • That token expires: after 1 day for a normal sign-in, or after up to 1 year when the sign-in used rememberme=true. Changing the user's password also cancels it. When it stops working, sign in again with the real password.
  • Treat the returned pass value like a private login token.

Failed password checks are limited (by account and by IP address). After too many failures, sign-in is blocked for a while and the API answers HTTP 429 or the message "Too many failed login attempts".

The following endpoint exists:

GET /objects/encryptPass.json.php?pass=PASSWORD

However, it is restricted to logged-in administrators and should not be used as a public password-conversion service.

3.3 API secret

The API secret is a server-wide secret for trusted integrations. It is not a user login token.

Find it in Admin Panel → Plugins, API plugin, Edit parameters, option APISecret. You can replace it there with a new long random value at any time (for example if it leaked); old integrations then stop working until you update them.

Send it as a bearer token:

Authorization: Bearer YOUR_API_SECRET

Example:

curl \
  -H "Authorization: Bearer YOUR_API_SECRET" \
  "https://YOUR-DOMAIN/api/isAPISecretValid"

It may also be sent as a parameter:

GET /api/isAPISecretValid?APISecret=YOUR_API_SECRET

The bearer header is preferred because query parameters may be stored in access logs and browser history.

Never place the API secret in:

  • Public JavaScript
  • A mobile application
  • A GitHub repository
  • A URL shared with users

Use it only on a trusted server.


4. Sign In

GET request

GET https://video.example.com/api/signIn?user=admin&pass=123

POST request

curl -X POST "https://video.example.com/api/signIn" \
  -H "Content-Type: application/json" \
  -d '{
    "user": "YOUR_USERNAME",
    "pass": "YOUR_PASSWORD"
  }'

A successful response contains information such as:

{
  "id": 1,
  "user": "admin",
  "name": "Administrator",
  "isLogged": true,
  "isAdmin": true,
  "canUpload": true,
  "canStream": true,
  "channelName": "admin",
  "PHPSESSID": "SESSION_ID",
  "pass": "REUSABLE_PRIVATE_LOGIN_VALUE"
}

Check isLogged. The sign-in response does not use status: "1".

A wrong user or password returns "isLogged": false (without an error text). Some other failures also return an error message, for example:

{
  "error": "Please verify your email address"
}

Other possible messages: User and Password can not be blank, Invalid Captcha, 2FA login is required, Too many failed login attempts. Try again later.

Simple PHP example

<?php

function avideoSignIn(
    string $siteURL,
    string $username,
    string $password
): array {
    $url = rtrim($siteURL, '/') . '/api/signIn?' . http_build_query([
        'user' => $username,
        'pass' => $password,
    ]);

    $json = file_get_contents($url);
    $data = json_decode($json, true);

    if (!is_array($data)) {
        throw new RuntimeException('AVideo returned an invalid response.');
    }

    if (empty($data['isLogged'])) {
        $message = $data['error'] ?? 'Sign-in failed.';
        throw new RuntimeException($message);
    }

    return $data;
}

$user = avideoSignIn(
    'https://video.example.com',
    'YOUR_USERNAME',
    'YOUR_PASSWORD'
);

echo 'Signed in as: ' . $user['user'];

This example verifies the credentials. If later requests need the remote AVideo session, your application must preserve and resend the AVideo session cookie.


5. List Videos

GET https://video.example.com/api/video?rowCount=10

Useful parameters include:

Parameter Description
rowCount Maximum number of results per page
current Page number
catName Category clean name
channelName Channel clean name
searchPhrase Text to search
videos_id Return a specific video
noRelated=1 Do not include related videos

Examples:

GET /api/video?rowCount=10&current=1
GET /api/video?videos_id=123
GET /api/video?catName=default&rowCount=10
GET /api/video?searchPhrase=music&rowCount=10
GET /api/video?channelName=MyChannel&rowCount=10

The result is normally inside:

{
  "error": false,
  "response": {
    "rows": []
  }
}

Each row can contain:

  • Video ID
  • Title and description
  • Channel information
  • Poster images
  • Video page URL
  • Embed URL
  • Playback sources
  • Duration
  • View count
  • Likes and dislikes

6. List Live Streams

The correct API resource is livestreams, not live.

Recommended endpoint

GET https://YOUR-DOMAIN/api/livestreams

Legacy equivalent:

GET https://YOUR-DOMAIN/plugin/API/get.json.php?APIName=livestreams

The API and Live plugins must be enabled.

Direct Live endpoint

If you do not need the API plugin, the Live plugin also provides:

GET https://YOUR-DOMAIN/plugin/Live/stats.json.php

The /api/livestreams endpoint returns the information from this Live endpoint.

Example response

The exact fields depend on the live-server configuration and enabled plugins.

{
  "applications": [
    {
      "type": "live",
      "title": "My Live Stream",
      "users_id": 1,
      "name": "My Channel",
      "key": "abc123",
      "live_servers_id": 1,
      "href": "https://example.com/live/1/MyChannel",
      "poster": "https://example.com/plugin/Live/getImage.php?...",
      "m3u8": "https://live.example.com/live/abc123/index.m3u8",
      "isPrivate": false,
      "isPasswordProtected": false,
      "isRebroadcast": false
    }
  ]
}

The most useful fields are:

Field Meaning
applications Public live streams available to the current visitor
title Live-stream title
type Usually live, scheduleLive, or LiveLink
users_id Owner's user ID
name Channel or user name
key Internal live-stream identifier
live_servers_id Server handling the live stream
href or link AVideo watch page
poster Preview image
m3u8 HLS playback URL, when available
isPrivate Whether the stream is private
isPasswordProtected Whether a password is required
isRebroadcast Whether the stream is being rebroadcast

If applications is empty, no public live stream is currently available to that request.


7. Get the M3U8 URL

What is an M3U8 URL?

An M3U8 URL is an HLS playlist used by video players to play a live stream.

It may look like:

https://live.example.com/live/STREAM_KEY/index.m3u8

It can also be an adaptive playlist:

https://live.example.com/live/STREAM_KEY.m3u8

When live protection is enabled, it may look like:

https://example.com/plugin/Live/m3u8.php?live_servers_id=1&uuid=...

All of these formats are valid. Use the URL returned by AVideo. Do not build the URL manually.

JavaScript example

async function getLiveStreams() {
  const response = await fetch(
    "https://YOUR-DOMAIN/api/livestreams"
  );

  if (!response.ok) {
    throw new Error(`HTTP error ${response.status}`);
  }

  const data = await response.json();
  return data.applications || [];
}

async function getM3U8URLs() {
  const streams = await getLiveStreams();

  return streams
    .filter(stream => stream.type === "live" && stream.m3u8)
    .map(stream => ({
      title: stream.title,
      channel: stream.name,
      watchURL: stream.href || stream.link,
      poster: stream.poster,
      m3u8: stream.m3u8
    }));
}

getM3U8URLs()
  .then(streams => console.log(streams))
  .catch(error => console.error(error));

PHP example

<?php

$url = 'https://YOUR-DOMAIN/api/livestreams';

$json = file_get_contents($url);
$data = json_decode($json, true);

if (!is_array($data)) {
    throw new RuntimeException('Invalid API response.');
}

$applications = $data['applications'] ?? [];

foreach ($applications as $live) {
    if (($live['type'] ?? '') !== 'live') {
        continue;
    }

    if (empty($live['m3u8'])) {
        continue;
    }

    echo 'Title: ' . ($live['title'] ?? 'Untitled') . PHP_EOL;
    echo 'Channel: ' . ($live['name'] ?? '') . PHP_EOL;
    echo 'Watch page: ' . ($live['href'] ?? $live['link'] ?? '') . PHP_EOL;
    echo 'M3U8: ' . $live['m3u8'] . PHP_EOL;
    echo PHP_EOL;
}

Why an M3U8 field may be missing

An item may not contain m3u8 when:

  • It is a scheduled stream that has not started.
  • It is no longer online.
  • It comes from the LiveLinks plugin.
  • The current user does not have permission to watch it.
  • It is password-protected and the request is not from the owner, an admin, or a session that already entered the password (key is also removed).
  • The live server has not finished creating the HLS playlist.
  • The server could not confirm the live stream.

When m3u8 is missing, use href or link to open the AVideo watch page.

Do not guess an M3U8 URL from the stream key.


8. Check Whether a Stream Is Online

If you already know the live-stream key:

GET https://YOUR-DOMAIN/plugin/Live/stats.json.php?name=STREAM_KEY

Example:

GET https://YOUR-DOMAIN/plugin/Live/stats.json.php?name=abc123

The response contains:

{
  "msg": "ONLINE",
  "name": "abc123"
}

or:

{
  "msg": "OFFLINE",
  "name": "abc123"
}

This request also returns the normal live statistics. Find the matching item in applications to obtain its title, poster, watch page, and M3U8 URL.


9. Protected Live Streams

A returned M3U8 URL may require:

  • A logged-in AVideo session
  • Session cookies
  • A live-stream password
  • Access to a private user group
  • Pay-per-view access
  • Permission from another enabled plugin

A URL that works in one browser may not work in another application without the same authentication.

Do not replace a protected AVideo URL with a direct nginx or CDN address. That can bypass access controls.

Do not store protected M3U8 URLs permanently. Request a current URL when playback begins.


10. External Live Streams

The LiveLinks plugin allows an administrator or authorized user to register an external M3U8 stream.

A LiveLinks item normally contains:

{
  "type": "LiveLink",
  "liveLinks_id": 15,
  "title": "External Live Stream",
  "href": "https://YOUR-DOMAIN/liveLink/15/External-Live-Stream",
  "poster": "https://YOUR-DOMAIN/plugin/LiveLinks/getImage.php?id=15"
}

The public live statistics do not always expose the original external M3U8 URL. In that case, use the href watch page.

This prevents an application from accidentally bypassing the rules applied by AVideo.


11. What Is liveNow?

liveNow is a player page that automatically chooses content to play.

Basic URL:

https://YOUR-DOMAIN/liveNow

Example:

https://video.example.com/liveNow?muted=1&isClosed=1

AVideo searches in this order:

  1. An active native AVideo live stream.
  2. An active stream from the LiveLinks plugin.
  3. A suggested or recent regular video if no live stream is available.

This makes liveNow useful for:

  • A homepage featured player
  • A TV-style continuous player
  • A live preview
  • An iframe on another page
  • A player that falls back to recorded content

liveNow is a player page, not a JSON API. Use /api/livestreams when your application needs structured data.


12. liveNow Options

Start muted

/liveNow?muted=1

The player starts without sound. This is useful because browsers commonly block autoplay with sound.

Compact or closed preview state

/liveNow?isClosed=1

This option:

  • Starts the player in its closed preview state.
  • Hides some player labels and the large play button.
  • Prevents the initial closed preview from counting as a normal view.
  • Does not mean that the live stream is offline.
  • Does not stop playback.

It is intended for a preview that can later be opened by the parent page.

Combine both options

/liveNow?muted=1&isClosed=1

Limit playback to a channel

/channel/CHANNEL_NAME/liveNow

Example:

https://YOUR-DOMAIN/channel/MyChannel/liveNow?muted=1

AVideo first looks for a live stream owned by that channel. If none is available, it can fall back to a video from the same channel.

Limit playback to a category

/cat/CATEGORY_NAME/liveNow

Example:

https://YOUR-DOMAIN/cat/news/liveNow?muted=1

AVideo looks for content in that category or its direct child categories.

Use the category's clean URL name, not its display title.


13. Embed liveNow

<iframe
  id="avideo-live"
  src="https://YOUR-DOMAIN/liveNow?muted=1&isClosed=1"
  allow="autoplay; fullscreen; picture-in-picture"
  allowfullscreen
  style="width: 100%; height: 500px; border: 0;">
</iframe>

The iframe automatically plays the selected live stream or fallback video.


14. Receive Information from liveNow

When the page loads, liveNow sends information to its parent window with postMessage.

window.addEventListener("message", event => {
  if (event.origin !== "https://YOUR-DOMAIN") {
    return;
  }

  const media = event.data;

  console.log("Title:", media.title);
  console.log("Is live:", media.isLive);
  console.log("Is recorded video:", media.isVOD);
  console.log("User ID:", media.users_id);
  console.log("Live key:", media.key);
  console.log("Poster:", media.posterURL);
});

Possible fields include:

{
  "videos_id": 0,
  "isLive": true,
  "isVOD": false,
  "title": "My Live Stream",
  "posterURL": "https://...",
  "duration": "Live",
  "views_count": 0,
  "creator": "Channel Owner",
  "users_id": 1,
  "key": "abc123"
}

Always verify event.origin before trusting a message.


15. Control an Embedded liveNow Player

The parent page can send commands to the iframe.

const iframe = document.getElementById("avideo-live");
const avideoOrigin = "https://YOUR-DOMAIN";

function sendToAVideo(type) {
  iframe.contentWindow.postMessage({ type }, avideoOrigin);
}

Available commands:

sendToAVideo("playPlayer");
sendToAVideo("pausePlayer");
sendToAVideo("playerMute");
sendToAVideo("playerUnmute");
sendToAVideo("open");
sendToAVideo("close");
sendToAVideo("userInactive");

Example buttons:

<button onclick="sendToAVideo('playPlayer')">Play</button>
<button onclick="sendToAVideo('pausePlayer')">Pause</button>
<button onclick="sendToAVideo('playerUnmute')">Enable sound</button>
<button onclick="sendToAVideo('playerMute')">Mute</button>
<button onclick="sendToAVideo('open')">Open preview</button>
<button onclick="sendToAVideo('close')">Close preview</button>

The open and close commands change the player preview state. They do not start or stop the live broadcast.


16. Search

There is no general /api/search resource in the current API plugin.

Search videos with:

GET /api/video?searchPhrase=SEARCH_TEXT

Search channels with:

GET /api/channels?searchPhrase=SEARCH_TEXT

Example:

GET https://YOUR-DOMAIN/api/video?searchPhrase=music&rowCount=10

17. Video Views and Statistics

videoAddView is not a current API plugin resource.

AVideo's own player registers views through internal endpoints such as:

/objects/videoAddViewCount.json.php

External applications that need detailed watch-time or advertising statistics should follow the statistics guide:

Collecting video and ad playback statistics


18. Common Endpoints

Endpoint Method Purpose
/api/signIn GET or POST Sign in
/api/signUp POST Create an account
/api/video GET List, search, or retrieve videos
/api/categories GET List categories
/api/channels GET List or search channels
/api/user GET Retrieve user information
/api/livestreams GET List current live streams
/api/live_schedule GET Retrieve a user's live schedules
/api/livestream_save POST Create or update live-stream settings
/api/isAPISecretValid GET Validate an API secret
/plugin/Live/stats.json.php GET Read Live plugin statistics
/liveNow GET Open the automatic live/fallback player

The following names from older documentation are not current API resources:

Incorrect or outdated name Use instead
/api/live /api/livestreams
/api/search /api/video?searchPhrase=... or /api/channels?searchPhrase=...
/api/encryptPass Admin-only /objects/encryptPass.json.php, when specifically required
/api/videoAddView Use the AVideo player or the documented statistics integration

19. OpenAPI Documentation

Log in as an administrator and open:

https://YOUR-DOMAIN/plugin/API/

The page displays the generated OpenAPI 3.1 documentation, including:

  • Available endpoints
  • Required HTTP methods
  • Parameters
  • Authentication requirements
  • Response schemas
  • Example requests

The specification itself is generated at:

https://YOUR-DOMAIN/plugin/API/swagger.json.php

It lists the endpoints of the core API and of every enabled plugin that adds API endpoints.

Both pages are open only to:

  • signed-in administrators; or
  • visitors whose exact IP address is listed in the API plugin option Documentation allowed IPs (documentationAllowedIPs). Separate several addresses with commas or spaces.

Anyone else gets an "API documentation access denied" page that shows their IP address. Allowing an IP only shows the documentation; it does not allow API calls. Everyone behind that IP (for example an office network) gets access. If your site is behind a proxy or CDN, the real visitor IP is used only when trusted proxies are configured.


20. Additional Resources

Clone this wiki locally