3.3 API format ........................................................................................................................................... 11
3.4 Server responses.................................................................................................................................. 12
4 General APIs ...................................................................................................................................................... 14
4.1 APIs of RTSP ........................................................................................................................................ 14
4.1.1 Get real-time stream ................................................................................................................................ 14
4.1.2 Get playback stream ................................................................................................................................ 15
4.1.3 Get file stream ......................................................................................................................................... 16
4.2.1 Get mjpg stream ...................................................................................................................................... 16
4.2.2 Get real-time stream ................................................................................................................................ 17
4.2.3 Get playback stream ................................................................................................................................ 18
4.2.4 Control the playback stream .................................................................................................................... 19
p ......................................................................................................................................................... 24
Page 4
4.4.2 Get a snapshot ......................................................................................................................................... 26
Amcrest Technologies LLC | www.amcrest.com
2
4.4.3 Subscribe to snapshot .............................................................................................................................. 26
4.5.1 Get max extra stream numbers ............................................................................................................... 28
4.5.2 Video color config .................................................................................................................................... 28
4.5.3 Get encode capability .............................................................................................................................. 30
4.5.4 Get encode config capability ................................................................................................................... 31
4.5.5 Encode of media ...................................................................................................................................... 35
4.5.6 Encode of region interested ..................................................................................................................... 41
4.5.8 Get video input channels device supported ............................................................................................ 43
4.5.9 Get video output channels device supported .......................................................................................... 43
4.5.10 Get max remote input channels .............................................................................................................. 44
4.5.11 Video standard ........................................................................................................................................ 44
4.5.12 Video widget ............................................................................................................................................ 45
4.5.13 Get video input capability ........................................................................................................................ 48
4.5.16 Auto focus ................................................................................................................................................ 55
4.5.17 Get focus status ....................................................................................................................................... 55
4.5.18 Get coordinates of current window ......................................................................................................... 55
4.5.19 Set coordinates of current window ......................................................................................................... 56
4.5.20 Video in options....................................................................................................................................... 56
4.5.21 Video out ................................................................................................................................................. 69
4.6.1 General .................................................................................................................................................... 71
4.6.2 Get current time ...................................................................................................................................... 72
.6.3 Set current time ....................................................................................................................................... 73
4.6.5 Get language capability ........................................................................................................................... 76
Amcrest Technologies LLC | www.amcrest.com
3
4.6.6 Language .................................................................................................................................................. 76
4.6.8 Auto maintain .......................................................................................................................................... 78
4.6.10 Get device type ........................................................................................................................................ 81
4.6.11 Get hardware version .............................................................................................................................. 82
4.6.12 Get serial number of device..................................................................................................................... 82
4.6.13 Get machine name .................................................................................................................................. 82
4.6.14 Get system information ........................................................................................................................... 82
4.6.15 Get vendor information ........................................................................................................................... 83
4.6.16 Get software information ........................................................................................................................ 83
4.6.17 Get version of Onvif ................................................................................................................................. 83
4.6.18 Get version of HTTP API ........................................................................................................................... 84
4.6.19 Get device class ....................................................................................................................................... 84
4.6.20 Onvif service authorization ...................................................................................................................... 84
4.6.21 Backup of config ...................................................................................................................................... 85
4.6.22 Restore the config .................................................................................................................................... 86
4.6.23 Restore except the config ........................................................................................................................ 86
4.7.9 Get UPnP status ..................................................................................................................................... 100
4.7.13 Alarm server .......................................................................................................................................... 103
4.9.3 Alarm out ............................................................................................................................................... 117
4.9.4 Get alarm input channels ...................................................................................................................... 118
4.9.5 Get alarm output channels .................................................................................................................... 118
4.9.6 Get states of alarm input channels ........................................................................................................ 118
4.9.7 Get states of alarm input channels ........................................................................................................ 119
4.9.8 Video blind event................................................................................................................................... 119
4.9.9 Video loss event .................................................................................................................................... 120
4.9.13 Storage low space event ........................................................................................................................ 124
4.9.14 Net abort event...................................................................................................................................... 125
4.9.15 IP conflict event ..................................................................................................................................... 126
4.9.16 Get channels event happened ............................................................................................................... 127
4.9.17 Subscribe to event message .................................................................................................................. 128
18 Get capability of event management .................................................................................................... 130
4.10.2 PTZ auto movement............................................................................................................................... 133
Amcrest Technologies LLC | www.amcrest.com
5
4.10.3 Get PTZ protocol list............................................................................................................................... 135
4.10.4 Get PTZ capability of current protocol ................................................................................................... 135
4.10.5 Get PTZ presets list ................................................................................................................................ 137
4.10.6 Get PTZ tour routines list ....................................................................................................................... 138
4.10.7 PTZ control command ............................................................................................................................ 138
4.10.8 Get PTZ status ........................................................................................................................................ 142
4.11.1 Get capability of recording .................................................................................................................... 143
4.11.2 Record config ......................................................................................................................................... 144
4.11.3 Record mode .......................................................................................................................................... 146
4.11.4 Media global .......................................................................................................................................... 147
4.11.5 Find media files ...................................................................................................................................... 147
4.11.6 Download media file with the file name ............................................................................................... 150
4.11.7 Download media file between times ..................................................................................................... 151
4.12.1 Get information of a particular user ...................................................................................................... 152
4.12.2 Get information of all users ................................................................................................................... 152
4.12.3 Get information of all active users ......................................................................................................... 153
4.12.4 Get information of a particular group ................................................................................................... 153
4.12.5 Get information of all groups ................................................................................................................. 154
4.12.6 Add a new user ...................................................................................................................................... 154
4.12.7 Delete a user .......................................................................................................................................... 155
4.12.8 Modify user information ........................................................................................................................ 155
ind logs ................................................................................................................................................. 156
4.13.2 Clear all the logs..................................................................................................................................... 158
5 SD camera APIs ................................................................................................................................................ 159
5.1 Video attributes ................................................................................................................................ 159
5.1.1 Video in focus ........................................................................................................................................ 159
5.1.2 Video in zoom ........................................................................................................................................ 161
5.1.3 Video in sharpness................................................................................................................................. 163
5.1.4 Video in mode ....................................................................................................................................... 164
5.2.3 Move once ............................................................................................................................................. 168
6.1.1 Get hard disk information ...................................................................................................................... 168
6.1.2 Get all the storage devices’ names ........................................................................................................ 169
6.1.3 Get storage device information ............................................................................................................. 169
6.1.4 Get storage capability ............................................................................................................................ 170
6.2.1 NAS information .................................................................................................................................... 170
6.3Storage point ..................................................................................................................................... 172
6.3.1 Record storage point .............................................................................................................................. 172
6.3.2 Storage group ........................................................................................................................................ 173
7.3.1 Moniter tour .......................................................................................................................................... 178
Page 9
7.3.2 Enable tour ............................................................................................................................................ 180
8 Video analyse APIs ........................................................................................................................................... 182
8.1 Video analyse .................................................................................................................................... 182
8.1.1 Get video analyse capability .................................................................................................................. 182
8.1.2 Video analyse global .............................................................................................................................. 183
8.1.3 Video analyse rule ................................................................................................................................. 184
8.2Number of people .............................................................................................................................. 187
8.2.1 Video widget number status ................................................................................................................. 187
8.2.2 Get heat map information ..................................................................................................................... 188
8.3Video status ...................................................................................................................................... 189
8.3.1 Get summary of video status ................................................................................................................. 189
8.3.2 Query video status ................................................................................................................................. 190
9.2.1 Get all parking spaces’ status ................................................................................................................. 192
10 Thermography and radiometry APIs ........................................................................................................... 193
10.1.1 Get capability of thermography ............................................................................................................. 193
10.1.3 Get extern system information .............................................................................................................. 197
10.1.4 Get information of preset mode ............................................................................................................ 197
10.1.5 Get optimized region information ......................................................................................................... 198
10.1.8 Do flat field correction ........................................................................................................................... 199
10.2.1 Get capability of radiometry .................................................................................................................. 200
10.2.5 Get temperature of particular point ...................................................................................................... 207
10.2.6 Get temperature of particular condition ............................................................................................... 207
10.2.7 Query temperature information ............................................................................................................ 208
10.2.8 Subscribe to temperature information .................................................................................................. 210
10.2.9 Subscribe to radiometry data ................................................................................................................ 211
10.2.10 To fetch radiometry data ....................................................................................................................... 212
11 Access control APIs ................................................................................................................................... 212
11.1 Door .................................................................................................................................................. 212
11.1.1 Open door .............................................................................................................................................. 212
11.1.2 Get door status ...................................................................................................................................... 213
12 Intelligent building APIs............................................................................................................................. 214
12.1 Video talk .......................................................................................................................................... 214
12.1.1 Subscribe video talk status .................................................................................................................... 214
12.1.2 Unsubscribe video talk status ................................................................................................................ 215
12.1.3 Invite server on video talk ..................................................................................................................... 215
12.1.4 Cancel the video talk ............................................................................................................................. 215
12.1.5 Answer the invitation............................................................................................................................. 216
12.1.6 Refuse to answer the video talk invitation ............................................................................................ 216
12.1.7 Hang up .................................................................................................................................................. 216
12.2.1 Query video talk log ............................................................................................................................... 217
12.3Access control card record .................................................................................................................. 218
12.3.1 Query record .......................................................................................................................................... 218
2 Update record ........................................................................................................................................ 219
12.3.
12.3.3 Insert record .......................................................................................................................................... 220
Page 11
12.3.4 Remove record ....................................................................................................................................... 220
Amcrest Technologies LLC | www.amcrest.com
9
12.3.5 Get the total number of records ............................................................................................................ 221
12.4Swiping Access control card record ..................................................................................................... 221
12.4.1 Query swiping card records ................................................................................................................... 221
12.5Announcement record ....................................................................................................................... 223
12.5.1 Insert record .......................................................................................................................................... 223
12.6Alarm record ..................................................................................................................................... 223
12.6.1 Query alarm record ................................................................................................................................ 223
13.1.1 Create a file finder ................................................................................................................................. 225
13.1.2 Get the file information found by the finder ......................................................................................... 228
13.1.3 Stop the finder ....................................................................................................................................... 229
13.1.4 Get bound files ...................................................................................................................................... 229
14 Other APIs ................................................................................................................................................ 233
14.1.1 Discover devices on internet ................................................................................................................. 233
15.1 Stream head ...................................................................................................................................... 236
15.2.2 Video extend header ............................................................................................................................. 238
15.2.3 Channel title extend header .................................................................................................................. 239
15.2.4 Time zone extend header ...................................................................................................................... 239
5 Event flag extend header ....................................................................................................................... 240
15.2.
Page 12
1 Overview
Amcrest Technologies LLC | www.amcrest.com
10
This document specifies the HTTP based application programming interface of video products.
The HTT
functions (PTZ, Focus etc.) and for getting and setting internal parameter values.
The video products serve as a server. The client sends requests to server, and then server handles requests and returns
resources accordingly.
P-based interface provides the functionality for requesting snapshot and media stream, for controlling camera
The following abbreviations are used throughout this document
API Applica
video products.
tion programming interface – in the document, it especially presents application programming interface of
3.2 Syntax convention
In URL syntax and in descriptions of API parameters, text in italic within angle brackets denotes content that should be
replaced with either a value or a string. When replacing the text string, the angle brackets must also be replaced.
For example, <ser
String sh
Name-value p
own in bold face denotes a brief explanatory note of the string close to it.
ver> in the URL syntax is replaced with the string “192.168.1.108”.
air in square brackets denotes content that is optional. For example,
Page 13
“http ://<server>/cgi-bin/snapshot.cgi[?channel=<ChannelNo>]” can be like this
Amcrest Technologies LLC | www.amcrest.com
11
“http ://<server>/cgi-bin/snapshot.cgi”.
The API sy
spaces and other reserved characters (“;”, “/”, “?”, “:”, “@”, “=“, “+”, “,” and “$”) within a name-value pair should be
replaced with %< ASCII hex>. For example, the blank should be replaced with %20.
To descr
integer not less than 0 and not larger than 100. “{0, 1, 2, 3}” denotes the valid value of an integer among 0, 1, 2 and 3.
“[]” following a string denotes an ar ray. The index is usually an integer and starts from 0. For example,
“Snap[channel]” may be “Snap[0]” or “Snap[1]”.
The variabl
“false”.
ntax must follow the standard of URI. (RFC 3986: Uniform Resource Identifiers (URI) Generic Syntax); that is,
ibe the range of a variable, we use some symbols such as “[]” and “{}”. For example:” [0-100]” denotes an
e may be different types: string, integer, bool or float. Integer is 32 bits. The range of bool is “true” and
3.3 API format
This section defines the syntax and semantics for APIs.
<protocol> ://<server><abs_path> [?query]
protocol: URL scheme for the particular request. The http and https protocols are both supported in this specification. So
“http”, as most of the APIs’ default protocol except several RTSP APIs, can be replaced by “https”.
server:
device. The port is the port number of server listening for TCP connections. If the port is not given, the default port is
assumed. For H T TP, the default port is 80. For HTTPS, the default port is 443.
abs_p
“/cgi-bin/*.cgi”.
query: The query field is a string of information to be interpreted by the resource. It consists of resource-related
parameters. And it must be listed in name-value pair syntax (p1=v1&p2=v2&…&pn=vn).
For exam
Server could be “hostname[: port]”. The hostname can be IP address or the fully qualified domain name of an IP
ath: The Request-URI for the resources is abs_path. The abs_path in this specification is most often of the form
If the request fits with syntax but an error occurs while the server handles it, the response would like this:
The request has succeeded. The requested resource will be returned in
the HTTP text.
The request had bad syntax or was inherently impossible to be satisfied.
The request requires user authentication or the authorization has been
refused.
The server has not found anything matching the request.
The server encountered an unexpected condition that prevented it from
fulfilling the request.
HTTP/1.1 200 OK
…
Error
ErrorID=<Error Code>, Detail=<Error Description>
Page 15
Example: Request spells wrong.
Amcrest Technologies LLC | www.amcrest.com
13
HTTP/1.1 200 OK
Error
ErrorID=2, Detail= Invalid Request!
All error codes are defined as below.
Tabl e 3-2
Error Code Detail Description
0 Invalid Authority! The user fails in authentication or doesn’t include the right
accessing the resource.
1 Request parses error! Request is incomplete.
2 Invalid Request! Request spells error.
3 Method not found! the resource not supported
4 Request invalid param! Parameters of request are invalid.
5 Server internal error! An error occurs when server handles the request.
6 Request Timeout! Timeout when server handles request.
7 Client keepalive failed! The client fails to keep alive.
3.5 Authentication
Video products support either basic authentication or digest authentication. If the http request does not provide valid
“Authorization” information, video products would return HTTP status code 401 and information for authentication. Video
products return the required resource only if authorization correct.
For example:
1. When basic authentication fails, response is:
Page 16
Amcrest Technologies LLC | www.amcrest.com
14
HT T P/1 . 1 401 Unauthorized
WWW-Authenticate: Basic realm=”XXXXXX”
The client encodes the username and password with base64, and then sends it to s e rv e r. A valid Authorization like this:
The client calculates the digest authorization using information like username, password, nonce, HTTP method and URI
with MD5, and then sends it to s e r v e r.
For example:
<port >: the default port is 554. It can be omitted.
<ChannelNo>: integer, the video channel index which starts from 1.
<typeNo>: the stream type. The <typeNo> of main stream is 0, extra stream 1 is 1, extra stream 2 is 2.
The extra stream counts can be obtained in GetMaxExtraStreamCounts. If the stream does not exist or
not enabled, response will be error.
The IP Camera supports both TCP and UDP transmission forms.
It also supplies basic authentication and digest authentication ways. The authentication process is
similar with Authentication.
Example http://192.168.1.108/cgi-bin/playBack.cgi?action=getStream&channel=1&subtype=0&startTime=2012-
Success Return
Playback stream using http protocol
10-8%2013:00:01&endTime=2012-10-8%2014:00:01
HTTP Code: 200 OK
Content-Type: Application/octet-stream
Comment
Body:
streamId=<streamId>\r\n
<data>
<data>
ChannelNo: integer, the video channel index which starts from 1, default 1 if not specified.
typeNo: the stream type, default 0 if not specified.
0-Main Stream
1-Extra Stream 1
2-Extra Stream 2
starttime & endtime: video start time and end time. Time format: yyyy-mm-dd hh:mm:ss
Compared to Playback using R T SP, it is another way of get playback stream. This is a way to use http
protocol to get playback stream. The data format is shown in appendix.
Control the playback stream, used to control the stream which built by “action=getStream”.
Example http://192.168.1.108/cgi-bin/playBack.cgi?action=control&streamId=0&cmd=play&speed=1&iframe=0
Success Return
Pause/Cancel:
OK
Play:
OK
operateId=1
Comment
cmd=play
If cmd is play, there are three optional parameters:
speed=<speed>: optional, default speed=1, if speed > 0, play back forward, else if speed < 0, playback
backward(param iframe is ignored, only support iframe playback backward);
iframe=<iframe>: optional, default iframe=0, if iframe=1, playback I frame only;
seekTime=<seekTime>: seek time, optional, default playback from the stream current point;
cmd=pause
pause the playback stream;
cmd=cancel
cancel the playback stream, and destroy the streamed;
operateId: represent current control operation, after control playback, the video extend header will
has same operateid as this value.
Page 22
4.3 Audio
server
server
Amcrest Technologies LLC | www.amcrest.com
20
4.3.1 Get audio input channel numbers
Tabl e 4-8
Syntax http://<
Method GET
Description Get Audio input channel number.
Example http://192.168.1.108/cgi-bin/devAudioInput.cgi?action=getCollect
Success Return
Comment Above response means there are 2 audio input channels.
If the request was successful, the server returns a continuous flow of audio packets. The content type is
“multipart/x-mixed-replace” and each audio packet ends with a boundary string.
Return:
HTTP Code: 200 OK
Content-Type: multipart/x-mixed-replace; boundary=<boundary>
--<boundary>
Content-Type: Audio/G.711A
Content-Length: 800
<Audio data>
--<boundary>
Success Return OK
Comment
Params in URL:
The paramName and paramValue are in the below table.
Appendix:
Page 26
ParamName ParamValue type Description
Method
GET
Amcrest Technologies LLC | www.amcrest.com
24
httptype string singlepart: HTTP content is a continuous flow
of audio packets
multipart: HTTP content type is
multipart/x-mixed-replace, and each audio
packet ends with a boundary string
channel is video channel number, weekday range is [0-6] (Sunday - Saturday). configNo is the index of
time section config. There are many time sections each day.
The value means the moving speed of motor lens, positive value means move forwards, negative value
means move backwards.
This command is used to drive the lens move continuously, until it reaches end.
When the motor is moving, you can send this command again with “focus” or “zoom” parameter as 0
Page 57
to stop it immediately.
server
ChannelNo
GET
server
ChannelNo
Amcrest Technologies LLC | www.amcrest.com
55
In this command, when you adjust the focus parameter, the zoom parameter should be -1, and the
focus parameter should be -1 when adjust the zoom parameter.
4.5.16 Auto focus
Tabl e 4-37
Syntax http://<
Method
Description Auto focus.
Example http://192.168.1.108/cgi-bin/devVideoInput.cgi?action=autoFocus
Set Video Rotate:
Filp:
http://192.168.1.108/cgi-bin/configManager.cgi?action=setConfig&V ideoInOptions[0].Flip=true
Mirror:
http://192.168.1.108/cgi-bin/configManager.cgi?action=setConfig&V ideoInOptions[0].Mirror=true
Or turn 90°:
http://192.168.1.108/cgi-bin/configManager.cgi?action=setConfig&VideoInOptions[0].Rotate90=1
Set White Balance:
http://192.168.1.108/cgi-bin/configManager.cgi?action=setConfig&VideoInOptions[0].WhiteBalance=Ni
ght
Or
http://192.168.1.108/cgi-bin/configManager.cgi?action=setConfig&VideoInOptions[0].WhiteBalance=
Custom&VideoInOptions[0].GainRed=50&VideoInOptions[0].GainBlue=50&VideoInOptions[0].GainGre
en=50
(Sometimes you should set mode first before set GainRed or GainBlue:
http: / /192.168.1.108/cgi-bin/configManager.cgi?action=setConfig&VideoInOptions[0].WhiteBalance=C
ustom )
Success Return OK
Comment
Params in URL:
In below table, head =VideoInOptions[ChannelNo]
ChannelNo = video channel index.
Appendix:
Page 64
ParamName ParamValue
Amcrest Technologies LLC | www.amcrest.com
62
Description
type
head. Backlight integer Range is [0-n]
n depends on capability in GetVideoInputCaps
0 – backlight closed.
1 – backlight grade 1
…
n – backlight grade n
head. DayNightColor integer Range is {0,1,2}
0: always multicolor
1: autoswitch along with brightness,
2: always monochrome
head. ExposureMode integer Range is {0,1,2, 4}
0: AutoExposure
1: Gain first
2: Exposure first
4: Manual.
head. ExposureSpeed integer Range is [0 - n+1]
n depends on capability in GetVideoInputCaps
0: AutoExposure
1-n-1: manual Exposure grade
n: AutoExposure with time limit.
n+1: manualExposure with user-defined time
(n is supported maximum exposure grade )
head. ExposureValue1 float Range is [0.1-80], unit is millisecond
If ExposureSpeed is 0(AutoExposure enable), it’s lower limit of
AutoExposure time, otherwise it’s time of manualExposure
Page 65
head. ExposureValue2 float Range is [0.1-80], unit is millisecond
Amcrest Technologies LLC | www.amcrest.com
63
Upper limit of AutoExposure time, should be bigger than
ExposureValue1
head. ExternalSync integer Range is {0,1}
External Synchronous
0: Internal Synchronization
1: External Synchronous
head. ExternalSyncPhase integer Range is [0°-360°]
Example http://192.168.1.108/cgi-bin/configManager.cgi?action=setConfig&Holiday.MonthMask[0]=3
Success Return OK
Comment
Params in URL:
In below table,
monthIndex presents the index of a month. 0 presents January, 1 presents February, 11 presents
December.
Appendix:
ParamName ParamValue type Description
Holiday.MonthMask[monthIndex] integer It is the mask of a month.Every bit present a day. For
example, 0x0001 presents the first day of a month is holiday.
0x0002 presents the second day of a month is holiday,
0x0003 presents the first day and second day of a month is
holiday.