0% found this document useful (0 votes)
18 views130 pages

HATC Open API Developer Manual-V1.2.3

The HAT Cloud Open API Developer Guide provides comprehensive instructions for developers to use the API for managing devices, device data, audio and video functionalities, and message subscriptions. It includes details on request signature generation, API service endpoints, and various device management operations such as adding, editing, and querying devices. The document also contains a glossary of terms and examples of request and response formats.

Uploaded by

marcossvjrcom
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
18 views130 pages

HATC Open API Developer Manual-V1.2.3

The HAT Cloud Open API Developer Guide provides comprehensive instructions for developers to use the API for managing devices, device data, audio and video functionalities, and message subscriptions. It includes details on request signature generation, API service endpoints, and various device management operations such as adding, editing, and querying devices. The document also contains a glossary of terms and examples of request and response formats.

Uploaded by

marcossvjrcom
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

HAT Cloud Open API

Developer Guide
HAT Cloud Open API Developer Guide

Contents
Chapter 1 Introduction........................................................................................................ 1
1.1 Glossary ................................................................................................................. 1
Chapter 2 Basic Explanation................................................................................................ 2
2.1 Description of HTTPS interface request signature generation method ............... 2
2.2 API service endpoint ............................................................................................. 6
2.3 Basic process ......................................................................................................... 6
Chapter 3 Manage Devices ................................................................................................. 8
3.1 List device protocols and product key .................................................................. 8
3.2 Add devices ........................................................................................................... 9
3.3 Edit devices ......................................................................................................... 11
3.4 Delete devices ..................................................................................................... 12
3.5 List devices .......................................................................................................... 13
3.6 Query the online status of devices ..................................................................... 16
3.7 Convert device serial number ............................................................................. 17
3.8 Disable devices .................................................................................................... 18
3.9 Enable devices ..................................................................................................... 19
Chapter 4 Device Data ...................................................................................................... 21
4.1 Query GPS List ..................................................................................................... 21
4.2 Query the latest GPS information ....................................................................... 24
4.3 List alarm ............................................................................................................. 25
4.4 Query device alarm attachments........................................................................ 31
4.5 Get file download link ......................................................................................... 32
4.6 Synchronize facial information ........................................................................... 33
4.7 Distribute facial change information .................................................................. 36
4.8 Confirm emergency alarm .................................................................................. 37
4.9 Set speed threshold ............................................................................................ 38
4.10 Query the daily flow of the device .................................................................... 39

i
HAT Cloud Open API Developer Guide

4.11 Query the monthly flow of the device .............................................................. 40


4.12 Get device channel screenshot ......................................................................... 41
Chapter 5 Audio and Video ............................................................................................... 44
5.1 Live view .............................................................................................................. 44
5.2 Live view (batch channel).................................................................................... 45
5.3 List video recording ............................................................................................. 46
5.4 Playback .............................................................................................................. 49
5.5 Playback (batch channel) .................................................................................... 50
5.6 Real time intercom/monitoring .......................................................................... 51
5.7 Text message distribution ................................................................................... 53
5.8 Create video download task ............................................................................... 54
5.9 Create video download task (batch channel) ..................................................... 56
5.10 Delete video download task ............................................................................. 57
5.11 Delete video download task (batch) ................................................................. 58
5.12 Query video download task .............................................................................. 59
5.13 Query video download task (batch) .................................................................. 61
Chapter 6 Message Subscription (webhook) .................................................................... 63
6.1 Webhook callback ............................................................................................... 63
6.2 Register subscription........................................................................................... 65
6.3 Cancel subscription ............................................................................................. 68
6.4 Query subscribed message types ....................................................................... 69
Chapter 7 Device Maintenance (in planning) ................................................................... 71
7.1 Query peripheral type ......................................................................................... 71
7.2 Add upgarde file .................................................................................................. 72
7.3 Delete upgrade file.............................................................................................. 72
7.4 Query upgrade file .............................................................................................. 73
7.5 Create upgrade tasks .......................................................................................... 75
7.6 Query upgrade tasks ........................................................................................... 75
7.7 Terminate upgrade tasks .................................................................................... 77
7.8 Terminate upgrade tasks (specify device) .......................................................... 78

ii
HAT Cloud Open API Developer Guide

7.9 Retry upgrade tasks (all failed devices) .............................................................. 78


7.10 Retry upgrade tasks (specify failed devices) ..................................................... 79
7.11 Query device parameters.................................................................................. 80
7.12 Create cofiguration tasks .................................................................................. 81
7.13 Query configuration tasks ................................................................................. 82
7.14 Terminate configuration tasks .......................................................................... 83
7.15 Terminate configuration tasks (specify device) ................................................ 84
7.16 Retry configuration tasks (all failed devices) .................................................... 84
7.17 Retry configuration tasks (specify failed devices)............................................. 85
Appendix ........................................................................................................................... 87
Complete Signature Demo Code............................................................................... 87
URL encoding ............................................................................................................ 97
Return status code .................................................................................................... 97
Subscription Message Data Fields ............................................................................ 99
Alarm Catagory ....................................................................................................... 107
Revision Records ............................................................................................................. 124

iii
HAT Cloud Open API Developer Guide

Chapter 1 Introduction
The HAT Cloud Open API service provides developers with HTTPS interfaces, which allows developers
to initiate retrieval requests through HTTPS and obtain returned JSON data. Users can develop
applications in languages such as JavaScript, C #, C++, Java, etc. based on this.

1.1 Glossary
Term Description
HAT Cloud HikAuto Technology Cloud platform
AccessKey apply for AppKey from HAT Cloud platform. Contact the marketing or
sales personnel to obtain it.
AccessSecret apply for AccessSecret from HAT Cloud platform. Contact the
marketing or sales personnel to obtain it.
ProductKey Product key. The code automatically assigned when the account is
generated. Devices with the same account and protocol type have the
same ProductKey.
serialNumber Hikvision device tag serial number
terminalID/deviceCode/ Device terminal number. The unique identification of the device in
phoneNumber HAT Cloud platform. The phone number used when the device is
connected to the platform, generally an 11-digit number, not
exceeding 12 digits. The terminalID and deviceCode mentioned in this
document both represent this data.
Device sleep The device is in a low power state
Alarm attachment The alarm attachment is the photo or video reported by the device
after it reports an alarm. It is usually used as evidence or proof for the
alarm. Download it from the file link.

1
HAT Cloud Open API Developer Guide

Chapter 2 Basic Explanation

2.1 Description of HTTPS interface request signature generation


method
● Generate Signature

Figure 2-1 Generate a signature and send the request


Please refer to the Appendix for the complete signature code.
Signature is to make the request legal, which is divided into five steps:

● Step 1: Assembly request parameters


1. The request parameters include system parameters and business parameters, please do not
miss them
System parameter description :System parameters are the parameters that must be included in all
requests

2
HAT Cloud Open API Developer Guide

Table 2-1 System Parameters

Parameter Required Description


AccessKey Y apply for AppKey from HAT Cloud platform. Contact the marketing
or sales personnel to obtain it.
SignatureMethod Y fixed value:HMAC-SHA1
SignatureNonce Y Used for preventing replay attacks on requests, each request is
unique. It is recommended to use Java
language:[Link]() to generate it
Timestamp Y time stamp
RegionId Y RegionID supported by API, fixed value cn-hangzhou
Version Y Version number, recommended fixed value 2.1.0
Signature Y The final generated signature result value
2. Signature as the key are not allowed in the request parameters. The Java reference code is as
follows:
String accessKey = "testId";
String accessSecret = "testSecret";
String timeStamp = [Link]()+"";
[Link]<String, String> params = new [Link]<String, String>();

 System Parameters
[Link]("SignatureMethod", "HMAC-SHA1");
[Link]("SignatureNonce", [Link]().toString());
[Link]("AccessKey", accessKey);
[Link]("Version", "2.1.0");
[Link]("Timestamp", timeStamp);
[Link]("RegionId", "cn-hangzhou");
 Business Parameters
Develop according to each interface as appropriate
 Remove signature key
if ([Link]("Signature"))
[Link]("Signature");
 Step 2: Sort by parameter Key (order)
The Java reference code is as follows:

3
HAT Cloud Open API Developer Guide

[Link]<String, String> sortParams = new [Link]<String, String>();


[Link](params);
Here, TreeMap from Java is used to automatically sort parameters. When using other languages, it is
important to note that the first letter of system parameter names is capitalized, while the first letter
of business parameter names is lowercase. Therefore, system parameters always rank before
business parameters when sorting.

● Step 3: Construct the request string to be signed


Firstly, let’s introduce the special URL encoding that will be used below. This is a special rule, which
adds three character substitutions after the general URLEncode:(+) to %20, (*) to %2A, %7E to (~).
Character encoding is UTF-8 [Link] Java reference code is as follows:
public static String specialUrlEncode(String value) throws Exception {
return [Link](value, "UTF-8").replace("+", "%20").replace("*",
"%2A").replace("%7E", "~");
}

There are two steps to construct the request string to be signed. Step 1 is to concatenate the sorted
parameters into the following format:
specialUrlEncode(parameterKey) + "=" + specialUrlEncode(parameterValue)

The Java reference code is as follows:


[Link]<String> it = [Link]().iterator();
StringBuilder sortQueryStringTmp = new StringBuilder();
while ([Link]()) {
String key = [Link]();
sortQueryStringTmp
.append("&")
.append(specialUrlEncode(key))
.append("=")
.append(specialUrlEncode([Link](key)));
}
String sortedQueryString = [Link](1);// Remove the first redundant & symbol

4
HAT Cloud Open API Developer Guide

Concatenate the final string to be signed according to the signature rules of POP, as follows:
HTTPMethod + "&" + specialUrlEncode("/") + "&" + specialUrlEncode(sortedQueryString)
The Java reference code is as follows:
StringBuilder stringToSign = new StringBuilder();
[Link]("GET").append("&");
[Link](specialUrlEncode("/")).append("&");
[Link](specialUrlEncode(sortedQueryString));

Note
Before signing, it is necessary to check if the stringToSign still contains characters that have not
been URL encoded, including (+), (*), (,), (/), etc. Please refer to the Appendix for the URL encoding
table.

● Step 4: Sign
Signature using HmacSHA1 algorithm + Base64. Encoding using UTF-8. The Java reference code is as
follows:
String sign = sign(accessSecret + "&", [Link]());
public static String sign(String accessSecret, String stringToSign) throws Exception {
[Link] mac = [Link]("HmacSHA1");
[Link](new [Link]([Link]("UTF-8"), "HmacSHA1"));
byte[] signData = [Link]([Link]("UTF-8"));
return new [Link].BASE64Encoder().encode(signData);
}

Parameter description:
accessSecret:Your accessSecret corresponds to the accessKey. Special note: POP requires an additional "&" cha
racter to be added after the key, which is accessSecret + "&"
stringToSign:The request string to be signed generated in the third step
● Step 5: Add the signature result to the request parameters and send the
request
Attention: Special URL encoding is also required for the signature

5
HAT Cloud Open API Developer Guide

String Signature = specialUrlEncode(sign);

Note
After signing, it is necessary to check if the Signature still contains characters that have not been
URL encoded, including (+), (*), (,), (/), etc. Please refer to the Appendix for the URL encoding
table.

2.2 API service endpoint


Each region has a corresponding API service endpoint. Please contact us to obtain your endpoint.
Take North America as an example, the endpoint is “[Link] When
calling the “/protocol/query” interface, the complete address is “[Link]
[Link]/v2/protocol/query?xx=xx&xx=xx”.

2.3 Basic process


Before development, you need to contact marketing or sales personnel to obtain a developer
AccessKey and AccessSecret. The AccessKey can only be used in the region where it was obtained. For
example, The AccessKey registered in North America cannot be used in other regions. You can use the
AccessKey to call the "/device/add" interface to add a device. After adding the device and it’s online,
you can obtain the data reported by the device and also get the preview, replay, intercom URL.

6
HAT Cloud Open API Developer Guide

Figure 2-2 Basic process

7
HAT Cloud Open API Developer Guide

Chapter 3 Manage Devices

3.1 List device protocols and product key


● Introduction to Interface Functions
1. Devices of the same account and protocol type have the same productKey.
2. The device protocol is assigned to the developer account by technical support when creating the
developer account;
3. The HAT Cloud can filter based on device protocols when performing specific query operations;
● URI
GET /protocol/query
● Request Parameters
No business parameters
● Response
Parameter Description Class
status Request result status value, success is 0. Please refer to the Integer
appendix return status code table for other values.
msg Error message description, only has a value when the status is String
not 0
data Response data List<Object>
[Link] protocol type, for example: 808 String
[Link] Product key String
● Response Example
{
"status": 0,
"data": [
{
"protocol": "808",
"productKey": "808_D_SUB_demo_123456789"
}

8
HAT Cloud Open API Developer Guide

]
}

3.2 Add devices


● Introduction to Interface Functions
Synchronize user device information to the HAT cloud. Devices are added to the root organization by
default.

Figure 3-1 add devices

● Global Open Platform Website address


[Link]

● URI
POST /device/add
● Request Parameters
Parameter Description Class Default Required
deviceList JSON format array, the format of a single JSON List<Object> - Y
object is shown in Table 3-1

9
HAT Cloud Open API Developer Guide

Table 3-1 Device List Parameter Details

Parameter Description Class Default Required


terminalID Device terminal number, not exceeding 12 String - Y
digits
productKey Product key String - Y
language Firmware language:EN/CN String - Y
deviceModel Device model, e.g. AE-DI2032-G40, AE- String - N
MD5043-SD
deviceName Device name String - N
plateNum Plate No. String - N
timeZone Device local timezone, with a numerical Integer - Y
range of -13 to 14
deviceChannelList Device channel list, detailed parameters List<Object> - N
are shown in Table 3-2

Table 3-2 Device channel list parameter details

Parameter Description Class Default Required


channelName Channel number name String CH + Channel N
number
channelNum Channel number, start from 1 Integer - Y
channelType Channel number type, 0 video channel, 1 Integer - Y
audio channel
● Parameter display
Signature=fezGKtqzgjhR5fXh+rGCk17yX6A=&AccessKey=D_SUB_test_1734530550607&RegionId=cn-
hangzhou&SignatureMethod=HMAC-SHA1&SignatureNonce=3e1260ed-81ba-4d7e-b84c-
1f37c23d6a5b&Timestamp=1755326718167&Version=2.1.0&deviceList=[{"timeZone":-
3,"language":"EN","terminalID":"12345678910","deviceChannelList":[{"channelName":"ch1","channel
Type":0,"channelNum":1}],"productKey":"808_D_SUB_test_1734530550607"},{"timeZone":-
3,"language":"EN","terminalID":"23456789101","productKey":"808_D_SUB_test_1734530550607"}]
● Escaped parameters
Signature=fezGKtqzgjhR5fXh%2BrGCk17yX6A%3D&AccessKey=D_SUB_test_1734530550607&RegionI
d=cn-hangzhou&SignatureMethod=HMAC-SHA1&SignatureNonce=3e1260ed-81ba-4d7e-b84c-

10
HAT Cloud Open API Developer Guide

1f37c23d6a5b&Timestamp=1755326718167&Version=2.1.0&deviceList=%5B%7B%22timeZone%22%
3A-
3%2C%22language%22%3A%22EN%22%2C%22terminalID%22%3A%2212345678910%22%2C%22devi
ceChannelList%22%3A%5B%7B%22channelName%22%3A%22ch1%22%2C%22channelType%22%3A0
%2C%22channelNum%22%3A1%7D%5D%2C%22productKey%22%3A%22808_D_SUB_test_17345305
50607%22%7D%2C%7B%22timeZone%22%3A-
3%2C%22language%22%3A%22EN%22%2C%22terminalID%22%3A%2223456789101%22%2C%22pro
ductKey%22%3A%22808_D_SUB_test_1734530550607%22%7D%5D

● Response
Parameter Description Class
status Request result status value, success is 0. Please refer to the Integer
appendix return status code table for other values.
msg Error message description, only has a value when the status is String
not 0
data Response data. The data type in the returned data is Map. Key is Map<String,String>
the number of the terminal where the device was added. Value
is the addition result, and when successful, it is “succeed”
● Response Example
{
"status": 0,
"data": {
"13211111111": "succeed",
"13211111112": "succeed"
}
}

3.3 Edit devices


● Introduction to Interface Functions
Edit the added devices, currently only supporting the modification of device channel number
information
● URI
POST /device/edit

11
HAT Cloud Open API Developer Guide

● Request Parameters
Parameter Description Class Default Required
deviceList JSON format array, the format of a single JSON List<Object> - Y
object is shown in Table 3-3

Table 3-3 Device List Parameter Details

Parameter Description Class Default Required


terminalID Device terminal number, not exceeding 12 String - Y
digits
productKey Product key String - Y
timeZone Device local timezone, with a numerical Integer - N
range of -13 to 14
deviceChannelList Device channel list, detailed parameters List<Object> - N
are shown in Table 3-2
● Parameter display
Signature=QsFpU739WdpIokULWuQY7EdTkLM=&AccessKey=D_SUB_test_1734530550607&RegionId
=cn-hangzhou&SignatureMethod=HMAC-SHA1&SignatureNonce=e1cd065c-8b2b-4b53-9efe-
3ba93a0c7810&Timestamp=1753428598745&Version=2.1.0&deviceList=[{"terminalID":"1234567891
0","deviceChannelList":[{"channelName":"ch1","channelType":0,"channelNum":1}],"productKey":"80
8_D_SUB_test_1734530550607"}]

● Escaped parameters
Signature=QsFpU739WdpIokULWuQY7EdTkLM%3D&AccessKey=D_SUB_test_1734530550607&Regio
nId=cn-hangzhou&SignatureMethod=HMAC-SHA1&SignatureNonce=e1cd065c-8b2b-4b53-9efe-
3ba93a0c7810&Timestamp=1753428598745&Version=2.1.0&deviceList=%5B%7B%22terminalID%22
%3A%2212345678910%22%2C%22deviceChannelList%22%3A%5B%7B%22channelName%22%3A%22
ch1%22%2C%22channelType%22%3A0%2C%22channelNum%22%3A1%7D%5D%2C%22productKey%
22%3A%22808_D_SUB_test_1734530550607%22%7D%5D

● Response
Same as adding devices interface.

3.4 Delete devices

12
HAT Cloud Open API Developer Guide

● Introduction to Interface Functions


Delete device information
● URI
DELETE /device/delete
● Request Parameters
Parameter Description Class Default Required
deviceCodeList List of Terminal Numbers List<String> - Y
● Response
Parameter Description Class
status Request result status value, success is 0. Please refer to the Integer
appendix return status code table for other values.
msg Error message description, only has a value when the status is String
not 0
data Response data. The data type in the returned data is Map. Key is Map<String,String>
the number of the terminal where the device was added. Value
is the result, and when successful, it is “succeed”
● Response Example
Same as adding devices interface.

3.5 List devices


● Introduction to Interface Functions
List the synchronized device information under the developer account
● URI
GET /device/list
● Request Parameters
Parameter Description Class Default Required
productKey Product key String - N
pageSize page size, ≥1 Integer 100 N
pageNo Current page number, ≥1 Integer 1 N

13
HAT Cloud Open API Developer Guide

● Response
Parameter Description Class
status Request result status value, success is 0. Please refer to the Integer
appendix return status code table for other values.
msg Error message description, only has a value when the status is String
not 0
data Response data, pagination object Object
[Link] Total number of pages Integer
[Link] Current page number Integer
[Link] Total number of records Long
[Link] Record start number Long
[Link] The data type is List. The detailed field description of the List<Object>
Object is shown in Table 3-4

Table 3-4 Device Details

Parameter Description Class


terminalID Device terminal number, not exceeding 12 digits String
productKey Product key String
createTime Added time in the UTC+0 time zone String
deviceStatus Device status 0: Offline; 1: Online; 2: Sleep Integer
language Firmware language: EN/CN String
organizeName Organization name. The device is by default under the root Sring
organization.
organizeId Organization ID. The device is by default under the root Integer
organization.
version Software version String
plateNum Plate No. String
timeZone Device local timezone, with a numerical range of -13 to 14 Integer
disable Disable status 0 or null : enable, 1:disable Integer
deviceChannelList Device channel list, detailed parameters are shown in Table 3-2 List<Object>
● Response Example
{

14
HAT Cloud Open API Developer Guide

"status": 0,
"data": {
"results": [
{
"terminalID": "13100000001",
"productKey": " 808_D_SUB_test_1730441301885 ",
"version": "V23.10.10",
"createTime": "2022-02-24 [Link]",
"deviceStatus": 0,
"language": "CN",
"deviceChannelList": [
{
"channelName": "channel1",
"channelNum": 1,
"channelType": 0
}
],
"plateNum": "AD2228",
"organizeId": 17,
"organizeName": "organize1",
"timeZone": -3
},
{
"terminalID": "13100000000",
"productKey": "808_2013_vwqFtSVp",
"version": "",
"createTime": "2022-02-22 [Link]",
"deviceStatus": 0,
"language": "CN",
"deviceChannelList": [
{
"channelName": "channel1",
"channelNum": 1,
"channelType": 0

15
HAT Cloud Open API Developer Guide

},
{
"channelName": "channel2",
"channelNum": 2,
"channelType": 0
}
],
"plateNum": "A8221",
"organizeId": 19,
"organizeName": "organize2",
"timeZone": -3
}
],
"totalPages": 1,
"currentPage": 1,
"totalRecords": 2,
"startIndex": 0
}
}

3.6 Query the online status of devices


● Introduction to Interface Functions
Query the online status of specified devices (batch):
● URI
GET /device/status
● Request Parameters
Parameter Description Class Default Required
deviceCodeList List of Terminal Numbers List<String> - Y
● Response
Parameter Description Class

16
HAT Cloud Open API Developer Guide

status Request result status value, success is 0. Please refer to the Integer
appendix return status code table for other values.
msg Error message description, only has a value when the status is String
not 0
data Response data. The data type in the returned data is Map. Key Map<String,Integer>
is the number of the terminal where the device was added.
Value is the online status -1: No permission for this device(Not
belong to you) 0: Offline; 1: Online; 2: Sleep
● Response Example
{
"status": 0,
"data": {
"13211111111": 0,
"13211111112": 1
}
}

3.7 Convert device serial number


● Introduction to Interface Functions
Convert the device serial number on the device tag to an 11 digit number for input as the terminal
number when adding
● URI
GET /device/snConvert
● Request Parameters
Parameter Description Class Default Required Notes
serialNumber Device tag serial number String - Y

● Response
Parameter Description Class Notes
status Request result status value, success is 0. Please refer to the Integer
appendix return status code table for other values.

17
HAT Cloud Open API Developer Guide

msg Error message description, only has a value when the status is not String
0
data 11 digit terminal number String

● Response Example
{
"status": 0,
"data": "13764829845"
}

3.8 Disable devices


● Introduction to Interface Functions
Disable the devices, the devices cannot connect to the platform to receive or upload data. Devices can
be enabled by using using the “/device/enable” interface.
● URI
POST /device/disable
● Request Parameters
Parameter Description Class Default Required
deviceCodeList List of Terminal Numbers List<String> - Y
● Response
Parameter Description Class
status Request result status value, success is 0. Please refer to the Integer
appendix return status code table for other values.
msg Error message description, only has a value when the status is String
not 0
data Response data. The data type in the returned data is Map. Key is Map<String,String>
the number of the terminal where the device was added. Value
is the result, and when successful, it is “succeed”
● Response Example

18
HAT Cloud Open API Developer Guide

{
"status": 0,
"data": {
"13211111111": "succeed",
"13211111112": "succeed"
}
}

3.9 Enable devices


● Introduction to Interface Functions
Enable the devices, the devices can connect to the platform to receive and upload data. After
disabling the device, this interface can be used to enable it.
● URI
POST /device/enable
● Request Parameters
Parameter Description Class Default Required
deviceCodeList List of Terminal Numbers List<String> - Y
● Response
Parameter Description Class
status Request result status value, success is 0. Please refer to the Integer
appendix return status code table for other values.
msg Error message description, only has a value when the status is String
not 0
data Response data. The data type in the returned data is Map. Key is Map<String,String>
the number of the terminal where the device was added. Value
is the result, and when successful, it is “succeed”
● Response Example
{
"status": 0,

19
HAT Cloud Open API Developer Guide

"data": {
"13211111111": "succeed",
"13211111112": "succeed"
}
}

20
HAT Cloud Open API Developer Guide

Chapter 4 Device Data

4.1 Query GPS List


● Introduction to Interface Functions
Page query the GPS list of the specified device;
● URI
GET /gps/list
● Request Parameters
Parameter Description Class Default Required
deviceCode Device terminal number, not exceeding 12 digits String - Y
startTime Start Time, yyyy-MM-dd HH:mm:ss String - Y
endTime End Time, yyyy-MM-dd HH:mm:ss. String - Y
The endTime must be later than the startTime.
The endTime cannot be later than 7 days from
the startTime.
utc UTC+0 time zone. Integer 0 N
0: startTime and endTime are regarded as the
time in the device's time zone
1: startTime and endTime are regarded as the
time in the UTC+0 time zone
filterInvalidGps Filter out invalid GPS boolean true N
pageSize page size, ≥1 Integer 1000 N
pageNo Current page number, ≥1 Integer 1 N
● Parameter display
Signature=/+OVIyaFU1uiUF2wP8XFeLNNjUw=&AccessKey=D_SUB_test_1734530550607&RegionId=c
n-hangzhou&SignatureMethod=HMAC-SHA1&SignatureNonce=d50f3e46-91eb-419d-8d3d-
aac2bfdbb181&Timestamp=1753428355673&Version=2.1.0&deviceCode=12345678910&endTime=yy
yy-MM-dd HH:mm:ss&startTime=yyyy-MM-dd HH:mm:ss
● Escaped parameters
Signature=%2F%2BOVIyaFU1uiUF2wP8XFeLNNjUw%3D&AccessKey=D_SUB_test_1734530550607&Re
gionId=cn-hangzhou&SignatureMethod=HMAC-SHA1&SignatureNonce=d50f3e46-91eb-419d-8d3d-

21
HAT Cloud Open API Developer Guide

aac2bfdbb181&Timestamp=1753428355673&Version=2.1.0&deviceCode=12345678910&endTime=yy
yy-MM-dd%20HH%3Amm%3Ass&startTime=yyyy-MM-dd%20HH%3Amm%3Ass

● Response
Parameter Description Class
status Request result status value, success is 0. Please refer to the Integer
appendix return status code table for other values.
msg Error message description, only has a value when the status is String
not 0
data Response data, pagination object Object
[Link] Total number of pages Integer
[Link] Current page number Integer
[Link] Total number of records Long
[Link] Record start number Long
[Link] The data type is List. The detailed field description of the List<Object>
Object is shown in Table 4-1

Table 4-1 Detailed GPS information of the device

Parameter Description Class


gpsValid Positioning status, 0 invalid, 1 valid Integer
longitude longitude Double
latitude latitude Double
divisionEW E: East longitude, W: West longitude String
divisionNS N: North latitude, S: south latitude String
altitude altitude Double
speed speed (km/h) Float
direction Direction angle (heading) Integer
collectTime GPS reporting time in the device's time zone, yyyy-MM-dd HH:mm:ss String
utcTime GPS reporting time in the UTC+0 time zone, yyyy-MM-dd HH:mm:ss String
accStatus ACC status 0: closed 1: open String
supplementSign Supplementary reporting label (1: Supplementary reporting; 0: Normal Integer
reporting)

22
HAT Cloud Open API Developer Guide

createTime The platform received GPS time in the UTC+0 time zone, yyyy-MM-dd String
HH:mm:ss
● Response Example
{
"status": 0,
"data": {
"results": [
{
"gpsValid": 1,
"longitude": 120.323123,
"latitude": 30.251523,
"altitude": 3.0,
"speed": 7.6,
"direction": 108,
"collectTime": "2022-03-07 [Link]",
"accStatus": "1",
"supplementSign": 0,
"createTime": "2022-03-07 [Link]"
},
{
"gpsValid": 1,
"longitude": 120.323623,
"latitude": 30.252023,
"altitude": 3.0,
"speed": 8.0,
"direction": 10,
"collectTime": "2022-03-07 [Link]",
"accStatus": "1",
"supplementSign": 0,
"createTime": "2022-03-07 [Link]"
}
],
"totalPages": 1,

23
HAT Cloud Open API Developer Guide

"currentPage": 1,
"totalRecords": 2,
"startIndex": 0
}
}

4.2 Query the latest GPS information


● Introduction to Interface Functions
Query the latest GPS information reported by the specified device
● URI
GET /gps/latest
● Request Parameters
Parameter Description Class Default Required
deviceCode Device terminal number, not exceeding 12 digits String - Y
● Parameter display
Signature=/+OVIyaFU1uiUF2wP8XFeLNNjUw=&AccessKey=D_SUB_test_1734530550607&RegionId=c
n-hangzhou&SignatureMethod=HMAC-SHA1&SignatureNonce=d50f3e46-91eb-419d-8d3d-
aac2bfdbb181&Timestamp=1753428355481&Version=2.1.0&deviceCode=12345678910
● Escaped parameters
Signature=%2F%2BOVIyaFU1uiUF2wP8XFeLNNjUw%3D&AccessKey=D_SUB_test_1734530550607&Re
gionId=cn-hangzhou&SignatureMethod=HMAC-SHA1&SignatureNonce=d50f3e46-91eb-419d-8d3d-
aac2bfdbb181&Timestamp=1753428355673&Version=2.1.0&deviceCode=12345678910

● Response
Parameter Description Class
status Request result status value, success is 0. Please refer to the appendix return Integer
status code table for other values.
msg Error message description, only has a value when the status is not 0 String
data Response data, detailed object data can be found in Table 4-1 Object
● Response Example

24
HAT Cloud Open API Developer Guide

{
"status": 0,
"data": {
"gpsValid": 1,
"longitude": 120.457708,
"latitude": 30.420116,
"altitude": 3.0,
"speed": 9.7,
"direction": 327,
"collectTime": "2022-03-07 [Link]",
"accStatus": "1",
"supplementSign": 0
}
}

4.3 List alarm


● Introduction to Interface Functions
List device alarm
● URI
GET /alarm/list
● Request Parameters
Parameter Description Class Default Required
deviceCode Device terminal number, not exceeding 12 digits String - Y
startTime Start Time, yyyy-MM-dd HH:mm:ss String - Y
endTime End Time, yyyy-MM-dd HH:mm:ss String - Y
utc UTC+0 time zone. Integer 0 N
0: startTime and endTime are regarded as the time in
the device's time zone
1: startTime and endTime are regarded as the time in
the UTC+0 time zone
pageSize page size, ≥1 Integer 100 N

25
HAT Cloud Open API Developer Guide

pageNo Current page number, ≥1 Integer 1 N


● Parameter display
Signature=/+OVIyaFU1uiUF2wP8XFeLNNjUw=&AccessKey=D_SUB_test_1734530550607&RegionId=c
n-hangzhou&SignatureMethod=HMAC-SHA1&SignatureNonce=d50f3e46-91eb-419d-8d3d-
aac2bfdbb181&Timestamp=1753428355673&Version=2.1.0&deviceCode=12345678910&endTime=yy
yy-MM-dd HH:mm:ss&startTime=yyyy-MM-dd HH:mm:ss
● Escaped parameters
Signature=%2F%2BOVIyaFU1uiUF2wP8XFeLNNjUw%3D&AccessKey=D_SUB_test_1734530550607&Re
gionId=cn-hangzhou&SignatureMethod=HMAC-SHA1&SignatureNonce=d50f3e46-91eb-419d-8d3d-
aac2bfdbb181&Timestamp=1753428355673&Version=2.1.0&deviceCode=12345678910&endTime=yy
yy-MM-dd%20HH%3Amm%3Ass&startTime=yyyy-MM-dd%20HH%3Amm%3Ass

● Response
Parameter Description Class
status Request result status value, success is 0. Please refer to the Integer
appendix return status code table for other values.
msg Error message description, only has a value when the status is String
not 0
data Response data, pagination object Object
[Link] Total number of pages Integer
[Link] Current page number Integer
[Link] Total number of records Long
[Link] Record start number Long
[Link] The data type is List. The detailed field description of the List<Object>
Object is shown in Table 4-2 (Note: Different alarm data
objects may contain different fields)

Table 4-2 Device alarm information details

Parameter Description Class


deviceCode Device terminal number String
productKey Product key String
type Alarm Type Integer
subType Alarm Subtype (Alarm Type and Alarm Subtype Can Determine Integer
Unique Alarm Class))

26
HAT Cloud Open API Developer Guide

level Alarm level 0x01: Warning 0x02: Alarm Integer


frontCarSpeed Front vehicle speed Km/h Integer
frontDistance Distance between preceding vehicle/pedestrian Integer
deviationType Deviation type 0x01: Left deviation 0x02: Right deviation Integer
roadSignsType Road sign recognition type: 0x01: speed limit sign, 0x02: height Integer
limit sign, 0x03: weight limit sign
roadSignsValue Road sign recognition data Integer
speed Vehicle speed unit: Km/h Integer
altitude Altitude unit: m Short
longitude Longitude Double
latitude Latitude Double
time Alarm reporting time in the device's time zone, `YY-MM-DD-hh- String
mm-ss`
utcTime Alarm reporting time in the UTC+0 time zone, `YY-MM-DD-hh- String
mm-ss`
accState ACC state Integer
leftTurnState Left turn status, 0: closed, 1: open Integer
rightTurnState Right turn status, 0: closed, 1: open Integer
wiperState Wiper status, 0: off, 1: on Integer
brakingState Braking status, 0: not braking, 1: braking Integer
cardState Card insertion status, 0: not inserted, 1: inserted Integer
gpsValid Location status, 0: not located, 1: located Integer
deviceId Termination ID String
alarmSignTime Alarm identification time in the device's time zone String
index Index Integer
attachCount Number of attachments Integer
alarmSign Alarm identification number, Terminal ID - Time - Serial Number String
- Attachment Quantity
fatigueDegree Fatigue level, ranging from 1 to 10. The larger the value, the Integer
more severe the fatigue level
carSign When the license plate color is 0, it represents the VIN of the String
vehicle; Otherwise, it means the motor vehicle license plate
issued by the public security traffic management department
color Plate color Integer
serializeState Initialization Status Boolean
needAttachUpload Need to upload attachments Boolean
areaType Region and Road Type Integer
areaId Region and Road Number Integer
efcType Entry and exit alarm type (0: Enter area, 1: Leave area) Integer

27
HAT Cloud Open API Developer Guide

alarmSignVo alarm identifier Object


qualificationNumber Driver Qualification Certificate Number String
gpsData GPS information corresponding to the alarm (see Table 4-1 for Object
details)
chanNo Logical channel number, start from 1 Integer
attachFlag Alarm attachment tag, when this tag is true, it indicates that the Boolean
message sent is the attachment information (image or video)
attached to the alarm event
attachInfo Alarm attachment information, this field is valid when Object
attachFlag is true. For detailed fields, please refer to Table 4-3
efcName Electronic fence name String
efcUuid Electronic fence uuid String
efcEventInfo The detailed information of the electronic fence alarm is shown Object
in Table 4-5
limitState Access restrictions (1: No entry; 2: No exit; 3: Route deviation) Integer
position Alarm location String
moveState Motion status, 0: Stop, 1: Drive Integer
voltage Battery voltage, amplified 1000 times Integer
temperature Device temperature, magnified 1000 times Integer
wakeupType Device wake-up source Integer
Tvistatus Rear camera recording status Integer
LTEpower 4G module power supply Integer
LTEstatus 4G module in place signal Integer
parkmode Parking monitoring mode Integer
uploadType Report message type Integer
stayTime The duration of the alarm that has been stopped as minutes Integer
stayId Passing point ID Long

Table 4-3 Alarm attachment information

Parameter Description Class


uploadState Upload state Boolean
url Download file URL String
fileType File type 0-jpg,1-png,2-wav,3-mp4,4-h264[A1] ,5-h265 Integer
fileSize File size Integer
fileName The file name saved in the storage server String
uuid The uuid carried during the corresponding digital signature String
alarmSignVo Alarm identification number, see details in Table 4-4 Object

28
HAT Cloud Open API Developer Guide

reason Reason, described by reason when failure occurs String


totalNum total Integer
successNum Number of successful cases Integer
fileNameList List of successfully uploaded file names List<String>

Table 4-4 Alarm identification

Parameter Description Class


deviceCode Termination ID String
alarmSignTime Alarm identification time in the device's time zone String
index Index Integer
attachCount Number of attachments Integer

Table 4-5 Electronic fence information

Parameter Description Class


overSpeed OverSpeed Boolean
distance Distance (required when type is line) Double
deviation Deviation (required when type is line) Boolean
segmentInfo The calculated route of the vehicle (required when the type is a Object
line)
gpsData Alarm GPS information Object

● Response Example

● Note
● Different alarm types return different data, and the specific return value needs to be
obtained according to the actual alarm type.

{
"status": 0,
"data": {
"results": [
{
"deviceCode": "19955883917",

29
HAT Cloud Open API Developer Guide

"productKey": "808_2013_vwqFtSVp",
"type": -30,
"state": 0,
"subType": 0,
"time": "2022-03-07 [Link]",
"gpsValid": 1,
"alarmSign": "19955883917-220307142355-0-0",
"serializeState": false,
"needAttachUpload": false,
"attachFlag": false,
"discard": false
},
{
"deviceCode": "19955883917",
"productKey": "808_2013_vwqFtSVp",
"type": -30,
"state": 0,
"subType": 0,
"time": "2022-03-07 [Link]",
"gpsValid": 1,
"alarmSign": "19955883917-220307144916-0-0",
"serializeState": false,
"needAttachUpload": false,
"attachFlag": false,
"discard": false
}
],
"totalPages": 1,
"currentPage": 1,
"totalRecords": 2,
"startIndex": 0
}
}

30
HAT Cloud Open API Developer Guide

4.4 Query device alarm attachments


● Introduction to Interface Functions
Query device alarm attachments. The alarm attachment is the photo or video reported by the device
after it reports an alarm. It is usually used as evidence or proof for the alarm. Download it from the
file link.
● URI
GET /alarm/attach
● Request Parameters
Parameter Description Class Default Required
deviceCode Device terminal number, not exceeding 12 digits String - Y
alarmSign Alarm identification String - Y

● Response
Parameter Description Class
status Request result status value, success is 0. Please refer to the appendix Integer
return status code table for other values.
msg Error message description, only has a value when the status is not 0 String
data Response data, the list of alarm attach info, see in Table 4-6 List<Object>

Table 4-6 Alarm attachment description

Parameter Description Class


fileName File name String
type File type, 0: Image 1: Audio 2: Video 3: Text 4: Other Integer
fileSize File size, in bytes Integer
url File download URL String
ownerShip File storage properties String
fileType File extension String

● Response Example
{
"status": 0,
"data": {

31
HAT Cloud Open API Developer Guide

"results": [
{
"fileName": "[Link]",
"fileSize": 1424213123,
"type": 0,
"url": "[Link]"
}
],
"totalPages": 1,
"currentPage": 1,
"totalRecords": 1,
"startIndex": 0
}
}

4.5 Get file download link


● Introduction to Interface Functions
Get file(attachment) download URL. It will return an link with a validity period of 10 minutes. We
suggest that you call this interface to generate links when downloading files. Do not store the links in
the database.
The alarm attachment is the photo or video reported by the device after it reports an alarm. It is
usually used as evidence or proof for the alarm. Download it from the file link.

32
HAT Cloud Open API Developer Guide

Figure 4-1 Subscribe to alarm attachments


● URI
GET /media/download
● Request Parameters
Parameter Description Class Default Required
fileName File name(Alarm attachment return value) String - Y
● Response
Parameter Description Class
status Request result status value, success is 0. Please refer to the appendix return Integer
status code table for other values.
msg Error message description, only has a value when the status is not 0 String
data File download URL String
● Response Example
{
"status": 0,
"data": "[Link]
}

4.6 Synchronize facial information


● Introduction to Interface Functions

33
HAT Cloud Open API Developer Guide

Synchronize the driver/passenger facial information corresponding to the device to the cloud.
If you want to send a face to the device, you can first call the “/face/sync” interface to synchronize
the face to the cloud, and then call “/face/change” interface to send the face to the device.
Then subscribe message type “EVENT” by the webhook, when “type” is -30 and “subType” is 10, it
represents the event of facial comparison results. Data includes “faceRecognitionData”(the analysis
results of facial comparison). For the detail field of each message type, refer to Appendix-Subscription
Message Data Fields

Figure 4-2 Send a face to the device


● URI
GET /face/sync
● Request Parameters
Parameter Description Class Default Required
terminalID Device terminal number, not exceeding 12 digits String - Y
productKey Product key String - Y
faceInfoList Facial information list, The detailed field List<Object> - Y
description of the Object is shown in Table 4-7

Table 4-7 Facial information

Parameter Description Class Default Required


groupIndexCode Driver/passenger group identification String - Y

34
HAT Cloud Open API Developer Guide

type Type 1: Driver, 2: Passenger Integer - Y


driverIndexCode Driver/passenger unique identification Integer - Y
name Driver/passenger name String - Y
sex Sex, 0-male, 1-female Integer - Y
cardType Certificate type: 0-Business Qualification Integer 0 N
Certificate, 1-ID Card.
cardID Certificate ID, operation qualification certificate Integer - Y
number or ID number number
photoUrl Facial photo URL. String - Y
Photo requirements:
1. Expose the forehead, ears, and the front of the
face, without wearing a hat
2. The facial light is even, without backlighting or
beauty filters
3. Resolution less than 1280*720
4. Size less than 3M
5. Format should be jpg
lastTime The latest driver change time is based on the String - N
ISO8601 format "yyyy-MM-
dd'T'HH:mm:[Link]". For example, “2019-05-
24T[Link].192+08:00”
● Parameter display
Signature=l9jUxhJqmg/dSfeDC/gR5EFNzbs=&AccessKey=D_SUB_test_1734530550607&RegionId=cn-
hangzhou&SignatureMethod=HMAC-SHA1&SignatureNonce=4b075c9a-c537-4fdf-95bb-
455e11e7fead&Timestamp=1755328390856&Version=2.1.0&faceInfoList=[{"photoUrl":"[Link]
m/xxx","driverIndexCode":1,"cardID":"80818301","sex":0,"name":"tom","groupIndexCode":"1","type
":1}]&productKey=808_D_SUB_test_1730441301885&terminalID=12345678910
● Escaped parameters
Signature=l9jUxhJqmg%2FdSfeDC%2FgR5EFNzbs%3D&AccessKey=D_SUB_test_1734530550607&Regi
onId=cn-hangzhou&SignatureMethod=HMAC-SHA1&SignatureNonce=4b075c9a-c537-4fdf-95bb-
455e11e7fead&Timestamp=1755328390856&Version=2.1.0&faceInfoList=%5B%7B%22photoUrl%22
%3A%22http%3A%2F%[Link]%2Fxxx%22%2C%22driverIndexCode%22%3A1%2C%22cardID%22%
3A%2280818301%22%2C%22sex%22%3A0%2C%22name%22%3A%22tom%22%2C%22groupIndexCo
de%22%3A%221%22%2C%22type%22%3A1%7D%5D&productKey=808_D_SUB_test_1730441301885
&terminalID=12345678910

35
HAT Cloud Open API Developer Guide

● Response
Parameter Description Class Notes
status Request result status value, success is 0. Please refer to the Integer
appendix return status code table for other values.
msg Error message description, only has a value when the status is not String
0

● Response Example
{
"status": 0
}

4.7 Distribute facial change information


● Introduction to Interface Functions
Send the facial change information to the device and inform it that the corresponding facial data
needs to be updated. It can be used to obtain the face comparison results on the device end.
● URI
GET /face/change
● Request Parameters
Parameter Description Class Default Required
terminalID Device terminal number, not String - Y
exceeding 12 digits
productKey Product key String - Y
changedScope Changed scope,1:Update the entire Integer - Y
group, 2:Some drivers/passengers
within the group have had their facial
information changed
changedStatus Changed status,0:add, 1:update, Integer - Y
2:delete, 3:Multiple combinations
have undergone different state
changes, it is recommended to update
again

36
HAT Cloud Open API Developer Guide

groupIndexCode Driver/passenger group identification Integer - Y


driverIndexCodeArray Unique identification for List<Integer> - N
driver/passenger. If this parameter is
not filled in, it means updating the
entire group
● Parameter display
Signature=Ld4jO1AGUN0mAjyrZtoKc0cJlCg=&AccessKey=D_SUB_test_1734530550607&RegionId=cn-
hangzhou&SignatureMethod=HMAC-SHA1&SignatureNonce=8ec0c37a-4091-463e-b0c2-
b9ae74140788&Timestamp=1755329175790&Version=2.1.0&changedScope=1&changedStatus=3&dr
iverIndexCodeArray=[1]&groupIndexCode=1&productKey=808_D_SUB_test_1730441301885&termin
alID=12345678910
● Escaped parameters
Signature=Ld4jO1AGUN0mAjyrZtoKc0cJlCg%3D&AccessKey=D_SUB_test_1734530550607&RegionId=
cn-hangzhou&SignatureMethod=HMAC-SHA1&SignatureNonce=8ec0c37a-4091-463e-b0c2-
b9ae74140788&Timestamp=1755329175790&Version=2.1.0&changedScope=1&changedStatus=3&dr
iverIndexCodeArray=%5B1%5D&groupIndexCode=1&productKey=808_D_SUB_test_1730441301885&
terminalID=12345678910

● Response
Parameter Description Class Notes
status Request result status value, success is 0. Please refer to the Integer
appendix return status code table for other values.
msg Error message description, only has a value when the status is not String
0

● Response Example
{
"status": 0
}

4.8 Confirm emergency alarm


● Introduction to Interface Functions

37
HAT Cloud Open API Developer Guide

After an emergency alarm occurs, manually confirm it. Used to end an emergency alarm. If not
confirmed, this emergency alarm will remain in a continuous state.
The emergency alarm of this interface only refers to the emergency alarm with type -32 and
subtype 0.
● URI
GET /alarm/confirmEmergency
● Request Parameters
Parameter Description Class Default Required
terminalID Device terminal number, not exceeding 12 digits String - Y
productKey Product key String - Y
● Response
Parameter Description Class Notes
status Request result status value, success is 0. Please refer to the Integer
appendix return status code table for other values.
msg Error message description, only has a value when the status is not String
0

● Response Example
{
"status": 0
}

4.9 Set speed threshold


● Introduction to Interface Functions
Send speed threshold to the device. When the speed exceeds this threshold, it is judged as
overspeed.
● URI
GET /device/setMaxSpeed
● Request Parameters

38
HAT Cloud Open API Developer Guide

Parameter Description Class Default Required


terminalID Device terminal number, not exceeding 12 digits String - Y
productKey Product key String - Y
speed Speed threshold. Unit: km/h Integer - Y
● Response
Parameter Description Class Notes
status Request result status value, success is 0. Please refer to the Integer
appendix return status code table for other values.
msg Error message description, only has a value when the status is not String
0

● Response Example
{
"status": 0
}

4.10 Query the daily flow of the device


● Introduction to Interface Functions
Query the total daily flow of the device;
● URI
GET /device/queryDayFlow
● Request Parameters
Parameter Description Class Default Required
deviceCode Device terminal number, not exceeding 12 digits String - Y
startDay Start day, yyyy-MM-dd String - Y
endDay End day , yyyy-MM-dd String - Y
● Response
Parameter Description Class Notes

39
HAT Cloud Open API Developer Guide

status Request result status value, success is 0. Please refer to the Integer
appendix return status code table for other values.
msg Error message description, only has a value when the status String
is not 0
data Response data, the list of Device Flow Data, see in Table 4-8 List<Object>

Table 4-8 Detailed Information of the Device Flow Data Object

Parameter Description Class Notes


date the specific day, yyyy-MM-dd String
flow The specific daily flow(unit: byte) consumed by the device Long

● Response Example
{
"status": 0,
"data": [
{
"date":"2025-08-01",
"flow":1892
}
]

4.11 Query the monthly flow of the device


● Introduction to Interface Functions
Query the total monthly flow of the device;
● URI
GET /device/queryMonthFlow
● Request Parameters

40
HAT Cloud Open API Developer Guide

Parameter Description Class Default Required


deviceCode Device terminal number, not exceeding 12 digits String - Y
startMonth Start month, yyyy-MM String - Y
endMonth Start month, yyyy-MM String - Y
● Response
Parameter Description Class Notes
status Request result status value, success is 0. Please refer to the Integer
appendix return status code table for other values.
msg Error message description, only has a value when the status String
is not 0
data Response data, the list of Device Flow Data, see in Table 4-9 List<Object>

Table 4-9 Detailed Information of the Device Flow Data Object

Parameter Description Class Notes


date the specific month, yyyy-MM String
flow The specific Monthly flow(unit: byte) consumed by the device Long

● Response Example
{
"status": 0,
"data": [
{
"date":"2025-08",
"flow":289121
}
]
}

4.12 Get device channel screenshot

41
HAT Cloud Open API Developer Guide

● Introduction to Interface Functions


Get the device channel screenshot, the interface response timeout is 30 seconds.
● URI
GET /device/capture
● Request Parameters
Parameter Description Class Default Required
deviceCode Device terminal number, not exceeding 12 digits String - Y
channelNo Channel number, start from 1 Integer - Y
resolution The resolution of screenshot, 1: 320*240 pixels, 2: Integer 1 N
640*480 pixels, 3: 800*600 pixel, 4: 1024*768 pixel
quality The quality of screenshot, the value range is [1,10], 1 Integer 5 N
means the best quality
brightness The brightness of screenshot, the value range is [0,255] Integer 128 N
hues The heus of sreenshot, the value range is [0,255] Integer 128 N
saturation The saturation of screenshot, the value range is [0,127] Integer 64 N
contrast The contrast of screenshot, the value range is [0,127] Integer 64 N
● Response
Parameter Description Class Notes
status Request result status value, success is 0. Please refer to the Integer
appendix return status code table for other values.
msg Error message description, only has a value when the status is not String
0
data Response data, the details information of the device channel Object
screenshot, see in Table 4-10

Table 4-10 Detailed Information of the Device Channel Screenshot Object

Parameter Description Class Notes


fileName The filename of screenshot String
url The download url of screenshot, and the url is valid for 10 String
minutes. If the url is expired, it can be retrieved again by using
the parameter fileName to call “/media/download” interface

42
HAT Cloud Open API Developer Guide

fileSize The file size of screenshot Long Unit:


byte

● Response Example
{
"status": 0,
"data": [
{
"fileName":" 16065911991_1_2_20250818050112.jpg",
"url":"[Link] ?expire",
"fileSize": 7803
}
]
}

43
HAT Cloud Open API Developer Guide

Chapter 5 Audio and Video

5.1 Live view


● Introduction to Interface Functions
Get live view URL. The URL is valid for 60 seconds and can only be used once.
The obtained URL can be played using the plugins provided by Hikvision.

Regarding how to use and play the URL, please refer to demo and documentation of Media.

Figure 5-1 Features supported by media

● URI
GET /device/preview
● Request Parameters

44
HAT Cloud Open API Developer Guide

Parameter Description Class Default Required


deviceCode Device terminal number, not exceeding 12 digits String - Y
channelNo Channel number, start from 1 Integer 1 N
streamType Stream type, 0 main stream, 1 sub stream, default Integer 1 N
to 1
streamProtocol Video streaming protocol type,0 RTSP,1 RTMP,2 Integer 0 N
HLS,3 WEBSOCKET, 4 Http-Flv
● Response
Parameter Description Class
status Request result status value, success is 0. Please refer to the appendix return Integer
status code table for other values.
msg Error message description, only has a value when the status is not 0 String
data Video stream URL String
● Response Example
{
"status": 0,
"data":
"rtsp://211.***.***.***:15002/JT808://211.***.***.***:1[Link]23?pushuuid=7e2ca649
b7872de6f&recvuuid=db58b24b86d967163&mode=0"
}

5.2 Live view (batch channel)


● Introduction to Interface Functions
Get live view URLs of batch channel.

● URI
GET /device/previewBatchChannel
● Request Parameters
Parameter Description Class Default Required

45
HAT Cloud Open API Developer Guide

deviceCode Device terminal number, not exceeding 12 String - Y


digits
channelNoList List of channel numbers, start from 1 List<Integer> - Y
streamType Stream type, 0 main stream, 1 sub stream, Integer 1 N
default to 1
streamProtocol Video streaming protocol type,0 RTSP,1 Integer 0 N
RTMP,2 HLS,3 WEBSOCKET, 4 Http-Flv
● Response
Parameter Description Class
status Request result status value, success is 0. Please refer to the Integer
appendix return status code table for other values.
msg Error message description, only has a value when the status is String
not 0
data The data type in the returned data is Map. Key is the channel Map<Integer,String>
number. Value is the video stream URL
● Response Example
{
"status": 0,
"data": {
"1":"rtsp://211.***.***.***:15002/JT808://211.***.***.***:1[Link]23?pushuuid=7
e2ca649b7872de6f&recvuuid=db58b24b86d967163&mode=0",
"2":"rtsp://211.***.***.***:15002/JT808://211.***.***.***:1[Link]44?pushuuid=1
122ca649b7872deb1&recvuuid=as58b24b86d967179&mode=0"
}
}

5.3 List video recording


● Introduction to Interface Functions
Retrieve the local recording list of the device
● URI

46
HAT Cloud Open API Developer Guide

GET /device/videoList
● Request Parameters
Parameter Description Class Default Required
deviceCode Device terminal number, not exceeding 12 digits String - Y
startTime Start Time in the device's time zone, yyyy-MM-dd String - Y
HH:mm:ss
endTime End Time in the device's time zone , yyyy-MM-dd String - Y
HH:mm:ss
channelNo Channel number, start from 1 Integer 1 N
streamType Stream type, 0 main stream, 1 sub stream, default to 1 Integer 1 N
storeType Memory type, 0: All 1: Main memory; 2: Disaster Integer 1 N
Recovery Memory
● Response
Parameter Description Class
status Request result status value, success is 0. Please refer to the Integer
appendix return status code table for other values.
msg Error message description, only has a value when the status is String
not 0
data Response data, pagination object Object
[Link] Total number of pages Integer
[Link] Current page number Integer
[Link] Total number of records Long
[Link] Record start number Long
[Link] The data type is List. The detailed field description of the List<Object>
Object is shown in Table 5-1

Table 5-1 Video information

Parameter Description Class


channelNo Logical Channel Number, start from 1 Integer
mediaType Video and audio type, 0: audio and video; 1: Audio; 2: Video Integer
streamType Stream type, 1: main stream; 2: Sub stream Integer
storeType Memory type, 1: main memory; 2: Disaster Recovery Memory Integer

47
HAT Cloud Open API Developer Guide

fileSize File size in bytes (BYTE) Integer


startTime Start Time in the device's time zone, yyyy-MM-dd HH:mm:ss String
endTime End Time in the device's time zone, yyyy-MM-dd HH:mm:ss String
● Response Example

{
"status": 0,
"data": [
{
"channelNo": 1,
"startTime": "2022-03-07 [Link]",
"endTime": "2022-03-07 [Link]",
"mediaType": 2,
"streamType": 1,
"storeType": 1,
"fileSize": 29350172,
"eventCode": 0
},
{
"channelNo": 1,
"startTime": "2022-03-07 [Link]",
"endTime": "2022-03-07 [Link]",
"mediaType": 2,
"streamType": 1,
"storeType": 1,
"fileSize": 75335956,
"eventCode": 0
}
]
}

48
HAT Cloud Open API Developer Guide

5.4 Playback
● Introduction to Interface Functions
Obtain the URL for video playback. The URL is valid for 60 seconds and can only be used once.
Regarding how to use and play the URL, please refer to demo and documentation of Media.

● URI
GET /device/videoReplay
● Request Parameters
Parameter Description Class Default Required
deviceCode Device terminal number, not exceeding 12 digits String - Y
startTime Start Time in the device's time zone, yyyy-MM-dd String - Y
HH:mm:ss
endTime End Time in the device's time zone, yyyy-MM-dd String - Y
HH:mm:ss
channelNo Channel number, start from 1 Integer 1 N
streamType Stream type, 0 main stream, 1 sub stream, default Integer 1 N
to 1
storeType Memory type, 0: All 1: Main memory; 2: Disaster Integer 1 N
Recovery Memory
streamProtocol Video streaming protocol type,0 RTSP,2 HLS,3 Integer 0 N
WEBSOCKET, 4 Http-Flv

Note
HLS: Playback speed doubling and other controls are not supported.
Http-Flv: The extended playback control command is required

● Response
Parameter Description Class

49
HAT Cloud Open API Developer Guide

status Request result status value, success is 0. Please refer to the appendix return Integer
status code table for other values.
msg Error message description, only has a value when the status is not 0 String
data Video stream URL String
● Response Example
{
"status": 0,
"data": "rtsp://211.***.***.***:10650/JT808_11177777777_1_0_uuid=75D34D40-6F8B-EC45-
9AC8-C5ECC2400D4_playMode=0"
}

5.5 Playback (batch channel)


● Introduction to Interface Functions
Obtain the URLs for video playback of batch channel. Suggest playing back up to 4 channels
simultaneously on the same device. The playback bitrate is relatively high, and network fluctuations
can affect the playback effect.

● URI
GET /device/videoReplayBatchChannel
● Request Parameters
Parameter Description Class Default Required
deviceCode Device terminal number, not exceeding 12 String - Y
digits
startTime Start Time in the device's time zone, yyyy- String - Y
MM-dd HH:mm:ss
endTime End Time in the device's time zone, yyyy-MM- String - Y
dd HH:mm:ss
channelNoList List of channel numbers, start from 1 List<Integer> - Y
streamType Stream type, 0 main stream, 1 sub stream, Integer 1 N
default to 1
storeType Memory type, 0: All 1: Main memory; 2: Integer 1 N
Disaster Recovery Memory

50
HAT Cloud Open API Developer Guide

streamProtocol Video streaming protocol type,0 RTSP,2 Integer 0 N


HLS,3 WEBSOCKET, 4 Http-Flv *(The playback
function requires device customization to
use HLS and WEBSOCKET protocols)

● Response
Parameter Description Class
status Request result status value, success is 0. Please refer to the Integer
appendix return status code table for other values.
msg Error message description, only has a value when the status is String
not 0
data The data type in the returned data is Map. Key is the channel Map<Integer,String>
number. Value is the video stream URL
● Response Example
{
"status": 0,
"data": {
"1":"rtsp://211.***.***.***:10650/JT808_11177777777_1_0_uuid=75D34D40-6F8B-EC45-9AC8-
C5ECC2400D4_playMode=0",
"2":"rtsp://211.***.***.***:10650/JT808_11177777777_2_0_uuid=24D34D40-6F8B-EC45-9AC8-
C5ECC2400G1_playMode=0"
}
}

5.6 Real time intercom/monitoring


● Introduction to Interface Functions
Obtain the intercom URL. The URL is valid for 60 seconds and can only be used once.
Regarding how to use and play the URL, please refer to demo and documentation of Media.
The broadcasting function requires device support.
● URI

51
HAT Cloud Open API Developer Guide

GET /device/intercom
● Request Parameters
Parameter Description Class Default Required
deviceCode Device terminal number, not exceeding 12 digits String - Y
channelNo Channel number, start from 1 Integer - Y
intercomMode 0- Real time intercom 1 v 1 , 3- Monitoring, 5- Integer 1 N
Broadcasting
inviter The inviter of the intercom, that is, the username of String - N
the calling interface
groupNo Group number (only used when joining an existing String - N
broadcast group, not filled in by default, generated
by the server)
protocol Intercom protocol, 0-private protocol, 1-websocket Integer 0 N
sslOn Only valid when using websocket. 0-ws protocol, 1- Integer 1 N
wss protocol
● Response
Parameter Description Class
status Request result status value, success is 0. Please refer to the appendix return Integer
status code table for other values.
msg Error message description, only has a value when the status is not 0 String
data The data type is Object, see details in Table 5-4 Object

Table 5-4 Interphone response

Parameter Description Class


StreamUrl Intercom URL String
groupNo Group number String
devConnInfo JSON format data, detailed information can be found in Table 5-5 Object

Table 5-5 Device connection information

Parameter Description Class


addr Device connection address String

52
HAT Cloud Open API Developer Guide

recvPort Device connection port Integer


recvGUID Intercom GUID String

5.7 Text message distribution


● Introduction to Interface Functions
Send text message instructions to the device. It can be used for TTS reading and other functions.
● URI
GET /device/sendTextMsg
● Request Parameters
Parameter Description Class Default Required Notes
deviceCode Device terminal number, String - Y
not exceeding 12 digits
type The decimal byte 8 N details in Table
representation of the “Meaning of text
flag bit information flags”
textMessage Text content String Y

● Meaning of text information flags


Position Sign
0 1:Urgent
1 Reserved
2 1:Terminal display
3 1:Terminal TTS playback and reading
4 1:Advertising screen display
5 0: Center navigation information, 1: CAN fault code information
6-7 Reserved

53
HAT Cloud Open API Developer Guide

Note
If the third flag bit of the TTS broadcast read terminal is 1, then binary representation is 1000,
converted to decimal representation is 8, and the type parameter is filled with 8

● Response
Parameter Description Class Notes
status Request result status value, success is 0. Please refer to the Integer
appendix return status code table for other values.
msg Error message description, only has a value when the status is not String
0

● Response Example
{
"status": 0
}

5.8 Create video download task


● Introduction to Interface Functions
Create video download task. Notify the device to upload the specified video file to the server. You
need to first obtain the video list of the device during a certain time period through the
"device/videoList/" interface, and then use the corresponding parameters to call the
“download/create/” interface to download the video.

54
HAT Cloud Open API Developer Guide

Figure 5-2 Download video

● URI
GET /download/create
● Request Parameters
Parameter Description Class Default Required Notes
terminalID Device terminal number, not exceeding String - Y
12 digits
productKey Product key String - Y
channelNo Channel number, cannot be 0, start from Integer - Y
1
startTime Start Time in the device's time zone, String - Y
yyyy-MM-dd HH:mm:ss
endTime End Time in the device's time zone, yyyy- String - Y
MM-dd HH:mm:ss
storeType Memory type, 0: All 1: Main memory; 2: Integer 1 N
Disaster Recovery Memory
mediaType Video and audio type, 0: audio and Integer 2 N
video; 1: Audio; 2: Video
streamType Stream type, 0 main stream, 1 sub Integer 1 N
stream, default to 1
eventCode Event Code Long 0 N

55
HAT Cloud Open API Developer Guide

● Response
Parameter Description Class Notes
status Request result status value, success is 0. Please refer to the Integer
appendix return status code table for other values.
msg Error message description, only has a value when the status is not String
0
data download task id String

● Response Example
{
"status": 0,
"data": "upload_20254645851"
}

5.9 Create video download task (batch channel)


● Introduction to Interface Functions
Create video download tasks of batch channel.
● URI
GET /download/createBatchChannel
● Request Parameters
Parameter Description Class Default Required Notes
terminalID Device terminal number, not String - Y
exceeding 12 digits
productKey Product key String - Y
channelNoList List of channel numbers, start from 1 List<Integer> - Y
startTime Start Time in the device's time zone, String - Y
yyyy-MM-dd HH:mm:ss
endTime End Time in the device's time zone, String - Y
yyyy-MM-dd HH:mm:ss

56
HAT Cloud Open API Developer Guide

storeType Memory type, 0: All 1: Main memory; Integer 1 N


2: Disaster Recovery Memory
mediaType Video and audio type, 0: audio and Integer 2 N
video; 1: Audio; 2: Video
streamType Stream type, 0 main stream, 1 sub Integer 1 N
stream, default to 1
eventCode Event Code Long 0 N

● Response
Parameter Description Class Notes
status Request result status value, success is 0. Please refer Integer
to the appendix return status code table for other
values.
msg Error message description, only has a value when the String
status is not 0
data The data type in the returned data is Map. Key is the Map<Integer,String>
channel number. Value is the download task id

● Response Example
{
"status": 0,
"data": {
"1":"upload_20254645851",
"2":"upload_20254645935"
}
}

5.10 Delete video download task


● Introduction to Interface Functions
Delete video download task

57
HAT Cloud Open API Developer Guide

● URI
DELETE /download/delete
● Request Parameters
Parameter Description Class Default Required Notes
taskId download task id String - Y

● Response
Parameter Description Class Notes
status Request result status value, success is 0. Please refer to the Integer
appendix return status code table for other values.
msg Error message description, only has a value when the status is not String
0

● Response Example
{
"status": 0
}

5.11 Delete video download task (batch)


● Introduction to Interface Functions
Batch delete video download tasks. Only return status 0 when all tasks are successfully deleted.
● URI
DELETE /download/deleteBatch
● Request Parameters
Parameter Description Class Default Required Notes
taskIdList List of download task ids List< String > - Y

58
HAT Cloud Open API Developer Guide

● Response
Parameter Description Class Notes
status Request result status value, success is 0. Please refer to the Integer
appendix return status code table for other values.
msg Error message description, only has a value when the status is not String
0

● Response Example
{
"status": 0
}

5.12 Query video download task


● Introduction to Interface Functions
Query video download task status and url.
● URI
GET /download/query
● Request Parameters
Parameter Description Class Default Required Notes
taskId download task id String - Y

● Response
Parameter Description Class Notes
status Request result status value, success is 0. Please refer to the Integer
appendix return status code table for other values.
msg Error message description, only has a value when the status is not String
0
data The data type is Object, see details in Table 5-6 Object

59
HAT Cloud Open API Developer Guide

Table 5-6 Video Download Task Status

Parameter Description Class


downloadStatus Download status. Enum: 0-Downloading, 1-Success, 2-Faliure,3- Integer
Deleted, 4-Timeout. If the device does not reply success or faliure 30
minutes after the task is created, it is considered timeout.
errorMsg If the download fails, the reason for the failure String
downloadUrlList Download url List List
channelNo Channel number, start from 1 Integer
storeType Memory type, 0: All 1: Main memory; 2: Disaster Recovery Memory Integer
startTime Start Time in the device's time zone, yyyy-MM-dd HH:mm:ss Integer
endTime End Time in the device's time zone, yyyy-MM-dd HH:mm:ss Integer
mediaType Video and audio type, 0: audio and video; 1: Audio; 2: Video Integer
streamType Stream type, 0 main stream, 1 sub stream, default to 1 Integer

● Response Example
{
"status": 0,
"data": {
"downloadStatus": 0,
"downloadUrlList": ["[Link]
"channelNo":1,
"storeType":0,
"startTime": "2022-03-07 [Link]",
"endTime": "2022-03-07 [Link]",
"mediaType":2,
"streamType":0
}
}

60
HAT Cloud Open API Developer Guide

5.13 Query video download task (batch)


● Introduction to Interface Functions
Batch query video download task status and url. Only return status 0 when all tasks are successfully
queried.
● URI
GET /download/queryBatch
● Request Parameters
Parameter Description Class Default Required Notes
taskIdList List of download task ids List<String> - Y

● Response
Parameter Description Class Notes
status Request result status value, success is 0. Please refer to the Integer
appendix return status code table for other values.
msg Error message description, only has a value when the status is not String
0
data The data type in the returned data is Map. Key is the task id. Object
Value is Object, see details in Table 5-6

● Response Example
{
"status": 0,
"data": {"upload_20254645851":{
"downloadStatus": 0,
"downloadUrlList": ["[Link]
"channelNo":1,
"storeType":0,
"startTime": "2022-03-07 [Link]",
"endTime": "2022-03-07 [Link]",
"mediaType":2,

61
HAT Cloud Open API Developer Guide

"streamType":0
},
"upload_20254645935":{
"downloadStatus": 0,
"downloadUrlList": ["[Link]
"channelNo":1,
"storeType":0,
"startTime": "2022-03-07 [Link]",
"endTime": "2022-03-07 [Link]",
"mediaType":2,
"streamType":0
}
}
}

62
HAT Cloud Open API Developer Guide

Chapter 6 Message Subscription (webhook)

6.1 Webhook callback


● Introduction to Interface Functions
Webhook is a web custom callback entry that automatically calls the specified URL when some
behavior is triggered by the program. You can obtain the data reported by the device in real time
through webhook. The data includes GPS, online and offline, alarms, attachments, etc.
To ensure the quality of service, the timeout period set for each message push request is 2 seconds.
After the processing timeout, it is considered to have failed to send this message. The message will be
sent again using the retry mechanism. If the maximum number of retries fails(default 3 times), the
message will be discarded and will not be pushed again.
Even though we have a retry mechanism, the messages may still be lost due to the limited number of
retries. It is recommended that developers quickly write the push messages into their own message
queue after receiving them to improve the message receiving ability.

Figure 6-1 Subscribe by Webhook


● Request Method
HTTP POST

● Request Header
Field Description Default Notes

63
HAT Cloud Open API Developer Guide

X-Hikauto- signature of the - the customer verifies the signature after receiving
Signature message body the message, in order to ensure the message’s
origin. See the following Sample Codes for details.

● Request Body
Parameter Description Class Notes
messageType Message type String Consistent with the message type in the message
subscription, for example: EVENT(alarm message),
GPS(gps data message), etc.
content Message data in String For the detail field of each message type, refer to
JSON format Appendix-Subscription Message Data Fields
● Callback Address receiving template (JAVA)
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link].*;

import [Link];

@RequestMapping("/webhook")
@RestController
public class ReceiveController {

@RequestMapping(value = "/receiveData", method = {[Link]})


public ResponseEntity receiveData(@RequestHeader("X-Hikauto-Signature") String signature,
@RequestBody JSONObject param) {
try {
String content = [Link]("content");
//Signature method:signature=HMAC_SHA_256(data content string, accessSecret)
String checkSignature = new HmacUtils(HmacAlgorithms.HMAC_SHA_256, "your

64
HAT Cloud Open API Developer Guide

accessSecret").hmacHex(content);
if (![Link](signature, checkSignature)) {
[Link]("signature error.");
return new ResponseEntity(HttpStatus.BAD_REQUEST);
}
//todo: Process the received message.
// It is better to send it to other middleware or write it to the database,
// without affecting the processing of the callback address
String messageType = [Link]("messageType");
JSONObject jsonObject = [Link](content);
//Process the received message.

return new ResponseEntity([Link]);


} catch (Exception e) {
return new ResponseEntity(HttpStatus.BAD_REQUEST);
}
}
}

● Response
For a webhook push, if the http return code of the customer webhook service is 200, the push is
successful.

6.2 Register subscription


● Introduction to Interface Functions
Register the callback url for spacific message type.
● URI
GET /webhook/subscribe

65
HAT Cloud Open API Developer Guide

● Request Parameters
Defa Requi
Parameter Description Class Notes
ult red
messageTypeList Consistent with the message List<String> - Y For the full
type in the message list, please
subscription, for example: refer to
EVENT(alarm message), Message Type
GPS(gps data message), etc. Consistent
productKeyList Product key List<String> - Y
callbackUrl Full URL of the webhook String Y Multi-types
address, usually in the format of data will be
http(s)://hostname[:port]/path. pushed to the
The interface will verify same address
whether it can connect to this
address. If it cannot connect,
the subscription will fail.
● Message Type Consistent
Message Type Name Consistent
Gps Data GPS
Alarm message EVENT
Device Online/Offline DEVICE_STATE
Alarm attach UPLOAD_FILE_COMPLETE

● Parameter display
Signature=LlxZ1x47qHlBnS0id8jvMZjOBRs=&AccessKey=D_SUB_test_1734530550607&RegionId=cn-
hangzhou&SignatureMethod=HMAC-SHA1&SignatureNonce=b1464c58-548e-430e-80ff-
851dd80709cc&Timestamp=1753428072022&Version=2.1.0&callbackUrl=[Link]
ook/receiveData&messageTypeList=["DEVICE_STATE","GPS","EVENT"]&productKeyList=["808_D_SUB
_est_1734530550607"]

● Escaped parameters
Signature=LlxZ1x47qHlBnS0id8jvMZjOBRs%3D&AccessKey=D_SUB_test_1734530550607&RegionId=c
n-hangzhou&SignatureMethod=HMAC-SHA1&SignatureNonce=b1464c58-548e-430e-80ff-
851dd80709cc&Timestamp=1753428072022&Version=2.1.0&callbackUrl=https%3A%2F%2F1.1.1.1%3

66
HAT Cloud Open API Developer Guide

A4170%2Fwebhook%2FreceiveData&messageTypeList=%5B%22DEVICE_STATE%22%2C%22GPS%22%
2C%22EVENT%22%5D&productKeyList=%5B%22808_D_SUB_test_1734530550607%22%5D

● Response
Parameter Description Class Notes
status Request result status value, success is 0. Please refer to the Integer
appendix return status code table for other values.
msg Error message description, only has a value when the status is not String
0
● Response Example
{
"status": 0
}

Note
If you want to obtain alarm attachments, subscribe to UPLOAD_FILE_COMPLETE. Use the
“fileName” field from the response data to call the interface “media/download/” to obtain the file
download address.

Figure 6-2 Subscribe to alarm attachments

67
HAT Cloud Open API Developer Guide

6.3 Cancel subscription


● Introduction to Interface Functions
Cancel subscription for spacific message type. If you want to modify the callback url, you need to
unsubscribe first and then subscribe again.
● URI
GET /webhook/unsubscribe
● Request Parameters
Parameter Description Class Default Required Notes
messageTypeList Consistent with the List<String> - Y For the full list,
message type in the please refer to
message subscription, Message Type
for example: Consistent
EVENT(alarm message),
GPS(gps data message),
etc.
productKeyList Product key List<String> - Y

● Response
Parameter Description Class Notes
status Request result status value, success is 0. Please refer to the Integer
appendix return status code table for other values.
msg Error message description, only has a value when the status is not String
0

● Response Example
{
"status": 0
}

68
HAT Cloud Open API Developer Guide

6.4 Query subscribed message types


● Introduction to Interface Functions
Query subscribed message types
● URI
GET /webhook/getSubscribedType
● Request Parameters
Parameter Description Class Default Required Notes
productKey Product key List<String> - Y

● Response
Parameter Description Class Notes
status Request result status value, success is 0. Please refer to the Integer
appendix return status code table for other values.
msg Error message description, only has a value when the status is not String
0
data Subscription detail Object

Parameter Description Class Notes


developAccount developer Account String
webhookMessageTypes message type consistent list List<String>

● Response Example
{
"status": 0,
"data": [
{
"developAccount": "D_SUB_demo_123456789",
"webhookMessageTypes": [
"GPS"
]

69
HAT Cloud Open API Developer Guide

}
]
}

70
HAT Cloud Open API Developer Guide

Chapter 7 Device Maintenance (in planning)

7.1 Query peripheral type


● Introduction to Interface Functions
Query the defined peripheral device types
● URI
POST /maintenance/upgrade/peripheralType/list
● Request Parameters
No request parameter

● Response
Parameter Description Class
status Request result status value, success is 0. Please refer to the appendix return Integer
status code table for other values.
msg Error message description, only has a value when the status is not 0 String
data Response data Object
● Response Example
{
"status": 0,
"data": [
{
"code": "01",
"name": "comm model"
}
]
}

71
HAT Cloud Open API Developer Guide

7.2 Add upgarde file


● Introduction to Interface Functions
Synchronize upgrade files to the HAT cloud
● URI
POST /maintenance/upgrade/file/add
● Request Parameters
Parameter Description Class Default Required
deviceType device type:main/peripheral String - Y
deviceModel device model device type is “main”,which is String - N
[Link] type is “peripheral”,which is not
required.
peripheralType peripheral typedevice type is “peripheral”,which is String - N
[Link] 7.1 for peripheral device types
fileUrl Accessible upgrade file url String - Y
version upgrade file versionformat:V1.0.1 build250219 String - Y
remark upgrade file remark String - Y
● Response
Parameter Description Class
status Request result status value, success is 0. Please refer to the appendix return Integer
status code table for other values.
msg Error message description, only has a value when the status is not 0 String
● Response Example
{
"status": 0
}

7.3 Delete upgrade file


● Introduction to Interface Functions
Delete upgrade file

72
HAT Cloud Open API Developer Guide

● URI
POST /maintenance/upgrade/file/delete
● Request Parameters
Parameter Description Class Default Required
upgradeFileIds List of upgrade file record id List<Long> - Y

● Response
Parameter Description Class
status Request result status value, success is 0. Please refer to the appendix return Integer
status code table for other values.
msg Error message description, only has a value when the status is not 0 String
● Response Example
{
"status": 0
}

7.4 Query upgrade file


● Introduction to Interface Functions
Query upgrade file record
● URI
POST /maintenance/upgrade/file/list
● Request Parameters
Parameter Description Class Default Required
pageSize page size, ≥1 Intger 20 N
pageNo Current page number, ≥1 Intger 1 N
deviceType device type:main/peripheral String - Y
deviceModel device modeldevice type is “main”,which is String - N
[Link] type is “peripheral”,no need to fill
in.

73
HAT Cloud Open API Developer Guide

peripheralType peripheral typedevice type is “peripheral”,which is String - N


required.
remark upgrade file remark String - N
● Response
Parameter Description Class
status Request result status value, success is 0. Please refer to the appendix return Integer
status code table for other values.
msg Error message description, only has a value when the status is not 0 String
data Response data Object
● Response Example
{
"status": 0,
"data": [
{
"upgradeFileId": 1,
"createId": 1718,
"createName": "oms222",
"createTime": 1716688042000,
"deviceModel": "AE-VT7108B-GJ",
"downloadUrl": "[Link]
"fileName": "/aa/bb/cc/sdfdsfsd",
"fileSize": 5120,
"firmwareGuid": "",
"firmwareVersion": "V4.4.1 build240523",
"language": "CN",
"originalFileName": "[Link]",
"peripheralType": "00"
}
]
}

74
HAT Cloud Open API Developer Guide

7.5 Create upgrade tasks


● Introduction to Interface Functions
Create upgrade tasks
● URI
POST /maintenance/upgrade/tasks/add
● Request Parameters
Parameter Description Class Default Required
upgradeFileId upgrade file id Long - Y
equalNeedUpgrade Is the same version upgraded?0:Do not Integer - Y
upgrade1:Upgrade
deviceCodeList List of Terminal Numbers List<String> - Y

● Response
Parameter Description Class
status Request result status value, success is 0. Please refer to the appendix return Integer
status code table for other values.
msg Error message description, only has a value when the status is not 0 String
data Response data Object
● Response Example
{
"status": 0,
"data": {
"upgradeTaskId": 1
}
}

7.6 Query upgrade tasks


● Introduction to Interface Functions
Query upgrade tasks record

75
HAT Cloud Open API Developer Guide

● URI
POST /maintenance/upgrade/tasks/datail
● Request Parameters
Parameter Description Class Default Required
upgradeTaskId upgrade task id Long - Y

● Response
Parameter Description Class
status Request result status value, success is 0. Please refer to the appendix return Integer
status code table for other values.
msg Error message description, only has a value when the status is not 0 String
data Response data Object
● Response Example
{
"status": 0,
"data": {
"upgradeTaskId": 1,
"deviceModel": "AE-VT7108B-GJ",
"firmwareVersion": "V4.4.1 build240523",
"deviceList": [
{
"createTime": "1739954727000",
"deviceCode": "1*********6",
"deviceModel": "AE-MD5043-SD",
"deviceSerialNum": "K********3",
"originalVersion": "V5.9.0 build250218",
"currentVersion": "V5.9.0 build250219",
"sendCmdTime": 1739954730000,
/**
* upgrade state
* 1=Command not issued;
* 2=Command has been issued;

76
HAT Cloud Open API Developer Guide

* 3=Firmware writing completed;


* 4=Upgrade Successful;
* 5=Upgrade failed;
* 6=terminated;
*/
"upgradeState": 4,
"upgradeStateTime": 1739954834000,
"upgradeEndTime": 1739954834000
}
]
}
}

7.7 Terminate upgrade tasks


● Introduction to Interface Functions
Terminate all unfinished upgrade tasks
● URI
POST /maintenance/upgrade/tasks/terminateAll
● Request Parameters
Parameter Description Class Default Required
upgradeTaskId upgrade taskId id Long - Y

● Response
Parameter Description Class
status Request result status value, success is 0. Please refer to the appendix return Integer
status code table for other values.
msg Error message description, only has a value when the status is not 0 String
● Response Example
{
"status": 0

77
HAT Cloud Open API Developer Guide

7.8 Terminate upgrade tasks (specify device)


● Introduction to Interface Functions
Terminate the unfinished upgrade task of the specified device
● URI
POST /maintenance/upgrade/tasks/terminateSpecify
● Request Parameters
Parameter Description Class Default Required
upgradeTaskId upgrade taskId id Long - Y
deviceCodeList List of Terminal Numbers List<String> - Y

● Response
Parameter Description Class
status Request result status value, success is 0. Please refer to the appendix return Integer
status code table for other values.
msg Error message description, only has a value when the status is not 0 String
● Response Example
{
"status": 0
}

7.9 Retry upgrade tasks (all failed devices)


● Introduction to Interface Functions
Retry all failed upgrade tasks
● URI
POST /maintenance/upgrade/tasks/retryAll

78
HAT Cloud Open API Developer Guide

● Request Parameters
Parameter Description Class Default Required
upgradeTaskId upgrade taskId id Long - Y

● Response
Parameter Description Class
status Request result status value, success is 0. Please refer to the appendix return Integer
status code table for other values.
msg Error message description, only has a value when the status is not 0 String
● Response Example
{
"status": 0
}

7.10 Retry upgrade tasks (specify failed devices)


● Introduction to Interface Functions
Retry the failed upgrade task specified
● URI
POST /maintenance/upgrade/tasks/retrySpecify
● Request Parameters
Parameter Description Class Default Required
upgradeTaskId upgrade taskId id Long - Y
deviceCodeList List of Terminal Numbers List<String> - Y

● Response
Parameter Description Class
status Request result status value, success is 0. Please refer to the appendix return Integer
status code table for other values.
msg Error message description, only has a value when the status is not 0 String

79
HAT Cloud Open API Developer Guide

● Response Example
{
"status": 0
}

7.11 Query device parameters


● Introduction to Interface Functions
Obtain specified parameter information for online devices
● URI
POST /maintenance/config/getParams
● Request Parameters
Parameter Description Class Default Required
deviceCode Device terminal number, not exceeding 12 digits String - Y
commandIds Command set for querying device List<String> - Y
parametersParameter . see Device Parameter
Protocol [Link]

● Response
Parameter Description Class
status Request result status value, success is 0. Please refer to the appendix return Integer
status code table for other values.
msg Error message description, only has a value when the status is not 0 String
data Response datareturn data . see Device Parameter Protocol [Link] . Object
● Response Example
{
"status": 0,
"data":
"{\"IsApiSpeedingOthers\":{\"subStatusCode\":\"\",\"statusString\":\"\",\"overSpeedAlarmWarningV
alue\":100,\"overSpeedDurationTime\":30,\"maxSpeed\":100,\"platformId\":0,\"type\":1,\"channelId
\":\"\",\"url\":\"/JT808/0/0x8106\",\"statusCode\":\"\"}}"

80
HAT Cloud Open API Developer Guide

7.12 Create cofiguration tasks


● Introduction to Interface Functions
Create cofiguration tasks
● URI
POST /maintenance/config/tasks/add
● Request Parameters
Parameter Description Class Default Required
deviceCodeList List of Terminal Numbers List<String> - Y
configParams JSON format array,the format of a single JSON List<Object> - Y
object is shown in Table 7-1

Table 7-1 ConfigParams List Parameter Details

Parameter Description Class Default Required


commandId device parameters command see Device Parameter String - Y
Protocol [Link]
configParam device parameters see Device Parameter Protocol String - Y
[Link]
● Response
Parameter Description Class
status Request result status value, success is 0. Please refer to the appendix return Integer
status code table for other values.
msg Error message description, only has a value when the status is not 0 String
data Response data Object
● Response Example
{
"status": 0,

81
HAT Cloud Open API Developer Guide

"data": {
"configTaskId": 1
}
}

7.13 Query configuration tasks


● Introduction to Interface Functions
Query configuration tasks record
● URI
POST /maintenance/config/tasks/datail
● Request Parameters
Parameter Description Class Default Required
configTaskId configuration task id Long - Y

● Response
Parameter Description Class
status Request result status value, success is 0. Please refer to the appendix return Integer
status code table for other values.
msg Error message description, only has a value when the status is not 0 String
data Response data Object
● Response Example
{
"status": 0,
"data": {
"configTaskId": 1,
"deviceList": [
{
"createTime": "1739954727000",
"deviceCode": "15957281606",
"deviceModel": "AE-MD5043-SD",

82
HAT Cloud Open API Developer Guide

"deviceSerialNum": "K85250293",
/**
* config state
* 0=Command not issued;
* 1=Config Successful;
* 2=Config failed;
*/
"configState": 1,
"configStateTime": 1739954834000,
"failReason": ""
}
]
}
}

7.14 Terminate configuration tasks


● Introduction to Interface Functions
Terminate all unfinished configuration tasks
● URI
POST /maintenance/config/tasks/terminateAll
● Request Parameters
Parameter Description Class Default Required
configTaskId configuration taskId id Long - Y

● Response
Parameter Description Class
status Request result status value, success is 0. Please refer to the appendix return Integer
status code table for other values.
msg Error message description, only has a value when the status is not 0 String
● Response Example

83
HAT Cloud Open API Developer Guide

{
"status": 0
}

7.15 Terminate configuration tasks (specify device)


● Introduction to Interface Functions
Terminate the unfinished configuration task of the specified device
● URI
POST /maintenance/config/tasks/terminateSpecify
● Request Parameters
Parameter Description Class Default Required
configTaskId configuration taskId id Long - Y
deviceCodeList List of Terminal Numbers List<String> - Y

● Response
Parameter Description Class
status Request result status value, success is 0. Please refer to the appendix return Integer
status code table for other values.
msg Error message description, only has a value when the status is not 0 String
● Response Example
{
"status": 0
}

7.16 Retry configuration tasks (all failed devices)


● Introduction to Interface Functions
Retry all failed configuration tasks

84
HAT Cloud Open API Developer Guide

● URI
POST /maintenance/config/tasks/retryAll
● Request Parameters
Parameter Description Class Default Required
configTaskId configuration taskId id Long - Y

● Response
Parameter Description Class
status Request result status value, success is 0. Please refer to the appendix return Integer
status code table for other values.
msg Error message description, only has a value when the status is not 0 String
● Response Example
{
"status": 0
}

7.17 Retry configuration tasks (specify failed devices)


● Introduction to Interface Functions
Retry the failed configuration task specified
● URI
POST /maintenance/upgrade/tasks/retrySpecify
● Request Parameters
Parameter Description Class Default Required
configTaskId upgrade taskId id Long - Y
deviceCodeList List of Terminal Numbers List<String> - Y

● Response
Parameter Description Class

85
HAT Cloud Open API Developer Guide

status Request result status value, success is 0. Please refer to the appendix return Integer
status code table for other values.
msg Error message description, only has a value when the status is not 0 String
● Response Example
{
"status": 0
}

86
HAT Cloud Open API Developer Guide

Appendix

Complete Signature Demo Code


 Java
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];

import [Link];
import [Link];
import [Link];
import [Link];
import [Link];

public class SdkTest {

private static final String ACCESS_KEY = "ACCESS_KEY";


private static final String ACCESS_SECRET = "ACCESS_SECRET";
private static final String SIGNATURE_METHOD = "HMAC-SHA1";
private static final String DEFAULT_CHARSET = "UTF-8";
private static final String REGION_ID = "cn-hangzhou";
private static final String VERSION = "2.1.0";

87
HAT Cloud Open API Developer Guide

private static final String BASE_URL = "[Link]

private static TreeMap<String, String> getBaseParams() throws UnsupportedEncodingException {


Map<String, String> params = [Link]();
[Link]("SignatureMethod", SIGNATURE_METHOD);
[Link]("SignatureNonce", [Link]().toString());
[Link]("AccessKey", ACCESS_KEY);
[Link]("Timestamp", [Link]([Link]()));
[Link]("Version", VERSION);
[Link]("RegionId", REGION_ID);
TreeMap<String, String> sortParas = [Link]();
[Link](params);
return sortParas;
}

public static String sign(String accessSecret, TreeMap<String, String> params, HttpMethod method)
throws Exception {
String stringToSign = getStringToSign(params, method);
[Link]("StringToSign = [" + stringToSign + "]");
[Link] mac = [Link]("HmacSHA1");
[Link](new [Link]([Link](DEFAULT_CHARSET),
"HmacSHA1"));
byte[] signData = [Link]([Link](DEFAULT_CHARSET));
return new [Link].BASE64Encoder().encode(signData);
}

private static String getStringToSign(TreeMap<String, String> params, HttpMethod method) throws


Exception {
StringBuilder sortQueryStringTmp = new StringBuilder();
for([Link]<String, String> entry : [Link]()){
[Link]("&").append(specialUrlEncode([Link]())).append("=").appe
nd(specialUrlEncode([Link]()));
}

88
HAT Cloud Open API Developer Guide

StringBuilder stringToSign = new StringBuilder();


[Link]([Link]()).append("&").append(specialUrlEncode("/")).append("&"
).append(specialUrlEncode([Link](1)));
return [Link]();
}

public static String specialUrlEncode(String value) throws Exception {


return [Link](value, "UTF-8").replace("+", "%20").replace("*",
"%2A").replace("%7E", "~");
}

public static void main(String[] args) throws Exception {


String url = BASE_URL + "device/preview/";
TreeMap<String, String> BASE_PARAMS = getBaseParams();
BASE_PARAMS.put("deviceCode", "deviceCode");
StringBuilder sortQueryStringTmp = new StringBuilder();
for([Link]<String, String> entry : BASE_PARAMS.entrySet()){
sortQueryStringTmp
.append("&")
.append(specialUrlEncode([Link]()))
.append("=")
.append(specialUrlEncode([Link]()));
}
//Corresponding to HttpGet below, using [Link]
String sign = sign(ACCESS_SECRET + "&", BASE_PARAMS, [Link]);
url += "?Signature=" + specialUrlEncode(sign) + [Link]();
CloseableHttpClient httpClient = [Link]().build();

HttpGet httpDelete = new HttpGet(url);


CloseableHttpResponse response = [Link](httpDelete);
[Link]([Link]([Link]()));
}
}

89
HAT Cloud Open API Developer Guide

 C#
using System;
using [Link];
using [Link];
using [Link];
using [Link];
using [Link];
using [Link];
using [Link];
using [Link];
using [Link];

namespace Demo
{
public class Demo
{
private const string ACCESS_KEY = "testKey";
private const string ACCESS_SECRET = "testSecret";
private const string SIGNATURE_METHOD = "HMAC-SHA1";
private const string DEFAULT_CHARSET = "UTF-8";
private const string REGION_ID = "cn-hangzhou";
private const string VERSION = "2.1.0";
private const string BASE_URL = "[Link]

public static async Task Main()


{
string url = BASE_URL + "/protocol/query";
var BASE_PARAMS = getBaseParams();
string sign = sign(ACCESS_SECRET + "&", BASE_PARAMS, [Link]);
var sortQueryStringTmp = new StringBuilder();
foreach (var param in BASE_PARAMS)
{

[Link]("&").Append(specialUrlEncode([Link])).Append("=").Append(specia

90
HAT Cloud Open API Developer Guide

lUrlEncode([Link]));
}
string finalUrl = url + "?Signature=" + specialUrlEncode(sign) + [Link]();
using var client = new HttpClient();
HttpResponseMessage response = await [Link](finalUrl);
string content = await [Link]();
[Link](content);
}

private static SortedDictionary<string, string> getBaseParams()


{
return new SortedDictionary<string, string>([Link])
{
{ "SignatureMethod", SIGNATURE_METHOD },
{ "SignatureNonce", [Link]().ToString() },
{ "AccessKey", ACCESS_KEY },
{ "Timestamp", [Link]().ToString() },
{ "Version", VERSION },
{ "RegionId", REGION_ID }
};
}

private static string sign(string accessSecret, SortedDictionary<string, string> parameters,


HttpMethod method)
{
string stringToSign = getStringToSign(parameters, method);
using var hmac = new HMACSHA1([Link](accessSecret));
byte[] hash = [Link]([Link](stringToSign));
return Convert.ToBase64String(hash);
}

private static string getStringToSign(SortedDictionary<string, string> parameters, HttpMethod


method)
{

91
HAT Cloud Open API Developer Guide

var sortQueryString = new StringBuilder();


foreach (var param in parameters)
{

[Link]("&").Append(specialUrlEncode([Link])).Append("=").Append(specialUrlE
ncode([Link]));
}
return
$"{[Link]}&{specialUrlEncode("/")}&{specialUrlEncode([Link]().TrimStart
('&'))}";
}

private static string specialUrlEncode(string value)


{
return [Link]([Link]).Encode(value).Replace("+", "%20").Replace("*",
"%2A").Replace("%7E", "~");
}
}
}

 Python 3
import requests
import json
import time
import uuid
import hmac
import hashlib
import base64
import [Link]
import unittest
import socket
from [Link] import quote

class HATCloudAPITest():

92
HAT Cloud Open API Developer Guide

base_url = "[Link]
access_key = "testKey"
access_secret = "testSecret"
product_key = ""

def setUp(self):
[Link] = [Link]()
[Link]({
"Content-Type": "application/json",
"Accept": "application/json"
})

def special_url_encode(self, value):


if isinstance(value, (list, dict)):
value = [Link](value)
else:
value = str(value)

encoded = [Link](value, safe="")


encoded = [Link]("+", "%20")
encoded = [Link]("*", "%2A")
encoded = [Link]("%7E", "~")
return encoded

def generate_signature(self, params, method="GET"):


if "Signature" in params:
del params["Signature"]

sorted_params = sorted([Link]())
canonicalized_query_string = ""
for key, value in sorted_params:
canonicalized_query_string += "&" + self.special_url_encode(key) + "=" +
self.special_url_encode(value)

93
HAT Cloud Open API Developer Guide

canonicalized_query_string = canonicalized_query_string[1:]

string_to_sign = method + "&" + self.special_url_encode("/") + "&" + self.special_url_encode(


canonicalized_query_string)

key = self.access_secret + "&"


signature = base64.b64encode(
[Link]([Link]("utf-8"), string_to_sign.encode("utf-8"), hashlib.sha1).digest()
).decode("utf-8")

params["Signature"] = signature
encoded_params = []
for key, value in sorted([Link]()):
encoded_params.append(f"{self.special_url_encode(key)}={self.special_url_encode(value)}")

return "&".join(encoded_params)

def get_common_params(self):
return {
"AccessKey": self.access_key,
"SignatureMethod": "HMAC-SHA1",
"SignatureNonce": str(uuid.uuid4()),
"Timestamp": str(int([Link]() * 1000)),
"RegionId": "cn-hangzhou",
"Version": "2.1.0"
}

def make_request(self, method, endpoint, params=None, data=None):


try:
if not hasattr(self, 'session') or [Link] is None:
[Link]()

url = self.base_url + endpoint


common_params = self.get_common_params()

94
HAT Cloud Open API Developer Guide

if params:
common_params.update(params)

if [Link]() == "GET":
encoded_params = self.generate_signature(common_params, method)
url = f"{url}?{encoded_params}"
print(f"DEBUG - Full Request URL: {url}")
response = [Link](url)
elif [Link]() == "POST":
encoded_params = self.generate_signature(common_params, method)
url = f"{url}?{encoded_params}"
print(f"DEBUG - Full Request URL: {url}")
response = [Link](url)
elif [Link]() == "DELETE":
encoded_params = self.generate_signature(common_params, method)
url = f"{url}?{encoded_params}"
print(f"DEBUG - Full Request URL: {url}")
response = [Link](url)
else:
raise ValueError(f"Unsupported HTTP method: {method}")

return response
except Exception as e:
print(f"Request failed: {e}")
raise

def test_list_device_protocols(self):
response = self.make_request("GET", "/protocol/query/")
print(response.status_code, [Link])

def test_list_devices(self):
response = self.make_request(
"GET",

95
HAT Cloud Open API Developer Guide

"/device/list/",
params={
"productKey": self.product_key,
"pageSize": 10,
"pageNo": 1
}
)
print(response.status_code, [Link])

def test_add_devices(self):
response = self.make_request(
"POST",
"/device/add/",
params={"deviceList": [Link](self.DEVICE_LIST)}
)
print(response.status_code, [Link])

DEVICE_LIST = [
{
"terminalID": "12345678910",
"productKey": self.product_key,
"language": "EN",
"deviceModel": "AE-AC1130-A",
"deviceName": "TEST1",
"deviceChannelList": [
{
"channelNum": 1,
"channelType": 0,
"channelName": "CH1"
}
]
}
]

96
HAT Cloud Open API Developer Guide

URL encoding
Character Encoding
space %20
! %21
" %22
# %23
$ %24
% %25
& %26
' %27
( %28
) %29
* %2A
+ %2B
, %2C
/ %2F
: %3A
; %3B
< %3C
= %3D
> %3E
? %3F
@ %40
[ %5B
\ %5C
] %5D
^ %5E
` %60
{ %7B
| %7C
} %7D

Return status code

97
HAT Cloud Open API Developer Guide

Code Definition Common reasons


0 Normal Service request responds normally
1 Operation failed
2 Request parameter Required parameter passed as empty or value out of range
error
3 Permission Device has no usage permission (device not added or device does
verification failed not exist). Or the signature is incorrect
4 Device Unavailable Device is in sleep or offline mode
400 Incorrect request Request method mismatch or parameter type mismatch
404 Request address does Access address does not exist
not exist
500 Server Error The server has encountered an unknown error or is temporarily
unavailable

Code msg
1 service_unavailable
1 data_query_failed
1 get_preview_url_failed
1 get_record_url_failed
1 send_text_msg_failed
1 send_text_msg_timeout
1 request_timeout
1 get_video_list_failed
1 get_record_list_failed
1 get_image_list_failed
1 upload_failed
1 call_interface_failed
2 device_param_error
2 device_param_empty
2 device_code_invalid
2 param_illegal
2 channel_param_illegal
2 page_param_invalid
2 date_param_invalid
2 stream_type_param_invalid

98
HAT Cloud Open API Developer Guide

2 net_type_param_invalid
2 stream_protocol_param_invalid
2 store_type_param_invalid
2 param_invalid
2 speed_must_be_greater_than_zero
2 speed_out_of_range
2 get_preview_url_param_invalid
2 parse_time_error
2 resolution_param_error
2 quality_param_error
2 brightness_param_error
2 hues_param_error
2 saturation_param_error
2 contrast_param_error
2 no_this_task
2 add_device_num_limit_1000
2 callback_url_not_start_with_http
2 callback_url_invalid
2 host_and_port_cannot_reach
3 device_access_denied
3 product_key_access_denied
4 device_offline
4 device_sleep
4 device_unsupported

Subscription Message Data Fields


 EVENT (Alarm message)
{
"deviceCode":"String terminalID. This is the accurate deviceCode.",
"productKey":"String pk",
"type":"Integer Alarm Catagory",
"state":"Integer Alarm flag status 0x00:Instant 0x01:Start 0x02:End",
"subType":"Integer Alarm Type",
"level":"Integer Alarm level 0x01:Warning 0x02:Alarm",

99
HAT Cloud Open API Developer Guide

"frontCarSpeed":"Integer Front car speed Km/h",


"frontDistance":"Integer Vehicle/pedestrian distance in front (meter)",
"deviationType":"Integer Lane departure type 0x01:Left 0x02:Right",
"roadSignsType":"Integer Type of traffic sign 0x01:Speed limit 0x02:Hight limit 0x03:Weight limit",
"roadSignsValue":"Integer Traffic sign value",
"speed":"Integer speed Km/h",
"altitude":"Short altitude m",
"longitude":"Double longitude",
"latitude":"Double latitude",
"time":"String Alarm Reporting time in the device's time zone, yyyy-MM-dd HH:mm:ss",
"utcTime":"String Alarm Reporting time in the UTC+0 time zone, yyyy-MM-dd HH:mm:ss",
"accState":"Integer ACC status",
"leftTurnState":"Integer Left turn indicator, 0:Off, 1:On",
"rightTurnState":"Integer Right turn indicator, 0:Off, 1:On",
"wiperState":"Integer Wiper status, 0:Off, 1:On",
"brakingState":"Integer brake status, 0:unbraked, 1:brake",
"cardState":"Integer IC Card status, 0:unplugged, 1:plugged",
"gpsValid":"Integer gps Valid, 0:invalid, 1:valid",
"deviceId":"String Device id. This is inaccurate and should not be used",
"alarmSignTime":"String Alarm identification time in the device's time zone, yyMMddHHmmss",
"index":"Integer index",
"attachCount":"Integer Attach count",
"alarmSign":"String AlarmSign,unique",
"fatigueDegree":"Integer Fatigue degree, [1,10]",
"color":"Integer Plate No. color",
"areaType":"Integer Area type",
"areaId":"Integer Area Id",
"efcType":"Integer e-fence type, 0:Entry; 1: Exit",
"tirePressureInfo":"TirePressureInfo Tire pressure information",
"qualificationNumber":"String Driver ID",
"alarmSignVo":"AlarmSignVo Alarm sign. The 'deviceCode' field is inaccurate and should not be
used",
"deviceAttachInfoVoList":"List<DeviceAttachInfo> Attach information",
"gpsData":"GpsData GPS",

100
HAT Cloud Open API Developer Guide

"chanNo":"Integer Channel number",


"xAxis":"Short X-axis",
"yAxis":"Short Y-axis",
"temperatureState":"Short Temperature
bit0 for temperature immediate valueState above/below zero ,0:above, 1:below,
bit1 for temperature threshold valueState above/below zero ,0:above, 1:below,
bit2~bit15:reserved",
"temperatureImmediateValueState":"Integer temperature immediate value",
"temperatureThresholdState":"Integer temperature threshold value",
"temperatureThreshold":"Double temperature threshold, 1/10℃, unit:℃",
"temperatureImmediateValue":"Double temperature immediate value, 1/10℃, unit:℃",
"alarmAttribute":"Integer Temperature alarm attribute
bit0:The immediate value is greater than the temperature threshold
bit1:The immediate value is less than the temperature threshold
bit2~bit7:reserved",
"alarmAttributeState":"Integer Temperature alarm attribute status",
"vehicleStatusNum":"Short Vehicle status bit",
"jt808Attach72Vo":"JT808Attach72Vo Associated attachment information",
"duration":"Integer Alarm duration, in seconds",
"accelerationThresholdValue":"Short Indicates the acceleration threshold triggered by an alarm,
unit:m/s²,This field is valid when subType equals 0x01, 0x02, 0x03, when 0x02 indicates reverse
acceleration",
"accelerationImmediateValue":"Short Indicates the acceleration Immediate triggered by an alarm,
unit:m/s²,This field is valid when subType equals 0x01, 0x02, 0x03, when 0x02 indicates reverse
acceleration",
"angleThresholdValue":"Short Alarm Angle Threshold is the current value Deflection Angle
triggered by the rollover alarm This field is valid when the alarm type is 0x04, unit:minite(1/60
degree)",
"angleImmediateValue":" Short Alarm Angle is the immediate Angle at which the rollover alarm is
triggered This field is valid if the alarm type is 0x04, unit:minite(1/60 degree)",
"cardType":"Byte Document type",
"cardCode":"String Certificate number",
"carBodyPositionList":"List<CarBodyPositionVoEnum> car position list",
"videoAlarmVo":"VideoAlarmVo Video alarm",

101
HAT Cloud Open API Developer Guide

"videoChannelStatus":"List<Integer> 1-32 logical channel number states, where 1 indicates an


exception",
"mainStorageStatus":"List<Integer> 1-12 Main memory state, where 1 indicates an exception",
"subStorageStatus":"List<Integer> 1-4 submemory states, where 1 indicates an exception",
"signalIntensity":"Byte Signal strength",
"totalMileage":"Double Total mileage, vehicle odometer mileage, in Km",
"remainingOilValue":"Double The remaining oil, in L",
"remainingOilPercentage":"Integer Oil remaining, percentage",
"averageFuelConsumption":"Double Average fuel consumption, L/100km",
"gnssSatellitesNum":"Integer Number of GNSS positioning satellites",
"reqParam":"List<ReqParamVo> ",
"carChangeStateType":"Integer Vehicle status change flag, 0x00: idling weight 0x01: idling weight",
"sensitiveWord":"String Sensitive words",
"humidity":"Double humidity, RH",
"outTemperature":"Double Temperature, ℃",
"co2":"Short Carbon dioxide concentration, ppm",

//Above fields are from parent class JT808EventInfoData

"attachFlag":"Boolean Alert attachment flag, which is set to true to indicate that the message is an
attachment message ",
"attachInfo":"DownloadFileUrl Alarm attachment information. This field is valid when attachFlag is
true.",
"efcName":"String E-fence name",
"efcUuid":"String E-fence uuid",
"efcEventInfo":"EFCEventInfo E-fence Alarm details",
"limitState":"Integer limit(1:No entry;2:No exit:3:Lane departure)",
"position":"String position",
"moveState":"Integer Move state, 0:Stopped, 1:Runing",
"mcuVersion":"String MCU version",
"voltage":"Integer Battery voltage, *1000",
"temperature":"Integer Device temperature, *1000",
"wakeupType":"Integer Wakeup type",
"Tvistatus":"Integer Tvi status",

102
HAT Cloud Open API Developer Guide

"LTEpower":"Integer LTE power",


"LTEstatus":"Integer LTE status",
"parkmode":"Integer Park mode",
"uploadType":"Integer Upload type",
"stayTime":"Integer Duration of stay, measured in minutes ",
"stayId":"Long Stay point Id",
"faceRecognitionData":"FaceRecognitionData Face recognition data",
"faceAttendanceData":"FaceAttendanceData Face attendance data",
"abnormalReportingEventData":"AbnormalReportingEventData abnormal reporting event data",
"faceComparisonResultsReportData":"FaceComparisonResultsReportData Driver comparison
results Data"}

 DownloadFileUrl
{
"uploadState":"boolean Upload status",
"url":"String Url address",
"fileType":"Integer File type 0-jpg, 1-png, 2-wav, 3-mp4, 4-h264[A1] , 5-h265",
"fileSize":"Integer File size, in bytes",
"fileName":"String File name",
"uuid":"String uuid",
"alarmSignVo":"AlarmSignVo alarmSign",
"reason":"String Error code",
"totalNum":" Integer Total number",
"successNum":"Integer Success number",
"fileNameList":"List<String> File name list"
}

 EFCEventInfo

{
"overSpeed":"Boolean Speed or not",
"distance":"Double Distance (must be if type is line)",
"deviation":"Boolean Whether to deviate (must be if type is line)",

103
HAT Cloud Open API Developer Guide

"segmentInfo":"SegmentInfo Calculated vehicle route (must be if type is line)",


"gpsData":"GpsData GPS"
}

 DeviceAttachInfo

{
"fileId":"Integer File Id in ISU",
"fileType":"Integer File type 0-jpg, 1-png, 2-wav, 3-mp4, 4-h254, 5-h265",
"size":"Integer File size",
"channelNo":"Integer Channel number",
"fileName":"String File name"
}

 FaceRecognitionData

{
"result":"Integer Comparison result, 0: successful 1: failed",
"type":"Integer Business type 0: Facial check-in 1: Dynamic job search",
"similarityDegree":"Integer The similarity comparison is represented by 0-100, in %. The larger the
data value, the higher the matching degree. Valid when the comparison result is 0",
"score":"Integer The facial score is expressed as 0~100, in %. The larger the data value, the more
reliable it is for the face. Valid when the comparison result is 0",
"time":"String Reporting time in the device's time zone, yyyy-MM-dd HH:mm:ss",
"cardType":"Integer Certificate type, 0-Professional Qualification Certificate, 1-ID Card",
"cardNum":"String Card number",
"name":"String Personnel Name",
"driverID":"String Driver ID",
"channelNo":"Integer Channel number"
}

 UPLOAD_FILE_COMPLETE(Alarm attach)

104
HAT Cloud Open API Developer Guide

{
"uploadState":"boolean Upload status",
"url":"String Url address",
"fileType":"Integer File type 0-jpg, 1-png, 2-wav, 3-mp4, 4-h264[A1] , 5-h265",
"fileSize":"Integer File size, in bytes",
"fileName":"String File name",
"uuid":"String uuid",
"alarmSignVo":"AlarmSignVo alarmSign",
"reason":"String Error code",
"totalNum":" Integer Total number",
"successNum":"Integer Success number",
"fileNameList":"List<String> File name list"
}

 GPS(Gps data)
{
"messageSequence":"Integer message sequence",
"productKey":"String productKey",
"deviceSequence":"String deviceCode/terminalID",
"terminalPhoneNo":"String phone number",
"alarmStatusNum":"int Alarm status digit",
"vehicleStatusNum":"int Vehicle status digit",
"alarmStatus":"AlarmStatus Alarm status",
"vehicleStatus":"VehicleStatus Vehicle status",
"gpsValid":"Integer gps Valid, 0:invalid, 1:valid",
"divisionEW":"String E: East longitude, W: West longitude",
"divisionNS":"String N: North latitude, S: south latitude ",
"estimatedTime":"Long Estimated arrival time",
"autoDrive":"Integer Auto drive or not, 1: Yes 0: No",
"longitude":"Double longitude",
"latitude":"Double latitude",
"altitude":"Double altitude",
"speed":"Double speed",
"direction":"int Direction Angle (heading), 0~359, unit degree, 0 for true north, clockwise ",

105
HAT Cloud Open API Developer Guide

"collectTime":"String GPS reporting time in the device's time zone, yyyy-MM-dd HH:mm:ss ",
"utcTime":"String GPS reporting time in the UTC+0 time zone, yyyy-MM-dd HH:mm:ss ",
"plateNumber":"String Related car plate No.",
"t808EventDataList":"List<T808EventData> Additional information from 808 protocol",
"positionSignalStrength":"Integer Positioning signal strength",
"satelliteNum":"Integer Number of satellites",
"accStatus":"String ACC status",
"totalMileage":"Double Total mileage",
"supplementSign":"int 1: supplementary, 0: normal ",
"eventList":"List<EventInfo>"
}

Note
You can obtain the direction of longitude and latitude through vehicleStatusNum

// 0 means EAST longitude, 1 means WEST longitude


int divisionEW = getBinaryDigit(vehicleStatusNum, 3);
// 0 means NORTH Latitude, 1means SOUTH Latitude
int divisionNS = getBinaryDigit(vehicleStatusNum, 2);

/**
* Obtain the value of a binary digit based on its number of digits
*
* @param num:The number to obtain binary values
* @param index:The last digit is 0, and so on
*/
public static int getBinaryDigit(int num, int index) {
return (num & (0x1 << index)) >> index;
}

106
HAT Cloud Open API Developer Guide

 DEVICE_STATE(Device Online/Offline)

{
"status":"Integer Online status, 0: offline, 1: online, 2: sleep",
"time":"String Update time in the UTC+0 time zone, yyyy-MM-dd HH:mm:ss"
}

Alarm Catagory
Alarm Alarm Type
Alarm Catagory (subtype Notes
(type) )
Speed -30 8 Valid field: areaType、areaId
Alarm(Device e-
fence)
Entry/exit -30 2 Valid field: areaType、areaId、efcType、
area(Device e- alarmSignVo、alarmSign
fence)
Driver attendance -30 11 Valid field: state、faceAttendanceData、
alarmSignVo、alarmSign、attachCount
IC card -30 11 Valid field: state、faceAttendanceData、uuid
attendance
Driver -30 10 Valid field: state、faceRecognitionData、
comparison result alarmSignVo、alarmSign、attachCount
Special exception -30 12 Valid field: state、
alarm abnormalReportingEventDataList、alarmSign
mileage -30 100 Valid field: state、alarmSign
FCW 100 1 Valid field: level、frontCarSpeed、frontDistance、
deviationType、roadSignsType、roadSignsValue、
speed、altitude、latitude、longitude、time、

107
HAT Cloud Open API Developer Guide

accState、leftTurnState、rightTurnState、
wiperState、brakingState、cardState、gpsValid 、
alarmSignVo、attachCount
LDW 100 2 Valid field: level、frontCarSpeed、frontDistance、
deviationType、roadSignsType、roadSignsValue、
speed、altitude、latitude、longitude、time、
accState、leftTurnState、rightTurnState、
wiperState、brakingState、cardState、gpsValid 、
alarmSignVo、attachCount
Car approaching 100 3 Valid field: level、frontCarSpeed、frontDistance、
alarm deviationType、roadSignsType、roadSignsValue、
speed、altitude、latitude、longitude、time、
accState、leftTurnState、rightTurnState、
wiperState、brakingState、cardState、gpsValid 、
alarmSignVo、attachCount
PCW 100 4 Valid field: level、frontCarSpeed、frontDistance、
deviationType、roadSignsType、roadSignsValue、
speed、altitude、latitude、longitude、time、
accState、leftTurnState、rightTurnState、
wiperState、brakingState、cardState、gpsValid 、
alarmSignVo、attachCount
Frequent lane 100 5 Valid field: level、frontCarSpeed、frontDistance、
change alarm deviationType、roadSignsType、roadSignsValue、
speed、altitude、latitude、longitude、time、
accState、leftTurnState、rightTurnState、
wiperState、brakingState、cardState、gpsValid 、
alarmSignVo、attachCount
Road sign 100 6 Valid field: level、frontCarSpeed、frontDistance、
exceeding limit deviationType、roadSignsType、roadSignsValue、
alarm speed、altitude、latitude、longitude、time、
accState、leftTurnState、rightTurnState、
wiperState、brakingState、cardState、gpsValid 、
alarmSignVo、attachCount

108
HAT Cloud Open API Developer Guide

Road signs 100 16 Valid field: level、frontCarSpeed、frontDistance、


overspeeding deviationType、roadSignsType、roadSignsValue、
alarm speed、altitude、latitude、longitude、time、
accState、leftTurnState、rightTurnState、
wiperState、brakingState、cardState、gpsValid 、
alarmSignVo、attachCount
Actively capture 100 17 Valid field: level、frontCarSpeed、frontDistance、
events deviationType、roadSignsType、roadSignsValue、
speed、altitude、latitude、longitude、time、
accState、leftTurnState、rightTurnState、
wiperState、brakingState、cardState、gpsValid 、
alarmSignVo、attachCount
Pedestrian 100 19 Valid field: level、frontCarSpeed、frontDistance、
detection in deviationType、roadSignsType、roadSignsValue、
carriage aisle speed、altitude、latitude、longitude、time、
accState、leftTurnState、rightTurnState、
wiperState、brakingState、cardState、gpsValid 、
alarmSignVo、attachCount
LDW(right) 100 20 Valid field: level、frontCarSpeed、frontDistance、
deviationType、roadSignsType、roadSignsValue、
speed、altitude、latitude、longitude、time、
accState、leftTurnState、rightTurnState、
wiperState、brakingState、cardState、gpsValid 、
alarmSignVo、attachCount
LDW(left) 100 21 Valid field: level、frontCarSpeed、frontDistance、
deviationType、roadSignsType、roadSignsValue、
speed、altitude、latitude、longitude、time、
accState、leftTurnState、rightTurnState、
wiperState、brakingState、cardState、gpsValid 、
alarmSignVo、attachCount
FCTA 100 30 Valid field: level、frontCarSpeed、frontDistance、
deviationType、roadSignsType、roadSignsValue、
speed、altitude、latitude、longitude、time、
accState、leftTurnState、rightTurnState、

109
HAT Cloud Open API Developer Guide

wiperState、brakingState、cardState、gpsValid 、
alarmSignVo、attachCount
Speed Alarm 100 31 Valid field: level、frontCarSpeed、frontDistance、
deviationType、roadSignsType、roadSignsValue、
speed、altitude、latitude、longitude、time、
accState、leftTurnState、rightTurnState、
wiperState、brakingState、cardState、gpsValid 、
alarmSignVo、attachCount
Zebra crossing 100 32 Valid field: level、frontCarSpeed、frontDistance、
speeding deviationType、roadSignsType、roadSignsValue、
speed、altitude、latitude、longitude、time、
accState、leftTurnState、rightTurnState、
wiperState、brakingState、cardState、gpsValid 、
alarmSignVo、attachCount
Failure to yield to 100 33 Valid field: level、frontCarSpeed、frontDistance、
pedestrians deviationType、roadSignsType、roadSignsValue、
speed、altitude、latitude、longitude、time、
accState、leftTurnState、rightTurnState、
wiperState、brakingState、cardState、gpsValid 、
alarmSignVo、attachCount
Illegal traffic 100 34 Valid field: level、frontCarSpeed、frontDistance、
occupation deviationType、roadSignsType、roadSignsValue、
speed、altitude、latitude、longitude、time、
accState、leftTurnState、rightTurnState、
wiperState、brakingState、cardState、gpsValid 、
alarmSignVo、attachCount
Running red lights 100 35 Valid field: level、frontCarSpeed、frontDistance、
deviationType、roadSignsType、roadSignsValue、
speed、altitude、latitude、longitude、time、
accState、leftTurnState、rightTurnState、
wiperState、brakingState、cardState、gpsValid 、
alarmSignVo、attachCount
Fatigue driving 101 1 Valid field: level、fatigueDegree、speed、
alarm altitude、latitude、longitude、accState、
leftTurnState、rightTurnState、wiperState、

110
HAT Cloud Open API Developer Guide

brakingState、cardState、gpsValid、
attachCount、alarmSignVo、alarmSign
Cellphone use 101 2 Valid field: level、fatigueDegree、speed、
detection altitude、latitude、longitude、accState、
leftTurnState、rightTurnState、wiperState、
brakingState、cardState、gpsValid、
attachCount、alarmSignVo、alarmSign
Smoking alarm 101 3 Valid field: level、fatigueDegree、speed、
altitude、latitude、longitude、accState、
leftTurnState、rightTurnState、wiperState、
brakingState、cardState、gpsValid、
attachCount、alarmSignVo、alarmSign
Distracted driving 101 4 Valid field: level、fatigueDegree、speed、
alarm/yawning altitude、latitude、longitude、accState、
leftTurnState、rightTurnState、wiperState、
brakingState、cardState、gpsValid、
attachCount、alarmSignVo、alarmSign
Driver abnormal 101 5 Valid field: level、fatigueDegree、speed、
alarm(including altitude、latitude、longitude、accState、
leaving) leftTurnState、rightTurnState、wiperState、
brakingState、cardState、gpsValid、
attachCount、alarmSignVo、alarmSign
Camera shield 101 6 Valid field: level、fatigueDegree、speed、
altitude、latitude、longitude、accState、
leftTurnState、rightTurnState、wiperState、
brakingState、cardState、gpsValid、
attachCount、alarmSignVo、alarmSign
Driver face 101 9 Valid field: level、fatigueDegree、speed、
recognization altitude、latitude、longitude、accState、
leftTurnState、rightTurnState、wiperState、
brakingState、cardState、gpsValid、
attachCount、alarmSignVo、alarmSign
Seat belt 101 17 Valid field: level、fatigueDegree、speed、
detection altitude、latitude、longitude、accState、
leftTurnState、rightTurnState、wiperState、

111
HAT Cloud Open API Developer Guide

brakingState、cardState、gpsValid、
attachCount、alarmSignVo、alarmSign
Seat belt 101 10 Valid field: level、fatigueDegree、speed、
detection altitude、latitude、longitude、accState、
(technical leftTurnState、rightTurnState、wiperState、
vehicle) brakingState、cardState、gpsValid、
attachCount、alarmSignVo、alarmSign
Infrared blocking 101 11 Valid field: level、fatigueDegree、speed、
sunglasses altitude、latitude、longitude、accState、
leftTurnState、rightTurnState、wiperState、
brakingState、cardState、gpsValid、
attachCount、alarmSignVo、alarmSign
Hands off the 101 18 Valid field: level、fatigueDegree、speed、
wheel(Double altitude、latitude、longitude、accState、
hands) leftTurnState、rightTurnState、wiperState、
brakingState、cardState、gpsValid、
attachCount、alarmSignVo、alarmSign
Hands off the 101 13 Valid field: level、fatigueDegree、speed、
wheel(Single altitude、latitude、longitude、accState、
hand) leftTurnState、rightTurnState、wiperState、
brakingState、cardState、gpsValid、
attachCount、alarmSignVo、alarmSign
Not wearing a 101 14 Valid field: level、fatigueDegree、speed、
helmet altitude、latitude、longitude、accState、
leftTurnState、rightTurnState、wiperState、
brakingState、cardState、gpsValid、
attachCount、alarmSignVo、alarmSign
Automatic 101 16 Valid field: level、fatigueDegree、speed、
capture altitude、latitude、longitude、accState、
leftTurnState、rightTurnState、wiperState、
brakingState、cardState、gpsValid、
attachCount、alarmSignVo、alarmSign
Door closing 101 29 Valid field: level、fatigueDegree、speed、
altitude、latitude、longitude、accState、
leftTurnState、rightTurnState、wiperState、

112
HAT Cloud Open API Developer Guide

brakingState、cardState、gpsValid、
attachCount、alarmSignVo、alarmSign
Door opening 101 30 Valid field: level、fatigueDegree、speed、
altitude、latitude、longitude、accState、
leftTurnState、rightTurnState、wiperState、
brakingState、cardState、gpsValid、
attachCount、alarmSignVo、alarmSign
Cellphone use 101 31 Valid field: level、fatigueDegree、speed、
detection altitude、latitude、longitude、accState、
leftTurnState、rightTurnState、wiperState、
brakingState、cardState、gpsValid、
attachCount、alarmSignVo、alarmSign
Drunk driving 101 32 Valid field: level、fatigueDegree、speed、
altitude、latitude、longitude、accState、
leftTurnState、rightTurnState、wiperState、
brakingState、cardState、gpsValid、
attachCount、alarmSignVo、alarmSign
Drink Driving 101 33 Valid field: level、fatigueDegree、speed、
altitude、latitude、longitude、accState、
leftTurnState、rightTurnState、wiperState、
brakingState、cardState、gpsValid、
attachCount、alarmSignVo、alarmSign
Multiple face 101 48 Valid field: level、fatigueDegree、speed、
alarm altitude、latitude、longitude、accState、
leftTurnState、rightTurnState、wiperState、
brakingState、cardState、gpsValid、
attachCount、alarmSignVo、alarmSign
Closed eyes alarm 101 34 Valid field: level、fatigueDegree、speed、
altitude、latitude、longitude、accState、
leftTurnState、rightTurnState、wiperState、
brakingState、cardState、gpsValid、
attachCount、alarmSignVo、alarmSign
AEB-F 101 101 Valid field: level、fatigueDegree、speed、
altitude、latitude、longitude、accState、
leftTurnState、rightTurnState、wiperState、

113
HAT Cloud Open API Developer Guide

brakingState、cardState、gpsValid、
attachCount、alarmSignVo、alarmSign
Without a mask 101 100 Valid field: level、fatigueDegree、speed、
altitude、latitude、longitude、accState、
leftTurnState、rightTurnState、wiperState、
brakingState、cardState、gpsValid、
attachCount、alarmSignVo、alarmSign
Tire pressure 103 Valid field: state、speed、altitude、latitude、
alarm longitude、accState、leftTurnState、
rightTurnState、wiperState、brakingState、
cardState、gpsValid、attachCount、
tirePressureInfo
Rear approach 102 1 Valid field: state、speed、altitude、latitude、
alarm longitude、accState、leftTurnState、
rightTurnState、wiperState、brakingState、
cardState、gpsValid、attachCount
Left rear 102 2 Valid field: state、speed、altitude、latitude、
approach alarm longitude、accState、leftTurnState、
rightTurnState、wiperState、brakingState、
cardState、gpsValid、attachCount
Right rear 102 3 Valid field: state、speed、altitude、latitude、
approach alarm longitude、accState、leftTurnState、
rightTurnState、wiperState、brakingState、
cardState、gpsValid、attachCount
Forward 102 4 Valid field: state、speed、altitude、latitude、
approach alarm longitude、accState、leftTurnState、
rightTurnState、wiperState、brakingState、
cardState、gpsValid、attachCount
Suspected illegal 102 5 Valid field: state、speed、altitude、latitude、
water injection longitude、accState、leftTurnState、
alarm rightTurnState、wiperState、brakingState、
cardState、gpsValid、attachCount
Front ultrasonic 102 238 Valid field: state、speed、altitude、latitude、
alarm longitude、accState、leftTurnState、

114
HAT Cloud Open API Developer Guide

rightTurnState、wiperState、brakingState、
cardState、gpsValid、attachCount
Rear ultrasonic 102 239 Valid field: state、speed、altitude、latitude、
alarm longitude、accState、leftTurnState、
rightTurnState、wiperState、brakingState、
cardState、gpsValid、attachCount
Emergency alarm 102 240 Valid field: state、speed、altitude、latitude、
longitude、accState、leftTurnState、
rightTurnState、wiperState、brakingState、
cardState、gpsValid、attachCount
Rapid 104 1 Valid field: state、level、duration、
acceleration accelerationThresholdValue、
accelerationImmediateValue、
angleThresholdValue、angleImmediateValue、
speed、altitude、latitude、longitude、
vehicleStatusNum、attachCount、alarmSignVo、
alarmSign
Rapid 104 2 Valid field: state、level、duration、
deceleration accelerationThresholdValue、
accelerationImmediateValue、
angleThresholdValue、angleImmediateValue、
speed、altitude、latitude、longitude、
vehicleStatusNum、attachCount、alarmSignVo、
alarmSign
Collision 104 3 Valid field: state、level、duration、
accelerationThresholdValue、
accelerationImmediateValue、
angleThresholdValue、angleImmediateValue、
speed、altitude、latitude、longitude、
vehicleStatusNum、attachCount、alarmSignVo、
alarmSign
Flip over 104 4 Valid field: state、level、duration、
accelerationThresholdValue、
accelerationImmediateValue、
angleThresholdValue、angleImmediateValue、

115
HAT Cloud Open API Developer Guide

speed、altitude、latitude、longitude、
vehicleStatusNum、attachCount、alarmSignVo、
alarmSign
Sharp left turn 104 5 Valid field: state、level、duration、
accelerationThresholdValue、
accelerationImmediateValue、
angleThresholdValue、angleImmediateValue、
speed、altitude、latitude、longitude、
vehicleStatusNum、attachCount、alarmSignVo、
alarmSign
Sharp right turn 104 6 Valid field: state、level、duration、
accelerationThresholdValue、
accelerationImmediateValue、
angleThresholdValue、angleImmediateValue、
speed、altitude、latitude、longitude、
vehicleStatusNum、attachCount、alarmSignVo、
alarmSign
Sharp turn 104 7 Valid field: state、level、duration、
accelerationThresholdValue、
accelerationImmediateValue、
angleThresholdValue、angleImmediateValue、
speed、altitude、latitude、longitude、
vehicleStatusNum、attachCount、alarmSignVo、
alarmSign
Severe 104 255 Valid field: state、level、duration、
turbulence accelerationThresholdValue、
accelerationImmediateValue、
angleThresholdValue、angleImmediateValue、
speed、altitude、latitude、longitude、
vehicleStatusNum、attachCount、alarmSignVo、
alarmSign
Temperature 170 Valid field: state、xAxis、yAxis、
measurement temperatureState、
alarm temperatureImmediateValueState、
temperatureThresholdState、
temperatureThreshold、

116
HAT Cloud Open API Developer Guide

temperatureImmediateValue、alarmAttribute、
alarmAttributeState、speed、altitude、latitude、
longitude、vehicleStatusNum、jt808Attach72Vo、
alarmSignVo、alarmSign
Driver ID 163 163 Valid field: cardType、cardCode
Right turn 238 1 Valid field: alarmId、state、speed、altitude、
overspeed latitude、longitude、vehicleStatusNum、
accState、leftTurnState、rightTurnState、
wiperState、brakingState、cardState、gpsValid、
attachCount、alarmSignVo、alarmSign
Turn right 238 2 Valid field: alarmId、state、speed、altitude、
without stopping latitude、longitude、vehicleStatusNum、
accState、leftTurnState、rightTurnState、
wiperState、brakingState、cardState、gpsValid、
attachCount、alarmSignVo、alarmSign
Lifting event 172 1 Valid field: state、level、speed、altitude、
latitude、longitude、accState、leftTurnState、
rightTurnState、wiperState、brakingState、
cardState、gpsValid、attachCount、
alarmSignVo、alarmSign
Closed event 172 2 Valid field: state、level、speed、altitude、
latitude、longitude、accState、leftTurnState、
rightTurnState、wiperState、brakingState、
cardState、gpsValid、attachCount、
alarmSignVo、alarmSign
Load event 172 3 Valid field: state、level、speed、altitude、
latitude、longitude、accState、leftTurnState、
rightTurnState、wiperState、brakingState、
cardState、gpsValid、attachCount、
alarmSignVo、alarmSign
Forward blind 249 (0xF9) 1 Valid field: state、level、duration、speed、
spot braking altitude、latitude、longitude、accState、
leftTurnState、rightTurnState、wiperState、
brakingState、cardState、gpsValid、
gearPosition、barrierType、barrierDistance、

117
HAT Cloud Open API Developer Guide

turn、millimeterRadarStatus、
ultraSonicRadarStatus、deviceExtraStatus、
attachCount、alarmSignVo、alarmSign
Rear blind spot 249 2 Valid field: state、level、duration、speed、
braking altitude、latitude、longitude、accState、
leftTurnState、rightTurnState、wiperState、
brakingState、cardState、gpsValid、
gearPosition、barrierType、barrierDistance、
turn、millimeterRadarStatus、
ultraSonicRadarStatus、deviceExtraStatus、
attachCount、alarmSignVo、alarmSign
Front ultrasonic 249 3 Valid field: state、level、duration、speed、
braking altitude、latitude、longitude、accState、
leftTurnState、rightTurnState、wiperState、
brakingState、cardState、gpsValid、
gearPosition、barrierType、barrierDistance、
turn、millimeterRadarStatus、
ultraSonicRadarStatus、deviceExtraStatus、
attachCount、alarmSignVo、alarmSign
Rear ultrasonic 249 4 Valid field: state、level、duration、speed、
braking altitude、latitude、longitude、accState、
leftTurnState、rightTurnState、wiperState、
brakingState、cardState、gpsValid、
gearPosition、barrierType、barrierDistance、
turn、millimeterRadarStatus、
ultraSonicRadarStatus、deviceExtraStatus、
attachCount、alarmSignVo、alarmSign
Left blind spot 249 5 Valid field: state、level、duration、speed、
braking altitude、latitude、longitude、accState、
leftTurnState、rightTurnState、wiperState、
brakingState、cardState、gpsValid、
gearPosition、barrierType、barrierDistance、
turn、millimeterRadarStatus、
ultraSonicRadarStatus、deviceExtraStatus、
attachCount、alarmSignVo、alarmSign

118
HAT Cloud Open API Developer Guide

Right blind spot 249 6 Valid field: state、level、duration、speed、


braking altitude、latitude、longitude、accState、
leftTurnState、rightTurnState、wiperState、
brakingState、cardState、gpsValid、
gearPosition、barrierType、barrierDistance、
turn、millimeterRadarStatus、
ultraSonicRadarStatus、deviceExtraStatus、
attachCount、alarmSignVo、alarmSign
AEB-F 249 7 Valid field: state、level、duration、speed、
altitude、latitude、longitude、accState、
leftTurnState、rightTurnState、wiperState、
brakingState、cardState、gpsValid、
gearPosition、barrierType、barrierDistance、
turn、millimeterRadarStatus、
ultraSonicRadarStatus、deviceExtraStatus、
attachCount、alarmSignVo、alarmSign
BSD-F 249 21 Valid field: state、level、duration、speed、
altitude、latitude、longitude、accState、
leftTurnState、rightTurnState、wiperState、
brakingState、cardState、gpsValid、
gearPosition、barrierType、barrierDistance、
turn、millimeterRadarStatus、
ultraSonicRadarStatus、deviceExtraStatus、
attachCount、alarmSignVo、alarmSign
BSD-R 249 22 Valid field: state、level、duration、speed、
altitude、latitude、longitude、accState、
leftTurnState、rightTurnState、wiperState、
brakingState、cardState、gpsValid、
gearPosition、barrierType、barrierDistance、
turn、millimeterRadarStatus、
ultraSonicRadarStatus、deviceExtraStatus、
attachCount、alarmSignVo、alarmSign
Front ultrasonic 249 23 Valid field: state、level、duration、speed、
warning altitude、latitude、longitude、accState、
leftTurnState、rightTurnState、wiperState、

119
HAT Cloud Open API Developer Guide

brakingState、cardState、gpsValid、
gearPosition、barrierType、barrierDistance、
turn、millimeterRadarStatus、
ultraSonicRadarStatus、deviceExtraStatus、
attachCount、alarmSignVo、alarmSign
Rear ultrasonic 249 24 Valid field: state、level、duration、speed、
warning altitude、latitude、longitude、accState、
leftTurnState、rightTurnState、wiperState、
brakingState、cardState、gpsValid、
gearPosition、barrierType、barrierDistance、
turn、millimeterRadarStatus、
ultraSonicRadarStatus、deviceExtraStatus、
attachCount、alarmSignVo、alarmSign
BSD-Left 249 25 Valid field: state、level、duration、speed、
altitude、latitude、longitude、accState、
leftTurnState、rightTurnState、wiperState、
brakingState、cardState、gpsValid、
gearPosition、barrierType、barrierDistance、
turn、millimeterRadarStatus、
ultraSonicRadarStatus、deviceExtraStatus、
attachCount、alarmSignVo、alarmSign
BSD-Right 249 26 Valid field: state、level、duration、speed、
altitude、latitude、longitude、accState、
leftTurnState、rightTurnState、wiperState、
brakingState、cardState、gpsValid、
gearPosition、barrierType、barrierDistance、
turn、millimeterRadarStatus、
ultraSonicRadarStatus、deviceExtraStatus、
attachCount、alarmSignVo、alarmSign
AEB-F 249 27 Valid field: state、level、duration、speed、
altitude、latitude、longitude、accState、
leftTurnState、rightTurnState、wiperState、
brakingState、cardState、gpsValid、
gearPosition、barrierType、barrierDistance、
turn、millimeterRadarStatus、

120
HAT Cloud Open API Developer Guide

ultraSonicRadarStatus、deviceExtraStatus、
attachCount、alarmSignVo、alarmSign
Actively report 160 0 Valid field: speed、altitude、latitude、
alarm events longitude、accState、leftTurnState、
rightTurnState、wiperState、brakingState、
cardState、gpsValid、pumperEventCount、
pumperEventList
Inspection report 160 1 Valid field: speed、altitude、latitude、
event longitude、accState、leftTurnState、
rightTurnState、wiperState、brakingState、
cardState、gpsValid、pumperEventCount、
pumperEventList
Emergency alarm 25 1 Valid field: state、alarmSubType、level、
qualificationNumber、attachCount、
alarmSignVo、alarmSign
Emergency alarm -32 0 Valid field: state、alarmSignVo、uuid、
createType、recorderSpeed、speed
Speed Alarm -32 16 Valid field: state、alarmSignVo、uuid、
createType、recorderSpeed、speed
Fatigue driving -32 32 Valid field: state、alarmSignVo、uuid、
createType、recorderSpeed、speed
Danger Warning -32 33 Valid field: state、alarmSignVo、uuid、
createType、recorderSpeed、speed
GNSS module -32 2 Valid field: state、alarmSignVo、uuid、
fault createType、recorderSpeed、speed
GNSS Antenna -32 3 Valid field: state、alarmSignVo、uuid、
not connected createType、recorderSpeed、speed
GNSS Antenna -32 4 Valid field: state、alarmSignVo、uuid、
short circuit createType、recorderSpeed、speed
Terminal main -32 5 Valid field: state、alarmSignVo、uuid、
power createType、recorderSpeed、speed
undervoltage
Terminal main -32 6 Valid field: state、alarmSignVo、uuid、
power down createType、recorderSpeed、speed

121
HAT Cloud Open API Developer Guide

LCD or display -32 7 Valid field: state、alarmSignVo、uuid、


failure createType、recorderSpeed、speed
TTS module -32 46 Valid field: state、alarmSignVo、uuid、
failure createType、recorderSpeed、speed
Camera failure -32 9 Valid field: state、alarmSignVo、uuid、
createType、recorderSpeed、speed
IC card module -32 34 Valid field: state、alarmSignVo、uuid、
failure createType、recorderSpeed、speed
Overspeed -32 43 Valid field: state、alarmSignVo、uuid、
warning createType、recorderSpeed、speed
Fatigue driving -32 35 Valid field: state、alarmSignVo、uuid、
warning createType、recorderSpeed、speed
Illegal driving -32 45 Valid field: state、alarmSignVo、uuid、
alarm(2019) createType、recorderSpeed、speed
Tire -32 44 Valid field: state、alarmSignVo、uuid、
pressure(2019) createType、recorderSpeed、speed
Cumulative -32 18 Valid field: state、alarmSignVo、uuid、
driving overtime createType、recorderSpeed、speed
for the day
Parking over time -32 19 Valid field: state、alarmSignVo、uuid、
createType、recorderSpeed、speed
Entry and exit -32 20 Valid field: state、alarmSignVo、uuid、
area createType、recorderSpeed、speed
Entry and exit -32 20 Valid field: state、alarmSignVo、uuid、
route createType、recorderSpeed、speed
Insufficient/exces -32 21 Valid field: state、alarmSignVo、uuid、
sive driving time createType、recorderSpeed、speed
on the road
LDW -32 36 Valid field: state、alarmSignVo、uuid、
createType、recorderSpeed、speed
Vehicle VSS -32 37 Valid field: state、alarmSignVo、uuid、
failure createType、recorderSpeed、speed

122
HAT Cloud Open API Developer Guide

Abnormal fuel -32 38 Valid field: state、alarmSignVo、uuid、


level of the createType、recorderSpeed、speed
vehicle
Stolen vehicle -32 39 Valid field: state、alarmSignVo、uuid、
createType、recorderSpeed、speed
Illegal start of -32 24 Valid field: state、alarmSignVo、uuid、
vehicle createType、recorderSpeed、speed
Illegal -32 25 Valid field: state、alarmSignVo、uuid、
displacement of createType、recorderSpeed、speed
vehicle
Collision alarm -32 40 Valid field: state、alarmSignVo、uuid、
createType、recorderSpeed、speed
Rollover warning -32 41 Valid field: state、alarmSignVo、uuid、
createType、recorderSpeed、speed
Illegal door -32 42 Valid field: state、alarmSignVo、uuid、
opening alarm createType、recorderSpeed、speed

123
HAT Cloud Open API Developer Guide

Revision Records
● V1.0.0
Time:2024/12/09
1. Define the initial draft of the document

● V1.0.1
Time:2025/01/09
1. Correct the field name of AccessKeyId to be AccessKey

● V1.1.0
Time:2025/01/10
1. Add Message subscription (webhook) 2. Remove deprecated interfaces

● V1.1.1
Time:2025/01/15
1. Discard interface “List device models”
2. Add interface “List device protocols”

● V1.2.0
Time:2025/01/15
1. Add interface “Video Download Task”
2. Add interface “Device Maintenance”

● V1.2.1

124
HAT Cloud Open API Developer Guide

Time:2025/03/28
1. Add interface “Synchronize facial information”
2. Add interface “Distribute facial change information”

● V1.2.2
Time:2025/04/28
1. Add interface “Confirm emergency alarm”
2. Add interface “Set speed threshold”

● V1.2.3
Time:2025/09/04
1. Added new parameter “timeZone” to interface “Add Devices” and “Edit devices”
2. Add some descriptions

125
HAT Cloud Open API Developer Guide

126

You might also like