Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
ADMIN privilege is required for all of these functions.
Lists the text strings, options and defaults used when configuring bouquets within TVH (ie Configuration -> Channel/EPG -> Bouquets).
Create a new bouquet.
conf
Object describing the new bouquet. An element ext_url
is required; presumably in the format of the source
element in bouquet/grid.
Removes the link from a channel to the bouquet that it is part of.
uuid
uuid(s) of channels to detach.
Lists details of bouquets. For details of the parameters and selection criteria which can be applied, see Common Parameters.
Lists names and bouquets. The list excerpted below is coded into tvheadend.
Scan (using an available tuner) one or more bouquets to find their channels. The channel list is NOT returned, just an empty JSON object.
uuid
uuid(s) of bouquet(s) to scan.
API calls related to Conditional Access. ADMIN privilege is necessary for all of these functions.
Lists the text strings, options and defaults used when configuring Conditional Access devices within TVH (ie Configuration -> CAs -> Add).
Lists the text strings, options and defaults used when configuring Conditional Access within TVH (ie Configuration -> CAs).
Create a new CA instance.
class
Name of the class to create, ie one of the classes listed by caclient/builders.
conf
A JSON object describing the new device.
List CA clients.
ADMIN privilege is required for all of these functions except config/capabilities.
Returns a list of some compile-time options which were used to build the software. Requires either 'Web Interface' or 'HTSP Interface' privilege.
Lists the details, descriptions, defaults and current values of the items in the GUI screen Configuration -> General -> Base. See Common Parameters for details of selection parameters.
Untested. Updates the server from an object in the format produced by config/load.
node
The JSON object.
Lists the details and descriptions of items in the TVH GUI screen Configuration -> Debugging -> Memory Information Entries.
Lists details of in-memory objects. See Common Parameters for details of selection parameters.
Lists all of the api functions supported by the server.
Lists information about the server including the software version number.
Functions to query and manipulate the list of channels.
A TVH user can only see via the API those channels which have been enabled and to which access has been allowed. However a user with ADMIN privilege can use the parameter all=1
to see details of every channel, channeltag and category even if they do not have access to them.
Lists the text strings, options and defaults used when configuring channels within TVH (ie Configuration -> Channel/EPG -> Channel -> Add).
Creates a new channel. Requires ADMIN privilege.
conf
A JSON object containing details of the new channel.
Lists details of channels. For details of the parameters and selection criteria which can be applied, see Grid Parameters.
Lists the names and uuids of all known channels. For disabled channels the channel name is enclosed in braces.
These parameters were added at version 4.3-905:
numbers
If non-zero, the LCN appears before the channel name, separated by a space. Default is zero.
sources
If non-zero, the source appears after the channel name, in square brackets and separated by a space. Default is zero.
sort
Either name
to sort by channel name, or numname
to sort by LCN then by name (default). The name sort is case-sensitive.
Renames a channel. Only available from version 4.3.652. Requires ADMIN privilege.
from
The current name of the channel.
to
The new name of the channel.
Lists the text strings, options and defaults used when configuring channels within TVH (ie Configuration -> Channel/EPG -> Channel Tags -> Add).
Creates a new channel tag. Requires ADMIN privilege.
conf
A JSON object containing details of the new channel tag.
Lists details of channel tags. For details of the parameters and selection criteria which can be applied, see Grid Parameters.
Lists the names and uuids of all channel tags.
Untested. Return a list of the categories of events which appear in the current EPG and which the user is permitted to see. Used internally to populate the 'Category 1-3' drop-down boxes in DVR -> Autorecs -> Add (Expert view only). The function only works if the EPG is sourced from XMLTV.
TVHeadend provides the API using the HTTP protocol, by default via port 9981 though this can be changed in the TVH config. API functions appear as pseudo-files under the /api/ root of the server filesystem, with parameters passed to the function via either the GET or POST methods.
The call must include a username and password with access permissions to carry out the requested task. The user must also have the ACCESS_WEB_INTERFACE privilege, either directly or inherited from an earlier '*' user. In other words the "Web interface" box must be ticked on the Access Entries screen; without this all calls will fail with a "403 Forbidden" error.
If TVHeadend has been started with the '--http_root' qualifier, the HTTP root must be included in the URL, thus eg
http://admin:admin@192.168.3.45:9981/myHttpRoot/api/serverinfo
The server does not check that all parameters supplied are valid in the context of the request; unexpected items are ignored. Parameters not in the expected format or not containing the expected data may also be ignored.
The response from TVH follows the HTTP protocol and includes an HTTP/1.1 header with status code. If an error occurs the response is in HTML, for example:
The error returned is generic and does not indicate the source of the problem. Authentication failures (incorrect user/pass) will return "401 Unauthorized", lack of privilege "403 Forbidden", non-existent API functions "404 Not Found", incorrect or missing parameters generally "400 Bad Request".
Data is usually returned as JSON, without any CR or LF characters - the examples given have been 'prettified' using json_pp or jq to make them easier to read. Functions which perform an action rather than return data will return an empty JSON object on successful completion.
This section provides information on the HTTP API for TvHeadend. It was written from the source code of the development version 4.3.
The examples shown were mostly generated from UK Freeview DVB-T / DVB-T2 and Freesat DVB-S / DVB-S2, using a single tuner in each case. Other sources and multiple input devices may give different results.
This API is an advanced feature of TVheadend, and the functionality is unstable and liable to change. The software does not completely validate its inputs and incorrect or unexpected calls may result in undesired behaviour.
Functions to list and manipulate access controls. With the exception of access/entry/userlist, ADMIN privilege is required to use these functions.
Lists the text strings, options and defaults used when configuring access controls within the TVH GUI (ie Configuration -> Users -> Access Entries).
Creates a new user from a JSON object.
conf
The JSON object describing the new user.
Lists users and their privileges. See Common Parameters for details of selection parameters.
Outputs a list of usernames. The "*" user and any users with a zero-length name are excluded.
The function is used internally to populate the "Owner" dropdown in Digital Video Recorder -> Finished Recordings -> Edit. It MUST be called by a user without ADMIN privileges, otherwise an empty list is returned.
Lists the text strings, options and defaults used when configuring access controls within the TVH GUI (ie Configuration -> Users -> IP Blocking Records).
Creates a new IP-based access record.
conf
The JSON object describing the access record.
Lists IP-block records. See Common Parameters for details of selection parameters.
Lists the text strings, options and defaults used when configuring access controls within the TVH GUI (ie Configuration -> Users -> Passwords).
Creates a new password record.
conf
The JSON object describing the record.
Lists passwords for users. Note that "password" is in clear-text while "password2" is base64-encoded with a static prefix. See Common Parameters for details of selection parameters.
If authentication for the user is by persistent token (requires TVHeadend > 4.3.1500) the entry has some extra fields:
Functions to report on and control Elementary Stream filters.
There are separate API functions to operate on the different types of filter, but they all work in the same way. In the descriptions below the XXX
in the function name can be replaced with video
, audio
, teletext
, subtit
(subtitle), ca
or other
as required.
Lists the descriptions, options and defaults for configuring the chosen type of filter, ie Configuration -> Stream -> Stream Filters -> {chosen type} -> Add.
Returns the parameters of the defined filters of the chosen type. The usual selection options are available, see
Creates a new filter of the chosen type. ADMIN privilege is required.
conf
A JSON object describing the filter.
Manipulate EPG grabbers. ADMIN privilege is required for these functions except for epggrab/channel/list.
Lists the EPG grabber channels, ie those appearing in Configuration -> Channel / EPG -> EPG Grabber Channels, together with the available option fields and the selections chosen.
Lists the parameters, descriptions, options and defaults for the GUI screen Configuration -> Channel/EPG -> EPG Grabber Channels.
List EPG Grabber Modules, as shown in the GUI screen Configuration -> Channel/EPG -> EPG Grabber Modules.
node
The JSON object.
Queues a run of the OTA EPG grabber.
trigger
Delay in seconds before the run starts. Minimum is one second, maximum is one week.
Run the internal EPG grabbers immediately.
rerun
Not used but must be an integer greater than zero.
Gives details of the EPG grabber channels, ie from Configuration -> Channel / EPG -> EPG Grabber Channels. See for parameter details.
Lists the parameters, options, defaults and current settings for the EPG grabber, ie Configuration -> Channel / EPG -> EPG Grabber. See for parameter details.
Updates the EPG Grabber configuration from an object in the same format as provided by .
ADMIN privilege is required to use these functions except for profile/list.
Lists the available stream profiles (visible in the GUI at Configuration -> Stream -> Stream Profiles) together with their uuids.
all
A user with ADMIN privilege can use this parameter to see details of every profile even if the profile is disabled or they do not have access to them.
htsp
If set to 1, list only HTSP profiles. Default is 0 (list all).
To get the contents of a stream profile use raw/export, passing it the stream profile's uuid.
Lists the options, defaults and descriptions of configuration parameters (Configuration -> Stream -> Stream Profiles) in the GUI.
Lists the options, defaults and descriptions of configuration parameters when adding a new stream profile (Configuration -> Stream -> Stream Profiles -> Add) in the GUI.
Create a new stream profile.
class
conf
A JSON object containing details of the new profile.
Functions relating to DVB networks, multiplexes and services. Further service functions can be found in the Service section. ADMIN privilege is required for all these functions.
Lists the network(s) associated with a given input device.
uuid
The uuid of the specific hardware device.
To find the input device uuid, use hardware/tree?uuid=root
, then take the id
value from the output and use it as the value of uuid
in another call to hardware/tree. From the output of this function select the id
corresponding to the specific front-end device required.
Lists available networks. The standard parameters listed in Grid Parameters may be used. The items returned depend on the type of network - terrestrial, satellite, IPTV etc.
Lists the text strings, options and defaults used when configuring the DVB capability within TVH (ie Configuration -> DVB Inputs -> Networks).
Lists the text strings, options and defaults used when configuring the DVB capability within TVH (ie Configuration -> DVB Inputs -> Network -> Add).
Create a new network.
class
Required. The class name matching the class
item obtained from a call to mpegts/network/builders.
conf
Required. A JSON object containing the settings for this network.
Lists the text strings, options and defaults used when editing a multiplex using Configuration -> DVB Inputs -> Muxes -> Edit.
uuid
The value of network_uuid
from a call to mpegts/mux/grid.
Create a mux for an existing network.
uuid
The uuid of the network containing this mux.
conf
A JSON object containing the settings for this mux. The contents will depend on the type of network.
A JSON object containing the UUID of the new mux is returned.
Triggers a scan of the requested network(s).
uuid
uuid(s) of the network(s) to scan. More than one may be given; they will be scanned in sequence.
Lists available multiplexes. The standard parameters listed in Grid Parameters may be used.
hidemode
If set to all
, only enabled multiplexes are listed. The default is to show all multiplexes.
Lists the text strings, options and defaults used when configuring the DVB capability within TVH (ie Configuration -> DVB Inputs -> Muxes).
Lists available mpegts services. The standard parameters listed in Grid Parameters may be used.
hidemode
The default is to show only services where the multiplex is enabled and the service has been verified. Setting this parameter to all
also hides services which are not enabled, setting it to none
shows all services.
dvb_servicetype
can be used to determine what kind of service is being broadcast. The possibilities are:
Radio: 0x02
SD TV: 0x01, 0x16, 0x17, 0x18, 0x80, 0x96, 0xa8, 0xd3
HD TV: 0x11, 0x19 - 0x1e, 0x91, 0xa0, 0xa4, 0xa6
UHDTV: 0x1f
Lists the text strings, options and defaults used when configuring the DVB capability within TVH (ie Configuration -> DVB Inputs -> Services).
Lists the text strings, options and defaults used when configuring the DVB capability within TVH (ie Configuration -> DVB Inputs -> Mux Schedulers).
List the entries as found under Configuration -> DVB Inputs -> Mux Schedulers. The standard parameters listed in Grid Parameters may be used.
Untested. Create a mux schedule, presumably from a structure similar to that from mpegts/mux_sched/grid.
Lists orbital positions and the satellites occupying them. The list is distributed with tvheadend; satellite reception is not necessary to use this API.
Lists the available frequency scan tables.
type
One of 'dvb-s', 'dvb-t', 'dvb-c', 'atsc-t', 'atsc-c', 'isdb-t'.
satpos
For dvb-s, the satellite position in degrees multiplied by 10 with East positive (so 28.2E is written as 282). The position must be accurate within +/- 0.2 degrees.
This function requires the dvb-scan files to be present on the server. They are installed by default (in /usr/share/tvheadend/data/) but are omitted if configure argument '--disable-dvbscan' is used. Distributions may also choose to package them separately.
ADMIN privilege is required for all of these functions except codec_profile/list.
Lists available codecs and their properties. This is a very verbose list.
Lists the text strings, options and defaults used when configuring codec profiles.
Add a new codec profile.
class
The name of the codec profile.
conf
A JSON object describing the codec profile.
Functions to query the Electronic Program(me) Guide.
Query the EPG and optionally apply filters.
lang
3-letter ISO639 language code. If not supplied, the language configured for the user is entered; otherwise the system default.
mode
If set to the string now
then only events currently playing are listed.
title
A (case-insensitive) string which must appear in the title to be listed.
fulltext
If set to 1 then the title
string must match exactly. Default is 0.
channel
The channel to show events from, specified either by channel name or uuid. Must be an exact match to the data from channel/list, otherwise all channels are returned.
channelTag
The (single) channel tag to show events from, specified either by name or uuid. Must be an exact match to the data from channeltag/list, otherwise all tags are returned.
durationMin
Shortest event to be listed (seconds).
durationMax
Longest event to be listed (seconds).
contentType
Integer representing the genre to be listed - see epg/content_type/list.
filter
A JSON object describing the filter(s) to be applied. See Grid Filters for the syntax. String filters can only be applied to the 'channelName', 'title', 'subtitle', 'summary', 'description' and 'extraText' fields.
sort
The key to be sorted by. Default is to sort by 'start'.
dir
If sort
is specified, setting 'dir' to 'desc' reverses the sort order
start
First record to be listed from the database, default is 0.
limit
Number of records to list. Default is 50 - use a very large number to get all.
new
If set to 1 then only events marked as 'new' will be included. Default is 0. The EPG source must identify 'new' events for this filter to work.
cat1, cat2, cat3
XMLTV provides more details of the event category than the OTA EPG, and these parameters can be used to filter by XMLTV category. See Channel-Category.
EPG sources differ in the information which they provide, and there are many more information items possible than are included in the example below. Any items which have no data available will be omitted.
If the event is scheduled to be recorded, these extra items will appear:
Other possible values for dvrState
are "recording", "completed", "completedError", "completedWarning" and "completedRerecord". The 'completed' values can only be present if the recording stopped before the scheduled stop time.
Lists alternative broadcasts of the same event.
eventId
Identifier of the event, eg taken from epg/events/grid.
lang
3-letter ISO639 language code. If not supplied, the language configured for the user is entered; otherwise the system default.
The function looks for broadcasts having the same eventId, rather than using event CRIDs. It does not work on UK DVB-T.
This function does not work on TVH versions older than 4.2.4-5 or 4.3-589.
Lists broadcasts related to the given event.
eventId
Identifier of the event, eg taken from epg/events/grid.
lang
3-letter ISO639 language code. If not supplied, the language configured for the user is entered; otherwise the system default.
The function looks for events having the same series link ID as the given event, ie part of the same series of broadcasts. It therefore relies on the EPG provider filling in these details.
Note that the series link ID is unique to an individual set of broadcasts; if the series is repeated on a different channel (or at a different time) the series link will be different.
This function does not work on TVH versions older than 4.2.4-5 or 4.3-589.
From version 4.3.1711, if the given event does not have a series link ID, events in the EPG having the same title are returned.
Lists details of specific event(s).
eventId
Identifier of the event, or a JSON array of event Ids.
The common parameters which apply to other 'load' functions do not work here.
A 'Brand' is a commonly-available show, eg "Simpsons". What constitutes a 'Brand' is up to the EPG provider.
This function was removed in version 4.3.1059.
Lists the Content Type IDs extracted from ETSI EN 300 468 together with their descriptions. The Content Type ID appears in the output of epg/events/grid as "Genre". IDs described as 'Reserved' or 'User Defined' in the specification are given the description of the previous ID instead.
full
If set to 0 (the default) only the broad categories defined by content_nibble_level_1
in the specification are listed. If set to 1 all categories are listed.
ADMIN privilege is required to use these functions.
Lists the descriptions, options, defaults and current settings for configuring the SAT>IP server capability - see Configuration -> General -> SAT>IP server.
Untested. Updates the server from an object in the format produced by satips/config/load.
node
The JSON structure containing the updates.
Functions to query and manipulate the list of parental rating labels ('G', 'M', 'PG', etc).
Lists the text strings, options and defaults used when configuring parental rating labels within TVH (ie Configuration -> Channel/EPG -> Rating Labels -> Add).
Creates a new parental rating label. Requires ADMIN privilege.
conf
A JSON object containing details of the new parental rating label.
Lists details of parental rating labels. For details of the parameters and selection criteria which can be applied, see Grid Parameters.
Lists the names and uuids of all known parental rating labels.
Notes:
Parental rating labels were added to Tvheadend in December 2023.
Processing of parental rating labels is disabled by default and can be enabled via Configuration -> Channel/EPG -> EPG Grabber.
Tvheadend will automatically create a placeholder record as new labels are encountered.
Parental rating label fields will not appear in other modules, (DVR, EPG) if the processing of parental rating labels is disabled.
These function provide direct access to the internal data structures of TVHeadend. Attempting to modify these internal structures may have unwanted effects including loss of data.
Information is held within TVHeadend in a key-value database. The key for each record is a random 128-bit value called a uuid. The value is a data structure which can be represented in JSON format. The record is called an idnode.
The content of each idnode depends on what it represents; this is indicated by the value of the class
parameter.
Although no special privilege is required to call these functions, access control is applied to the data items being referenced.
Read the value of one or more idnode records. One (and only one) of these parameters must be specified:
uuid
The uuid (or JSON-structured list of uuids) to read.
class
The class of records to read, ie one of the classes returned by classes.
If uuid
is given, the data to be returned may be qualified by setting one of these parameters to an integer greater than zero:
meta
Include meta-data (default values and descriptions of the data items).
grid
Return a brief summary of the records.
If class
is given, setting the parameter enum
to an integer value greater than zero returns only a set of key-value pairs.
In both cases the list
parameter can be used to select which items are to be output, based on the value of the 'id' field. Multiple entries can be selected, separated by commas, colons or semicolons. A '-' in front of an entry deselects that item (and implicitly selects all others).
Update an existing idnode.
node
The JSON object (or array of objects) containing the update.
Each update must contain the uuid
item. Other items supplied replace those in the idnode; they are not merged.
Fields within an idnode may be read-only; for this reason it may not be possible to take the data from idnode/load and use it as input to idnode/save (thanks to Poul Kalff for this information). To check the read-only status of a field, use idnode/class and check for a 'rdonly' flag.
Read information held in a tree structure (eg for tuner devices).
uuid
The uuid of the starting point in the tree structure, or the special value 'root'.
root
The uuid of the head of the tree structure. Required if uuid
= 'root'.
List information about a specified class; mostly metadata used to configure the TVHeadend UI.
name
The name of the class, ie one of the values returned by classes.
Delete one or more records.
uuid
The uuid (or a JSON-formatted list) of the record(s) to be deleted.
This section includes functions to manipulate recorder objects; timers, autorecs and recordings. Unless noted otherwise, RECORDER privilege is required for all these functions - the 'Basic' tick-box in the 'Video Recorder' drop-down on the Access Entry screen. Other tick-boxes will be needed for some functions.
Lists the text strings, options and defaults used when configuring the DVR capability within TVH (ie Configuration -> Recording). Requires either RECORDER or ADMIN privilege.
Lists the configuration sets available for the TVH server together with their options. Configurations are identified by their name
parameter; the default config has the name blank. Requires either RECORDER or ADMIN privilege.
Creates a new configuration set. Requires ADMIN privilege.
name
configuration name. Must be supplied and cannot be blank
conf
parameter set, passed as a JSON object
Lists the text strings, options and defaults used when editing an upcoming recording.
Lists all of the recordings that TVH knows about, ie it combines the output of grid_upcoming
, grid_finished
, grid_failed
and grid_removed
. Use the status
parameter to tell them apart.
See Grid Parameters for parameter details, and note the default is to return only the first 50 items.
Lists all of the currently-scheduled recordings. See Grid Parameters for parameter details, and note the default is to return only the first 50 items.
duplicates
Set to 0 to exclude duplicate timers. Default is 1.
The data is derived from the EPG when the timer was scheduled. From version 4.3.1013 the item "disp_extratext" is included to deal with the inconsistent use of "subtitle" and "summary" fields by broadcasters.
The values of start_real
and stop_real
take into account the recorder padding and warm-up time currently set.
The value of rating_label_uuid
points to a current parental rating label record.
Lists recordings which have completed and which are still in the TVH logs. See Grid Parameters for parameter details, and note the default is to return only the first 50 items.
The values of start_real
and stop_real
take into account the recorder padding and warm-up time currently set - not the values which were set when the recording was made. If this is a segmented recording (a programme split into two or more parts with for example a news bulletin in between) the value of stop_real
is the end time of the final segment, while stop
is the end time of he first segment.
Because legislation can change over time, the value of rating_label_uuid
is blank for finished DVR entries, the 'saved' tags should be used instead.
Lists failed recordings. See Grid Parameters for parameter details.
If you merge the 'failed' and 'completed' recordings into a single list, the only way to tell which list the entries originally came from is by using the status
field.
Lists removed recordings. See Grid Parameters for parameter details.
Under some circumstances an unsuccessful recording may appear here rather than under failed recordings. For example when EIT-based accurate recording is being used and the 'running' status is never received.
If TVH is configured to delete the log record when a recording is deleted this function will not return them.
Creates a new timer from a JSON object.
conf
The JSON object describing the timer. Items not specified are derived from the default profile of the user. An example of the minimum useful JSON is shown below.
The function returns the uuid of the created timer on success.
It is also possible using this function to add a file created elsewhere into the TVH database as a completed recording. Items needed in the JSON are:
It is important that the start and stop times are in the past, otherwise TVH will try to create a timer to record the event. (Thanks to "ullix tv" for this information.) Also note that the ability to add a pre-recorded file is unintended behaviour - see Caution.
Creates a new timer using details from the EPG. Input parameters are:
config_uuid
this is the uuid
parameter from the output of dvr/config/grid
event_id
this is the eventId
parameter for the event, taken from epg/events/grid
These functions provide the same capability as the Re-record button in Digital Video Recorder -> Finished Recordings. "Allow" sets the recording to be re-done, "deny" cancels a scheduled rerecording, "toggle" reverses the rerecord state.
uuid
the uuid
of the finished or failed recording, or a JSON object containing an array of uuids.
Gracefully stops a running recording.
uuid
The uuid
value from the timer's entry in dvr/entry/grid.
Deletes a timer or aborts a running recording.
uuid
The uuid
value from the timer's entry in dvr/entry/grid.
If the timer is running, the recording is kept on disk but classified as a 'failed' recording.
NOTE To delete a series use idnode/delete, passing parameter uuid
from the entry in dvr/timerec/grid. As with the UI, deleting a series deletes all pending timers for that series.
These three functions affect the "previously recorded" status of a timer. If set, either directly or via a call to the toggle function, the timer is marked as completed and the file flagged as deleted. If unset, a new timer is created.
These functions provide the same capability as the Previously Recorded button in Digital Video Recorder -> Upcoming/Current Recordings. It can be used to 'hide' re-runs to prevent them being re-recorded.
Removes a completed recording from storage.
uuid
The recording's uuid
value from dvr/entry/grid_finished.
Informs TVH that a recording has been relocated (by external means) within the filesystem. Requires ADMIN privilege.
src
The original full path to the file
dst
The new full path to the file
Move a finished recording entry to the "Finished Recordings" category, presumably from "Failed Recordings". The actual file is not moved.
uuid
The uuid
of the entry, or an array of entries passed as a JSON object.
Move a finished recording entry to the "Failed Recordings" category, presumably from "Finished Recordings". The actual file is not moved.
uuid
The uuid
of the entry, or an array of entries passed as a JSON object.
Lists the text strings, options and defaults used when creating or editing a series timer.
Lists autorecs (series timers). See Grid Parameters for parameter details.
Create a new series timer by specifying search parameters. To create a timer using CRIDs use dvr/autorec/create_by_series.
conf
A JSON object specifying the selection parameters for the timer.
config_uuid
The uuid
parameter from the output of dvr/config/grid. Parameter config_name
may be passed instead.
Creates a new series timer using CRIDs. Input parameters are:
config_uuid
The uuid
parameter from the output of dvr/config/grid
event_id
The eventId
parameter for one event in the series, taken from epg/events/grid
NOTE To delete a series use idnode/delete, passing parameter uuid
from the entry in dvr/autorec/grid. As with the UI, deleting a series deletes all pending timers for that series.
Lists the text strings, options and defaults used when creating or editing a time-based recording.
Lists time-based recordings. See Grid Parameters for parameter details.
Create a new time-based timer.
conf
A JSON object specifying the selection parameters for the timer.
A JSON object is returned containing the UUID of the timerec.
Produces a list of all known languages and their three-letter ISO639-3 codes. The list is hard-coded within the Tvheadend source.
Produces a similar list to language/list but also including the full RFC3066 locale reference for those locales which have been compiled into Tvheadend.
Produces a list in the same format as language/locale but containing only those locales which are supported by TVHeadend (ie have translations available).
API calls which end in /grid
, with the exception of epg/events/grid, have a common set of parameters:
start
First entry to include. Default is the first (0).
limit
Number of entries to include. Default is 50 - use a large number to get all.
filter
A JSON object describing the filter(s) to be applied. See Grid Filters below for syntax.
sort
Name of the field to sort the records by. A case-sensitive sort is used.
dir
if sort
is specified then dir=desc
produces a reverse sort.
A filter can be applied to the output using a JSON object. The syntax is:
The "comparison" field is only used with numeric data. A "gt" comparison actually matches on greater-or-equal, and "lt" on less-or-equal.
Boolean values must be specified as "0" or "1" (NOT "true" or "false"). A (case-insensitive) regular expression match is used for strings.
The "intsplit" field is used for integer variables which are used to store a quotient and remainder, and defines how the bits of the variable are allocated.
Multiple filters can be applied to a query ONLY if they refer to different fields, so for example it is not possible to query for EPG events having start times between two values.
API calls which end in /load
, with the exception of epg/events/load, have a common set of parameters:
meta
If > 0 an extra data structure is output, mostly related to the format of the GUI screen where the information is presented. Default is 0.
list
This parameter selects which items in the params array are to be output, based on the value of the 'id' field. Multiple entries can be selected, separated by commas, colons or semicolons. A '-' in front of an entry deselects that item (and implicitly selects all others).
List details of input devices. ADMIN privilege is required for these functions.
Lists the parameters, options and settings for input devices.
uuid
(Required). If set to 'root', the top-level details of the input device(s) are shown. If the uuid of a device (obtained from the top-level details) is submitted, full information is shown similar to Configuration -> DVB Inputs -> TV Adaptors.
root
Function obscure.
Triggers a discovery process for SAT>IP servers, as Configuration -> General -> SAT>IP Server -> Discover SAT>IP Servers in the GUI. This function is only available if SAT>IP client functionality has been compiled into TVHeadend.
Lists the available character sets.
Although no special privilege is needed to use these functions, access control is applied at the inode database level.
Returns a list of all data classes together with readable titles. Requires version 4.3-406 or later.
class
One of the class names returned by .
uuid
A single uuid or JSON array of uuids.
Returns data about the selected object(s). The information is the same as returned by the corresponding grid
function (where available) but without the selection and filtering options provided by that function.
node
A JSON object or array of objects.
Objects being imported must have a uuid and must already exist in the database.
Lists statistics of input sources and connections. ADMIN privilege is required for all these functions.
Lists currently-connected client devices.
Lists currently-active subscriptions.
Lists statistics of input devices.
For DVB-T and DVB-S tuners at least, the signal and SNR values are only non-zero while TVH is actively using the device. Some items may be missing if the device is idle.
The meaning of the statistics is below. Not all input sources provide all of the values.
For signal_scale and snr_scale, a value of 1 indicates that the corresponding signal or SNR reading is relative; 65535 = 100%. A value of 2 indicates the reading is absolute; 1000 = 1dB. A value of 0 indicates that the reading is not available or not valid.
The "pids" data is only present in TVH versions 4.3.1420 and later.
Resets the input counters to zero.
Disconnects one or more clients.
These examples (and any other use of the API which passes username and password in the URL) will only work if TVheadend is configured to use 'basic' or 'basic and digest' authentication.
Parameters passed to TVH using the GET method must be URI-encoded:
curl 'http://user:pass@localhost:9981/api/epg/events/grid?limit=999&channel=BBC%20ONE'
Alternatively use the POST Method:
curl --data 'limit=999&channel=BBC ONE' 'http://user:pass@localhost:9981/api/epg/events/grid'
To make the output more human-readable, pipe it through json_pp (included in the perl package on many distributions) or jq.
This simple example lists some details about upcoming timers, sorted in date order. To work through a PHP-enabled web server, the PHP.INI setting "allow_url_fopen" must be ON.
For an example of what can be done with the API in PHP see https://github.com/dave-p/TVHadmin.
It is a 'feature' of Javascript that a script can only access remote content from the same source (IP and port number) as the script was loaded from. Hence to call the TVHeadend API from Javascript, the script must be hosted on TVHeadend's built-in web server. To do this, place your script in /usr/share/tvheadend/src/webui/static
; it can then be accessed from URL http://user:pass@your.server:9981/static/
. Note that this is unintended behaviour and may change in the future.
This example carries out the same task as the PHP example above. Your browser will prompt for the TVHeadend user and password.
This example produces the same output as the previous ones.
ADMIN privilege is required for these functions.
Lists the details, descriptions, defaults and current values of the items in the GUI screen Configuration -> Debugging -> Configuration -> Settings. See for details of selection parameters.
Untested. Updates the server from an object in the format produced by .
node
The JSON object.
List the subsystems available for trace and debug operations.
Also see and .
id
- The internal enum for this subsystem. These values may change between systems depending upon the application version and the options used at compile-time but are otherwise constant.
subsystem
- The name of the subsystem. These values are to be used in the WebUI when enabling trace/debug operations.
description
- The locale-aware description of the subsystem.
trace
- True
if this subsystem is currently being traced.
debug
- True
if this subsystem is currently being debugged.
traceCount
- The number of subsystems with trace
currently set to true
.
debugCount
- The number of subsystems with debug
currently set to true
.
totalCount
- The total number of subsystems.
Note 1: Users may enter a special all
subsystem (not listed) instead of nominating each subsystem individually in the WebUI. This condition can be detected if traceCoount
and/or debugCount
is equal to totalCount
.
Note 2: As at April 2014, the id
field is informational only. It is provided to facilitate future API development.
ADMIN privilege is required to use all of these functions.
Lists the descriptions, options, current values and defaults of the GUI screen Configuration -> DVB Inputs -> Services. -> Map Services.
Further API functions for manipulating DVB services are in the section.
Untested. Set the Service Mapper options.
node
Unknown, possibly the value of class
.
Stops a running service mapper operation.
Provides the same output as Status -> Service Mapper in the TVH GUI.
Lists available services. "Available" services includes those which are disabled or encrypted.
enum
If set to 1 (as an integer without quotes) a short-form list is output containing each service's uuid and name. If set to 0 (the default) a verbose list is generated.
list
If enum
is not 1 this parameter selects which items in the params
array are to be output, based on the value of the 'id' field. Multiple ids can be selected, separated by commas, colons or semicolons. A '-' in front of an id deselects that item (and implicitly selects all others).
raw/export?class=service
provides a simpler version of the same information (but including the streams data), however the API call is about 50% slower.
Lists the streams comprising the service.
uuid
uuid of the service. This parameter is mandatory; it is not possible to list all services.
Remove services which have not been seen recently. This call carries out the same action as Configuration -> DVB Inputs -> Services -> Maintenance in the TVH GUI.
days
The number of unseen days before deletion. The default is 7 days, the minimum is 5 days.
type
If set to pat
the action is the same as "Remove unseen services (PAT/SDT)" in the GUI. Otherwise the action is the same as "Remove all unseen services".
An empty JSON object is always returned.
uuid
The uuid of the input device from . More than one uuid can be specified - syntax?
id
ids of the connections, obtained from . If set to 'all' then all connections are cancelled (new in 4.3.1680).
ber | Bit Error Rate |
bps | Bandwidth (bits/second) |
cc | Continuity Errors |
ec_bit | Bit Error Count |
ec_block | Block Error Count |
pids | List of pids present in the stream |
signal | Signal Strength (see below) |
signal_scale | See below |
snr | Signal/Noise Ratio (see below) |
snr_scale | See below |
stream | Stream (multiplex) name |
subs | Subscribers |
tc_bit | Total Bit Error Count |
tc_block | Total Block Error Count |
te | Transport Errors |
unc | Uncorrected Blocks |
weight | Weight |
Tvheadend has a WebSocket interface on port 9981. It is used by the UI to provide 'live' actions and updates, avoiding the need to refresh the screen.
The example below creates a WebSocket connection to the Tvheadend server and listens for updates.
Tvheadend transmits messages on the Websocket interface asynchronously, when either an event occurs or in some cases at scheduled intervals. The output format is JSON.
Each message contains a key "messages" whose value is an array of message objects. Each message object contains a key "notificationClass" which specifies the source of the message, and a series of message-specific key-value pairs.
This section describes other functions which can be accessed via HTTP. They are not part of the HTTP API and so are not preceded by 'api'.
Unless otherwise stated no special privilege is needed to use these functions.
Returns a JSON object containing data used by the Tvheadend UI, including the disk space utilisation.
The "freediskspace" and "totaldiskspace" figures relate to the disk partition holding the recorder Storage Path, "useddiskspace" is the total size of all files stored below that point. These figures may not give the actual storage situation if there are multiple storage devices and mount points.
See WebSocket for a WebSocket interface to this function.
Downloads a previously-recorded file. Called with the UUID of the recording. Requires appropriate privilege (DVR or streaming).
Flushes the contents of the EPG to disk.
Used by simple.html.
Downloads an icon file. The filename is hard-coded in the source; on installation it is usually placed at /usr/share/tvheadend/src/webui/static/img/logo.png
.
Outputs an image from the image cache. Requires streaming, recording or web interface privilege.
Used to download help files.
Available on version 4.3-2124 and later. Provides a simple way to check that the server is alive. No authentication is needed to use this function.
This function acts as a front-end to the dvrfile
and stream
functions. It is invoked using the following forms:
The function examines the 'User-Agent' string sent by the client. If the user-agent is on a preset list (or is not present), data transfer starts immediately; if not then a playlist is returned to the client.
The User-Agent list is "MPlayer", "curl/", "wget/", "TVHeadend", "Lavf" and any string containing "shoutcastsource".
If ticket
is added to the URL, for example:
the url in the returned playlist will contain an authentication ticket, removing any need to enter credentials in order to access the data. However the ticket is only valid for five minutes so the playlist cannot be re-used after that time.
When playing streams, the parameters for the underlying stream function can also be used.
This is a complex function which outputs lists of content available from the server, in various formats and filtered in several ways. The syntax for invoking the function depends on the required output and not all combinations of inputs are valid.
Note: The hostname portion of the URLs returned within the resulting playlist, for example m3u, will be the same as the hostname supplied with the http request.
See below for sample output.
The value of <x> in the URL specifies the format of the output. The options are e2
, m3u
or satip
, with m3u
the default if the item is omitted. For recordings only m3u
is available.
For channels, a parameter sort
can be added. This can take the value 'name' or 'numname', to sort the output by channel name or channel number respectively.
See below for notes including the values of <y> in the URL, and sample outputs.
The value of <x> in the URL specifies the format of the output. The options are e2
, m3u
or satip
, with m3u
the default if the item is omitted. For recordings only m3u
is available.
See below for notes including the values of <y> in the URL, and sample outputs.
The list of recordings includes all entries in the DVR logs, including failed and missed recordings and recordings to be made in the future (ie timers). Unplayable recordings have 'bandwidth=0' in the output.
The value of <y> in the URLs, if supplied, specifies whether the channel list or playlist should include authentication in the URL. If <y> is ticket
, each entry includes an access-control 'ticket' - these tickets are only valid for five minutes, they are different for each channel/recording listed, and calling the playlist again will output a different set of tickets.
Alternatively, if Persistent Authentication is in use (TVHeadend versions > 4.3.1485), the value of <y> may be set to auth
. The auth code must be appended to the URL as a parameter, eg.
$ curl http://192.168.0.1:9981/playlist/auth/tags?auth=8ef7aa08e516060ca4330730c60e00d5b5174920
Used by simple.html.
Used internally for theme selection?
Outputs one of two files describing the SAT>IP server and the services available from it.
A rudimentary user interface to TVHeadend. It shows the contents of the recorder log (both completed and future recordings) and allows entries to be cancelled or deleted. A search box allows the EPG to be scanned for matching entries; clicking on an entry opens an information page which contains a button allowing the event to be recorded. Requires RECORDER privilege.
Outputs details of encrypted services. Each item contains:
Service ID
CA ID
CA provider ID
Service name
Service type
Service provider name
Outputs the TVHeadend version number and a (text) list of channels. This function requires Admin privilege.
The binary hash is only filled-in if the server runs on an x86 processor.
Outputs the current status of the server, including CPU load average, recordings in progress (or minutes to the next recording) and the number of active subscriptions. Needs 'Web interface' or 'Recorder' privilege.
Starts the streaming of live data from a channel, service or mux. The parameters which can be applied depend on the source:
profile
. The streaming profile to use. If the specified profile does not exist or can not be used the 'htsp' profile is used if available.
qsize
. Streaming buffer size. Default is 1500000 bytes.
User-Agent
. Use unknown.
profile
. The streaming profile to use. If the specified profile does not exist or can not be used the 'htsp' profile is used if available.
qsize
. Streaming buffer size. Default is 1500000 bytes.
descramble
. If set to 0 Tvheadend does not descramble the service.
emm
. Unknown. Default is 0, set to 1 to activate.
User-Agent
. Use unknown.
qsize
. Streaming buffer size. Default is 10000000 bytes.
pids
. A comma-separated list of pids to stream, or the word 'all' to stream the raw mux. The default is to stream all.
Controls the streaming of live data from a channel or service to a UDP address and port. This function requires Tvheadend version 4.3.2038 or later.
The following parameters are mandatory:
address
. The IP address of the device to receive the UDP stream.
port
. The destination port address.
The remaining parameters for the start
function depend on the source:
profile
. The streaming profile to use. If the specified profile does not exist or can not be used a 'Not Allowed' error is output.
qsize
. Streaming buffer size. Default is 1500000 bytes.
User-Agent
. Use unknown.
profile
. The streaming profile to use. If the specified profile does not exist or can not be used a 'Not Allowed' error is output.
qsize
. Streaming buffer size. Default is 1500000 bytes.
descramble
. If set to 0 Tvheadend does not descramble the service.
emm
. Default is 0, set to 1 to activate.
User-Agent
. Use unknown.
Outputs the EPG in XML format, filtered in various ways.
The final variation lists the complete EPG together with a channel list. Example:
If Persistent Authentication is in use (TVHeadend versions > 4.3.1485), the auth code must be appended to the URL as a parameter.