X Acceleration Codec Documentation
  • Introduction
  • Releases
  • Installation
  • Server
  • Stream
  • DVB
  • VOD
  • User
  • Account
  • API
  • FAQ
  • Supports

API

  • Getting Started
    • Create API Token
    • Use API Token
  • Server API
    • Get All Server Stats
    • Example
  • Stream API
    • Add Stream
    • Get Stream Config
    • Get All Stream Stats
    • Get Stream Stats
    • Get Stream Log
    • Delete Stream Log
    • Start/Stop/Restart Stream
    • Restart All Streams
    • Delete Stream
    • Update Stream Source
    • Update Decryption Key
    • Update Stream Config
    • Dynamic URL
    • Reset Errors
  • Category API
    • Add/Update Category
    • Get Category
    • Delete Category
  • Proxy API
    • Add/Update Proxy
    • Get Proxy Info
    • Delete Proxy
  • User API
    • Add User
    • Add User Package
    • Renew User Package
    • Change User Package
    • Cancel User Package
    • Query User Info
  • DVB API
    • Fetch All Control Word
    • Fetch Control Word Via Service ID

Getting Started

Create API Token

For generate the API token, please login to the xaccel panel first, then follow the steps:

  1. Click the icon at top right corner.
  2. Click the icon at popup menu for open the Account Settings page.
  3. Click the icon at right of API Token option for generate new API token and save the settings.

Use API Token

API Token is required to enable in your account settings. The token will be used in the each API request for identify your permission. You need add an Authorization: Token XXX header to your each request. XXX is the token you generated in your Account Settings page.

Server API

Get All Server Stats

GET /api/server/stats

Example

$ curl -X GET \
       -H 'Authorization: Token fiMY9nMdrE82zSD1IbUuVr6J' \
       'http://192.168.2.3:8000/api/server/stats'

Stream API

Add Stream

POST /api/stream/add

Example

$ curl -X POST \
       -H 'Content-Type: application/json' \
       -H 'Authorization: Token fiMY9nMdrE82zSD1IbUuVr6J' \
       --data '{"name": "Test", "input_urls": ["lavfi://nullsrc=1920x1080,anullsrc"], "server_id": 1, "video_encoders": [{"codec": "copy"}], "audio_encoders": [{"codec": "copy"}], "outputs": [{"protocol": "hls", "filename": "index.m3u8"}]}' \
       'http://192.168.2.3:8000/api/stream/add'

Get Stream Config

GET /api/stream/<int:stream_id|str:stream_name>/config

Example

$ curl -X GET \
       -H 'Authorization: Token fiMY9nMdrE82zSD1IbUuVr6J' \
       'http://192.168.2.3:8000/api/stream/Bein%20Sports/config'

Get All Stream Stats

GET /api/stream/stats

Example

$ curl -X GET \
       -H 'Authorization: Token fiMY9nMdrE82zSD1IbUuVr6J' \
       'http://192.168.2.3:8000/api/stream/stats'

Get Stream Stats

GET /api/stream/<int:stream_id|str:stream_name>/stats

Example

$ curl -X GET \
       -H 'Authorization: Token fiMY9nMdrE82zSD1IbUuVr6J' \
       'http://192.168.2.3:8000/api/stream/1/stats'

Tips

  • Custom select stream config in get stream stats API is supported since v5.4.8. You will able to query stream stats and extra stream config you need together. just add URL parameter ?extra_columns=sleep,rate_emulation, then response will also contains these stream config you requested. This feature works for Get All Stream Stats API too.

Get Stream Log

GET /api/stream/<int:stream_id|str:stream_name>/log

$ curl -X GET \
       -H 'Authorization: Token fiMY9nMdrE82zSD1IbUuVr6J' \
       'http://192.168.2.3:8000/api/stream/1/log'

Delete Stream Log

POST /api/stream/log/deletePOST /api/stream/<int:stream_id|str:stream_name>/log/delete

Start/Stop/Restart Stream

POST /api/stream/<int:stream_id|str:stream_name>/start

POST /api/stream/<int:stream_id|str:stream_name>/stop

POST /api/stream/<int:stream_id|str:stream_name>/restart

$ curl -X POST \
       -H 'Authorization: Token fiMY9nMdrE82zSD1IbUuVr6J' \
       'http://192.168.2.3:8000/api/stream/1/start'

$ curl -X POST \
       -H 'Authorization: Token fiMY9nMdrE82zSD1IbUuVr6J' \
       'http://192.168.2.3:8000/api/stream/Bein%20Sports/stop'

Tips

If use the stream name to start or stop stream, since the name may contain whitespace and other special characters, so URL encoding is required.

Restart All Streams

POST /api/stream/restart-all

Example

$ curl -X POST \
       -H 'Authorization: Token fiMY9nMdrE82zSD1IbUuVr6J' \
       'http://192.168.2.3:8000/api/stream/restart-all'

Delete Stream

POST /api/stream/<int:stream_id|str:stream_name>/delete

Example

$ curl -X POST \
       -H 'Authorization: Token fiMY9nMdrE82zSD1IbUuVr6J' \
       'http://192.168.2.3:8000/api/stream/Bein%20Sports/delete'

Update Stream Source

POST /api/stream/<int:stream_id|str:stream_name>/source-update

POST /api/stream/<int:stream_id|str:stream_name>/source-update-with-restart

Post Data

["url1", "url2", "url3"]

Example

$ curl -X POST \
       -H 'Content-Type: application/json' \
       -H 'Authorization: Token fiMY9nMdrE82zSD1IbUuVr6J' \
       --data '["https://livesim.dashif.org/livesim/chunkdur_1/ato_7/testpic4_8s/Manifest.mpd"]' \
       'http://192.168.2.3:8000/api/stream/Bein%20Sports/source-update'

Tips

You should post the json list data and the list contains the stream source URLs you want to update to. It will override the original stream source completely, so if the original sources contains backup URLs, you should post the backup URLs here too.

Update Decryption Key

POST /api/stream/<int:stream_id|str:stream_name>/decryption-key-update

Post Data

[
    {
         "kid": "32 bytes kid",
         "key": "32 bytes key"
    },
    {
         "kid": "32 bytes kid",
         "key": "32 bytes key"
    }
]

Example

$ curl -X POST \
       -H 'Content-Type: application/json' \
       -H 'Authorization: Token fiMY9nMdrE82zSD1IbUuVr6J' \
       --data '[{"kid": "ef6da52114a8965d2aa2e3956f649c86", "key": "7077907241013942bd543b8e1eb8dee9"}, {"kid": "ecf8aa2b4e2585937791bb593593ad4d", "key": "b43e943cfcc74fbeb80348aab91c761c"}]' \
       'http://192.168.2.3:8000/api/stream/Bein%20Sports/decryption-key-update'

Update Stream Config

POST /api/stream/<int:stream_id|str:stream_name>/update

POST /api/stream/<int:stream_id|str:stream_name>/update-with-restart

Post Data

{
    "name": "Stream Name",
    "user_agent": "HTTP User-Agent",
    "referer": "HTTP Referer",
    "headers": "HTTP headers"
}

Example

$ curl -X POST \
       -H 'Content-Type: application/json' \
       -H 'Authorization: Token fiMY9nMdrE82zSD1IbUuVr6J' \
       --data '{"name": "BeinSports FHD", "user_agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/107.0.0.0 Safari/537.36"}' \
       'http://192.168.2.3:8000/api/stream/Bein%20Sports/update'

Notice

  • http_proxy field is deprecated in v5 panel. A new proxy option is added. It's a <int:proxy_id> list. you need call proxy API to add proxy first. Then use the proxy option in the POST to specify which proxy you want use for the stream.
  • For more stream config option and column type, please check the stream_config table in the database.

Dynamic URL

POST /api/stream/<int:stream_id|str:stream_name>/dynamic-url

Post Data

["http://xxxxx?decryption_key=KID:KEY,KID:KEY"]
["http://xxxxx?decryption_key=KID:KEY,KID:KEY&http_proxy=http://xxxx"]
["http://xxxxx?decryption_key=KID:KEY,KID:KEY&http_proxy=http://xxxx&headers=NAME: VALUE\r\nNAME: VALUE\r\n"]

Tips

  • decryption_key, http_proxy and headers are supported URL query parameters, you can use this API to update the source URL, decryption keys, http proxy and headers.

  • headers URL parameter is added since v5.4.8.

Reset Errors

POST /api/stream/reset-errors

Category API

Add/Update Category

POST /api/category/add

POST /api/category/<str:category_name>/update

Post Data

{
    "name": "New Category Name",
    "streams": [],
    "movies": [],
    "series": []
}
  • streams, movies and series are json int list. You can passing the stream, movie or series ID in the list.

Get Category

GET /api/category/info

GET /api/category/<str:category_name>/info

Delete Category

POST /api/category/<str:category_name>/delete

Proxy API

Add/Update Proxy

POST /api/proxy/add

POST /api/proxy/<int:proxy_id|str:proxy_name>/update

Post Data

{
    "name": "Proxy Test",
    "type": "http",
    "host": "192.168.1.1",
    "port": 8001,
    "username": "test",
    "password": "test",
    "streams": [1,2,3]
}

Tips

  • type must be http, http+ssl, socks5, socks5+ssl or ssh.
  • username and password is optional.
  • streams is a <int:stream_id> list, for specify which streams you want to use this proxy.

Get Proxy Info

GET /api/proxy/info

GET /api/proxy/<int:proxy_id|str:proxy_name>/info

Delete Proxy

POST /api/proxy/<int:proxy_id|str:proxy_name>/delete

User API

Add User

POST /api/user/add

Post Data

{
    "username": "Username",
    "password": "Password"
}

Tips

If username or password is not specified, it will generate a random username and password. And return it in the response.

Example

$ curl -X POST \
       -H 'Content-Type: application/json' \
       -H 'Authorization: Token fiMY9nMdrE82zSD1IbUuVr6J' \
       --data '{"username": "test", "password": "test"}' \
       'http://192.168.2.3:8000/api/user/add'
{
  "user_id": 1,
  "username": "test",
  "password": "test",
  "package_id": null,
  "package_name": null,
  "expire_date": "2021-11-05 15:47:05",
  "max_connections": 1
}

Add User Package

POST /api/user/<int:user_id>/package/add

Post Data

{
    "package_id": "Package id"
}
$ curl -X POST \
       -H 'Content-Type: application/json' \
       -H 'Authorization: Token fiMY9nMdrE82zSD1IbUuVr6J' \
       --data '{"package_id": 1}' \
       'http://192.168.2.3:8000/api/user/1/package/add'
{
 "user_id": 1,
 "username": "test",
 "password": "test",
 "package_id": 1,
 "package_name": "Package 1",
 "expire_date": "2021-12-05 23:59:47",
 "max_connections": 1
}

Renew User Package

POST /api/user/<int:user_id>/package/renew

Example

$ curl -X POST \
       -H 'Content-Type: application/json' \
       -H 'Authorization: Token fiMY9nMdrE82zSD1IbUuVr6J' \
       'http://192.168.2.3:8000/api/user/1/package/renew'
{
 "user_id": 1,
 "username": "test",
 "password": "test",
 "package_id": 1,
 "package_name": "Package 1",
 "expire_date": "2022-01-04 23:59:47",
 "max_connections": 1
}

Change User Package

POST /api/user/<int:user_id>/package/change

Post Data

{
    "package_id": "Package id"
}

Example

$ curl -X POST \
       -H 'Content-Type: application/json' \
       -H 'Authorization: Token fiMY9nMdrE82zSD1IbUuVr6J' \
       --data '{"package_id": "2"}' \
       'http://192.168.2.3:8000/api/user/1/package/change'
{
 "user_id": 1,
 "username": "test",
 "password": "test",
 "package_id": 2,
 "package_name": "Package 2",
 "expire_date": "2021-11-24 00:02:54",
 "max_connections": 5
}

Cancel User Package

POST /api/user/<int:user_id>/package/cancel

Example

$ curl -X POST \
       -H 'Content-Type: application/json' \
       -H 'Authorization: Token fiMY9nMdrE82zSD1IbUuVr6J' \
       'http://192.168.2.3:8000/api/user/1/package/cancel'
{
 "user_id": 1,
 "username": "test",
 "password": "test",
 "package_id": null,
 "package_name": null,
 "expire_date": "2021-11-05 16:05:21",
 "max_connections": 0
}

Query User Info

GET /api/user/<int:user_id|str:username>/info

Example

$ curl -X GET \
       -H 'Content-Type: application/json' \
       -H 'Authorization: Token fiMY9nMdrE82zSD1IbUuVr6J' \
       'http://192.168.2.3:8000/api/user/test/info'
{
 "user_id": 1,
 "username": "test",
 "password": "test",
 "package_id": null,
 "package_name": null,
 "expire_date": "2021-11-05 16:05:21",
 "max_connections": 0
}

DVB API

Fetch All Control Word

If you are using panel's builtin DVB adapter and SoftCAM feature, it's possible to get the decryption CW in real-time, but only the channels you added and running in the panel will able to get CW. Since the CW is changed periodically, so you need use HTTP request to polling the CW for every a few seconds.

GET /api/adapter/service/cw/all

Example

$ curl -X GET \
       -H 'Authorization: Token fiMY9nMdrE82zSD1IbUuVr6J' \
       'http://192.168.2.3:8000/api/adapter/service/cw/all'
[
  {
    "tp": "12680 V", 
    "sid": 419, 
    "name": "EPTV Ribeir Preto", 
    "timestamp": 1666482459049, 
    "cw": "f99275005f2fd76571a13c4e6b1fbe48"
  }, 
  {
    "tp": "12680 V", 
    "sid": 431, 
    "name": "EPTV S Carlos", 
    "timestamp": 1666482454449, 
    "cw": "3b1f328cd2dea757603ddd7a26ccfef0"
  }, 
  {
    "tp": "12680 V", 
    "sid": 432, 
    "name": "TV Vanguarda S. J. dos Campos", 
    "timestamp": 1666482457502, 
    "cw": "146ba4235e90fdeba7702a41be71a3d2"
  }
]

Fetch Control Word Via Service ID

GET /api/adapter/service/<int:service_id>/cw

Example

$ curl -X GET \
       -H 'Authorization: Token fiMY9nMdrE82zSD1IbUuVr6J' \
       'http://192.168.2.3:8000/api/adapter/service/432/cw'
  {
    "tp": "12680 V", 
    "sid": 432, 
    "name": "TV Vanguarda S. J. dos Campos", 
    "timestamp": 1666482457502, 
    "cw": "146ba4235e90fdeba7702a41be71a3d2"
  }
Prev
Account
Next
FAQ