AK/SK + Token Header
7 days (refreshable)
5 requests/second
JSON
Standard Response Format
{
"errorCode": "0",
"message": "success",
"data": {
// Response data here
}
}Quick Start Guide
Get a live camera stream working in 5 steps
Get Credentials
Obtain your appKey and secretKey from the HikCentral Connect portal.
Get Access Token
POST to /api/hccgw/platform/v1/token/get with your appKey + secretKey. Use the returned accessToken in the Token header for all subsequent requests.
Important: The auth header is Token: your_access_token (NOT Bearer). This is a custom header specific to HikConnect.
Get Stream Token
GET /api/hccgw/platform/v1/streamtoken/get to receive appToken and streamAreaDomain. These are needed for the video player.
Get EZOPEN URL
POST to /api/hccgw/video/v1/live/address/get with resourceId, deviceSerial, type: "1", protocol: "1". Returns an EZOPEN URL.
Play with EZUIKit
Initialize the EZUIKit player with the EZOPEN URL, appToken as accessToken, and streamAreaDomain as env.domain. See the EZUIKit section below.
EZUIKit Integration
Play EZOPEN video streams in the browser using the EZUIKit JS SDK
Why EZUIKit is Required
Encrypted cameras (most modern Hikvision devices) return error EVZ60019 when you request HLS or FLV streams. The ONLY working protocol for encrypted streams is EZOPEN, which requires the EZUIKit SDK to play in a browser.
Installation
npm install ezuikit-js
Import (Named Export)
import { EZUIKitPlayer } from 'ezuikit-js'Player Constructor
const player = new EZUIKitPlayer({
id: 'video-container', // DOM element id (must exist)
accessToken: appToken, // From streamtoken/get API
url: ezopenUrl, // EZOPEN URL from video API
env: {
domain: streamAreaDomain, // CRITICAL - see warning below
},
template: 'pcLive', // 'pcLive' for live, 'pcRec' for playback
width: 640,
height: 360,
})CRITICAL: env.domain Must Match Your Region
If you don't set env.domain, EZUIKit defaults to the Chinese server (https://open.ys7.com) and your streams will fail silently. Always use the streamAreaDomain value returned by the stream token API.
| Region | Example Domain |
|---|---|
| North/South America | https://isgpopen.ezvizlife.com |
| Europe | https://ieuopen.ezvizlife.com |
| China (default - wrong for international) | https://open.ys7.com |
Templates
| Template | Use Case | Controls |
|---|---|---|
pcLive | Live streaming | Play, stop, sound, fullscreen |
pcRec | Recording playback | Play, pause, seek, speed, fullscreen |
simple | Video only (no controls) | None |
Fullscreen API
// Enter fullscreen await player.fullScreen() // Cleanup when done player.destroy()
Getting Started
Authentication and basic setup
Get Access Token
/api/hccgw/platform/v1/token/getObtain an access token using your AK/SK credentials. The token is valid for 7 days and can be refreshed.
- Rate limit: 5 requests per second
- Token validity: 7 days
- Refresh the token before expiration to maintain access
Request Parameters
| Name | Type | Required | Description |
|---|---|---|---|
appKey | string | Required | Application Key provided by HikCentral Connect |
secretKey | string | Required | Secret Key provided by HikCentral Connect |
Response Parameters
| Name | Type | Required | Description |
|---|---|---|---|
accessToken | string | Required | Access token for API authentication |
expireTime | string | Required | Token expiration time (ISO 8601 format) |
Example
const response = await fetch('https://ius.hikcentralconnect.com/api/hccgw/platform/v1/token/get', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
},
body: JSON.stringify({
appKey: 'your_app_key',
secretKey: 'your_secret_key',
}),
})
const data = await response.json()
if (data.errorCode === '0') {
const accessToken = data.data.accessToken
const expireTime = data.data.expireTime
console.log('Token obtained:', accessToken)
} else {
console.error('Error:', data.message)
}Refresh Access Token
/api/hccgw/platform/v1/token/refreshRefresh an existing access token to extend its validity period.
Request Parameters
| Name | Type | Required | Description |
|---|---|---|---|
accessToken | string | Required | Current access token to refresh |
Response Parameters
| Name | Type | Required | Description |
|---|---|---|---|
accessToken | string | Required | New access token |
expireTime | string | Required | New expiration time |
Example
const response = await fetch('https://ius.hikcentralconnect.com/api/hccgw/platform/v1/token/refresh', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'Token': accessToken,
},
body: JSON.stringify({
accessToken: currentToken,
}),
})
const data = await response.json()
const newToken = data.data.accessTokenSystem Services
System information and user management
Get System Properties
/api/hccgw/platform/v1/systempropertiesRetrieve system properties and configuration information.
Response Parameters
| Name | Type | Required | Description |
|---|---|---|---|
version | string | Required | System version |
timezone | string | Required | Server timezone |
language | string | Required | System language |
Example
const response = await fetch('https://ius.hikcentralconnect.com/api/hccgw/platform/v1/systemproperties', {
method: 'GET',
headers: {
'Token': accessToken,
},
})
const data = await response.json()
console.log('System version:', data.data.version)
console.log('Timezone:', data.data.timezone)Get Service Package Info
/api/hccgw/platform/v1/servicepackageGet information about the current service package and its capabilities.
Response Parameters
| Name | Type | Required | Description |
|---|---|---|---|
packageName | string | Required | Name of the service package |
maxDevices | number | Required | Maximum number of devices allowed |
features | array | Required | List of enabled features |
Example
const response = await fetch('https://ius.hikcentralconnect.com/api/hccgw/platform/v1/servicepackage', {
method: 'GET',
headers: {
'Token': accessToken,
},
})
const data = await response.json()
console.log('Package:', data.data.packageName)
console.log('Max devices:', data.data.maxDevices)Get Streaming Token
/api/hccgw/platform/v1/streamtoken/getObtain credentials for video streaming via EZUIKit. Returns appKey, appToken (used as accessToken in EZUIKit player), and the regional stream server domain.
- appToken is different from the API access token - it is specifically for video streaming
- streamAreaDomain MUST be set in EZUIKit env.domain or streams will fail
- Default domain (open.ys7.com) is for China only - international accounts must use the returned domain
Response Parameters
| Name | Type | Required | Description |
|---|---|---|---|
appKey | string | Required | Application key for EZUIKit SDK |
appToken | string | Required | Access token for EZUIKit player (use as accessToken param) |
streamAreaDomain | string | Required | Regional video server domain (e.g., https://isgpopen.ezvizlife.com). MUST match your region. |
Example
const response = await fetch('https://ius.hikcentralconnect.com/api/hccgw/platform/v1/streamtoken/get', {
method: 'GET',
headers: {
'Token': accessToken,
},
})
const data = await response.json()
const { appKey, appToken, streamAreaDomain } = data.data
// appToken is used as the accessToken for EZUIKit player
// streamAreaDomain is the regional video server domain
console.log('Stream domain:', streamAreaDomain)Get Users
/api/hccgw/platform/v1/users/getRetrieve a list of users with optional filtering.
Request Parameters
| Name | Type | Required | Description |
|---|---|---|---|
pageNo | number | Optional | Page number (starts from 1)(Default: 1) |
pageSize | number | Optional | Number of items per page(Default: 20) |
userName | string | Optional | Filter by username |
Response Parameters
| Name | Type | Required | Description |
|---|---|---|---|
total | number | Required | Total number of users |
list | array | Required | Array of user objects |
Example
const response = await fetch('https://ius.hikcentralconnect.com/api/hccgw/platform/v1/users/get', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'Token': accessToken,
},
body: JSON.stringify({
pageNo: 1,
pageSize: 20,
}),
})
const data = await response.json()
console.log('Total users:', data.data.total)
data.data.list.forEach(user => {
console.log(user.userName)
})Resource Services
Device, area, and camera management
Add Device
/api/hccgw/resource/v1/devices/addRegister a new device to the platform.
Request Parameters
| Name | Type | Required | Description |
|---|---|---|---|
deviceName | string | Required | Name for the device |
deviceSerial | string | Required | Device serial number |
validateCode | string | Required | Device validation code |
areaId | string | Optional | Area ID to assign the device |
Response Parameters
| Name | Type | Required | Description |
|---|---|---|---|
deviceId | string | Required | Unique identifier of the added device |
Example
const response = await fetch('https://ius.hikcentralconnect.com/api/hccgw/resource/v1/devices/add', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'Token': accessToken,
},
body: JSON.stringify({
deviceName: 'Front Door Camera',
deviceSerial: 'DS-2CD2143G2-I-ABC123',
validateCode: 'ABCDEF',
areaId: 'area_001',
}),
})
const data = await response.json()
const deviceId = data.data.deviceId
console.log('Device added:', deviceId)Update Device
/api/hccgw/resource/v1/devices/updateUpdate device information.
Request Parameters
| Name | Type | Required | Description |
|---|---|---|---|
deviceId | string | Required | Device ID to update |
deviceName | string | Optional | New device name |
areaId | string | Optional | New area assignment |
Example
const response = await fetch('https://ius.hikcentralconnect.com/api/hccgw/resource/v1/devices/update', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'Token': accessToken,
},
body: JSON.stringify({
deviceId: 'device_001',
deviceName: 'Updated Camera Name',
areaId: 'area_002',
}),
})
const data = await response.json()
console.log('Device updated:', data.errorCode === '0')Get Devices
/api/hccgw/resource/v1/devices/getRetrieve a list of registered devices.
Request Parameters
| Name | Type | Required | Description |
|---|---|---|---|
pageNo | number | Optional | Page number(Default: 1) |
pageSize | number | Optional | Items per page(Default: 20) |
areaId | string | Optional | Filter by area |
deviceName | string | Optional | Filter by device name |
Response Parameters
| Name | Type | Required | Description |
|---|---|---|---|
total | number | Required | Total device count |
list | array | Required | Array of device objects |
Example
const response = await fetch('https://ius.hikcentralconnect.com/api/hccgw/resource/v1/devices/get', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'Token': accessToken,
},
body: JSON.stringify({
pageNo: 1,
pageSize: 20,
areaId: 'area_001',
}),
})
const data = await response.json()
console.log('Total devices:', data.data.total)
data.data.list.forEach(device => {
console.log(`${device.deviceName}: ${device.status}`)
})Delete Device
/api/hccgw/resource/v1/devices/deleteRemove a device from the platform.
Request Parameters
| Name | Type | Required | Description |
|---|---|---|---|
deviceIds | array | Required | Array of device IDs to delete |
Example
const response = await fetch('https://ius.hikcentralconnect.com/api/hccgw/resource/v1/devices/delete', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'Token': accessToken,
},
body: JSON.stringify({
deviceIds: ['device_001', 'device_002'],
}),
})
const data = await response.json()
console.log('Devices deleted:', data.errorCode === '0')Add Area
/api/hccgw/resource/v1/areas/addCreate a new area for organizing devices.
Request Parameters
| Name | Type | Required | Description |
|---|---|---|---|
areaName | string | Required | Name of the area |
parentAreaId | string | Optional | Parent area ID for hierarchy |
Response Parameters
| Name | Type | Required | Description |
|---|---|---|---|
areaId | string | Required | ID of the created area |
Example
const response = await fetch('https://ius.hikcentralconnect.com/api/hccgw/resource/v1/areas/add', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'Token': accessToken,
},
body: JSON.stringify({
areaName: 'Building A - Floor 1',
parentAreaId: 'root_area',
}),
})
const data = await response.json()
const areaId = data.data.areaIdGet Areas
/api/hccgw/resource/v1/areas/getRetrieve the area hierarchy.
Request Parameters
| Name | Type | Required | Description |
|---|---|---|---|
parentAreaId | string | Optional | Filter by parent area |
Response Parameters
| Name | Type | Required | Description |
|---|---|---|---|
list | array | Required | Array of area objects |
Example
const response = await fetch('https://ius.hikcentralconnect.com/api/hccgw/resource/v1/areas/get', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'Token': accessToken,
},
body: JSON.stringify({}),
})
const data = await response.json()
data.data.list.forEach(area => {
console.log(`${area.areaName} (ID: ${area.areaId})`)
})Get Cameras by Area
/api/hccgw/resource/v1/areas/cameras/getGet all cameras in a specific area.
Request Parameters
| Name | Type | Required | Description |
|---|---|---|---|
areaId | string | Required | Area ID to query |
pageNo | number | Optional | Page number(Default: 1) |
pageSize | number | Optional | Items per page(Default: 20) |
Response Parameters
| Name | Type | Required | Description |
|---|---|---|---|
total | number | Required | Total camera count |
list | array | Required | Array of camera objects |
Example
const response = await fetch('https://ius.hikcentralconnect.com/api/hccgw/resource/v1/areas/cameras/get', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'Token': accessToken,
},
body: JSON.stringify({
areaId: 'area_001',
pageNo: 1,
pageSize: 20,
}),
})
const data = await response.json()
data.data.list.forEach(camera => {
console.log(`Camera: ${camera.cameraName}, Status: ${camera.status}`)
})Alarm Services
Alarm subscriptions, rules, and logs
Subscribe to Message Queue
/api/hccgw/alarm/v1/mq/subscribeSubscribe to receive alarm notifications via message queue.
Request Parameters
| Name | Type | Required | Description |
|---|---|---|---|
eventTypes | array | Required | Array of event types to subscribe |
Response Parameters
| Name | Type | Required | Description |
|---|---|---|---|
subscriptionId | string | Required | Subscription identifier |
mqUrl | string | Required | Message queue URL |
Example
const response = await fetch('https://ius.hikcentralconnect.com/api/hccgw/alarm/v1/mq/subscribe', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'Token': accessToken,
},
body: JSON.stringify({
eventTypes: ['motion', 'intrusion', 'faceDetection'],
}),
})
const data = await response.json()
const subscriptionId = data.data.subscriptionId
const mqUrl = data.data.mqUrl
console.log('Subscribed to MQ:', subscriptionId)Get Message Queue Messages
/api/hccgw/alarm/v1/mq/messagesRetrieve messages from the subscribed message queue.
Request Parameters
| Name | Type | Required | Description |
|---|---|---|---|
subscriptionId | string | Required | Subscription ID |
maxMessages | number | Optional | Maximum messages to retrieve(Default: 100) |
Response Parameters
| Name | Type | Required | Description |
|---|---|---|---|
messages | array | Required | Array of alarm messages |
Example
const response = await fetch('https://ius.hikcentralconnect.com/api/hccgw/alarm/v1/mq/messages', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'Token': accessToken,
},
body: JSON.stringify({
subscriptionId: 'sub_001',
maxMessages: 100,
}),
})
const data = await response.json()
data.data.messages.forEach(msg => {
console.log(`Event: ${msg.eventType}, Time: ${msg.timestamp}`)
})Add Alarm Rule
/api/hccgw/alarm/v1/alarmrules/addCreate a new alarm rule.
Request Parameters
| Name | Type | Required | Description |
|---|---|---|---|
ruleName | string | Required | Name of the alarm rule |
deviceIds | array | Required | Devices to apply the rule |
eventType | string | Required | Type of event to trigger alarm |
schedule | object | Optional | Schedule configuration |
Response Parameters
| Name | Type | Required | Description |
|---|---|---|---|
ruleId | string | Required | ID of the created rule |
Example
const response = await fetch('https://ius.hikcentralconnect.com/api/hccgw/alarm/v1/alarmrules/add', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'Token': accessToken,
},
body: JSON.stringify({
ruleName: 'Motion Detection Rule',
deviceIds: ['device_001', 'device_002'],
eventType: 'motion',
schedule: {
startTime: '08:00',
endTime: '18:00',
weekDays: [1, 2, 3, 4, 5],
},
}),
})
const data = await response.json()
const ruleId = data.data.ruleIdGet Alarm Logs
/api/hccgw/alarm/v1/alarmlogs/getRetrieve historical alarm logs.
Request Parameters
| Name | Type | Required | Description |
|---|---|---|---|
startTime | string | Required | Start time (ISO 8601) |
endTime | string | Required | End time (ISO 8601) |
deviceIds | array | Optional | Filter by devices |
eventTypes | array | Optional | Filter by event types |
pageNo | number | Optional | Page number(Default: 1) |
pageSize | number | Optional | Items per page(Default: 20) |
Response Parameters
| Name | Type | Required | Description |
|---|---|---|---|
total | number | Required | Total log count |
list | array | Required | Array of alarm log objects |
Example
const response = await fetch('https://ius.hikcentralconnect.com/api/hccgw/alarm/v1/alarmlogs/get', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'Token': accessToken,
},
body: JSON.stringify({
startTime: '2024-01-01T00:00:00Z',
endTime: '2024-01-31T23:59:59Z',
eventTypes: ['motion', 'intrusion'],
pageNo: 1,
pageSize: 50,
}),
})
const data = await response.json()
console.log('Total alarms:', data.data.total)Message Services
Raw message queue operations
Get Raw Messages
/api/hccgw/message/v1/rawmessage/getRetrieve raw messages from the platform message queue.
Request Parameters
| Name | Type | Required | Description |
|---|---|---|---|
queueId | string | Required | Queue identifier |
maxCount | number | Optional | Maximum messages(Default: 100) |
Response Parameters
| Name | Type | Required | Description |
|---|---|---|---|
messages | array | Required | Array of raw messages |
Example
const response = await fetch('https://ius.hikcentralconnect.com/api/hccgw/message/v1/rawmessage/get', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'Token': accessToken,
},
body: JSON.stringify({
queueId: 'queue_001',
maxCount: 100,
}),
})
const data = await response.json()
const messages = data.data.messagesAcknowledge Messages
/api/hccgw/message/v1/rawmessage/ackAcknowledge receipt of messages to remove them from the queue.
Request Parameters
| Name | Type | Required | Description |
|---|---|---|---|
queueId | string | Required | Queue identifier |
messageIds | array | Required | Array of message IDs to acknowledge |
Example
const response = await fetch('https://ius.hikcentralconnect.com/api/hccgw/message/v1/rawmessage/ack', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'Token': accessToken,
},
body: JSON.stringify({
queueId: 'queue_001',
messageIds: ['msg_001', 'msg_002', 'msg_003'],
}),
})
const data = await response.json()Video Services
Live view, recording playback, and snapshots. Encrypted cameras require EZOPEN protocol + EZUIKit player.
Get Video URL (Live & Playback)
/api/hccgw/video/v1/live/address/getObtain an EZOPEN URL for live streaming or recorded playback. This single endpoint handles both live and playback by changing the type parameter. For encrypted cameras, you MUST use protocol "1" (EZOPEN) and play the URL with EZUIKit SDK.
- Encrypted cameras return error EVZ60019 with HLS/FLV - use EZOPEN protocol instead
- EZOPEN URLs must be played with EZUIKit JS SDK (ezuikit-js npm package)
- For playback (type="2"/"3"), startTime and stopTime are required
- Use EZUIKit template "pcLive" for live, "pcRec" for playback
Request Parameters
| Name | Type | Required | Description |
|---|---|---|---|
resourceId | string | Required | Camera resource ID (from camera list response) |
deviceSerial | string | Required | Device serial number |
type | string | Required | Stream type: "1"=live, "2"=cloud playback, "3"=local playback123 |
code | string | Optional | Channel code (usually "0")(Default: 0) |
protocol | string | Optional | Protocol: "1"=EZOPEN (required for encrypted streams)(Default: 1) |
quality | string | Optional | Video quality: "1"=HD, "2"=SD(Default: 1)12 |
startTime | string | Optional | Playback start time (format: YYYY-MM-DD HH:MM:SS). Required when type="2" or "3". |
stopTime | string | Optional | Playback stop time (format: YYYY-MM-DD HH:MM:SS). Required when type="2" or "3". |
Response Parameters
| Name | Type | Required | Description |
|---|---|---|---|
url | string | Required | EZOPEN URL (e.g., ezopen://open.ezviz.com/<token>/live) |
Example
// Get live EZOPEN URL for a camera
const response = await fetch('https://ius.hikcentralconnect.com/api/hccgw/video/v1/live/address/get', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'Token': accessToken,
},
body: JSON.stringify({
resourceId: 'camera_resource_id', // From camera list
deviceSerial: 'DS-2CD2143G2-I-ABC123',
type: '1', // 1=live, 2=cloud playback, 3=local playback
code: '0', // Channel code (usually "0")
protocol: '1', // 1=EZOPEN (required for encrypted streams)
quality: '1', // 1=HD, 2=SD
}),
})
const data = await response.json()
// Returns an EZOPEN URL like: ezopen://open.ezviz.com/<token>/live
const ezopenUrl = data.data.url
console.log('EZOPEN URL:', ezopenUrl)
// Use this URL with EZUIKit player (see EZUIKit Integration section)Get Playback URL
/api/hccgw/video/v1/live/address/getSame endpoint as Get Video URL but with type="2" (cloud) or type="3" (local). Requires startTime and stopTime parameters.
- Use EZUIKit template "pcRec" for playback
- Time format is "YYYY-MM-DD HH:MM:SS" (NOT ISO 8601)
Request Parameters
| Name | Type | Required | Description |
|---|---|---|---|
resourceId | string | Required | Camera resource ID |
deviceSerial | string | Required | Device serial number |
type | string | Required | "2"=cloud playback, "3"=local playback23 |
code | string | Optional | Channel code(Default: 0) |
protocol | string | Optional | Protocol: "1"=EZOPEN(Default: 1) |
quality | string | Optional | "1"=HD, "2"=SD(Default: 1) |
startTime | string | Required | Start time (YYYY-MM-DD HH:MM:SS) |
stopTime | string | Required | Stop time (YYYY-MM-DD HH:MM:SS) |
Response Parameters
| Name | Type | Required | Description |
|---|---|---|---|
url | string | Required | EZOPEN playback URL |
Example
// Get playback URL - same endpoint, different type parameter
const response = await fetch('https://ius.hikcentralconnect.com/api/hccgw/video/v1/live/address/get', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'Token': accessToken,
},
body: JSON.stringify({
resourceId: 'camera_resource_id',
deviceSerial: 'DS-2CD2143G2-I-ABC123',
type: '2', // 2=cloud playback, 3=local playback
code: '0',
protocol: '1', // 1=EZOPEN
quality: '1',
startTime: '2024-01-15 10:00:00', // Format: YYYY-MM-DD HH:MM:SS
stopTime: '2024-01-15 11:00:00',
}),
})
const data = await response.json()
const playbackUrl = data.data.url
// Use with EZUIKit player using template: 'pcRec' for playbackSearch Recording Segments
/api/hccgw/video/v1/record/element/searchSearch for available recording segments for a camera. Returns time ranges of recorded video.
Request Parameters
| Name | Type | Required | Description |
|---|---|---|---|
resourceId | string | Required | Camera resource ID |
filter | object | Required | Filter object with time range and target type |
filter.beginTime | string | Required | Start time (ISO 8601, e.g., 2024-01-15T00:00:00.000+00:00) |
filter.endTime | string | Required | End time (ISO 8601) |
filter.targetType | string | Optional | "0"=cloud recordings, "1"=local device recordings(Default: 0)01 |
Response Parameters
| Name | Type | Required | Description |
|---|---|---|---|
list | array | Required | Array of recording segment objects with beginTime and endTime |
Example
// Search recording segments for a camera
const response = await fetch('https://ius.hikcentralconnect.com/api/hccgw/video/v1/record/element/search', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'Token': accessToken,
},
body: JSON.stringify({
resourceId: 'camera_resource_id',
filter: {
beginTime: '2024-01-15T00:00:00.000+00:00', // ISO 8601
endTime: '2024-01-15T23:59:59.000+00:00',
targetType: '0', // 0=cloud, 1=local device
},
}),
})
const data = await response.json()
data.data.list.forEach(segment => {
console.log(`Recording: ${segment.beginTime} - ${segment.endTime}`)
})Capture Snapshot
/api/hccgw/resource/v1/device/capturePicCapture a snapshot image from a device camera. Returns a URL to the captured image.
- Device must be online for capture to succeed
- Capture URL is temporary and may expire
Request Parameters
| Name | Type | Required | Description |
|---|---|---|---|
deviceSerial | string | Required | Device serial number |
channelNo | number | Optional | Channel number (defaults to 1)(Default: 1) |
Response Parameters
| Name | Type | Required | Description |
|---|---|---|---|
captureUrl | string | Required | URL of the captured snapshot image |
Example
// Capture a snapshot from a device camera
const response = await fetch('https://ius.hikcentralconnect.com/api/hccgw/resource/v1/device/capturePic', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'Token': accessToken,
},
body: JSON.stringify({
deviceSerial: 'DS-2CD2143G2-I-ABC123',
channelNo: 1,
}),
})
const data = await response.json()
const captureUrl = data.data.captureUrl
console.log('Snapshot URL:', captureUrl)Get Recording Schedule
/api/hccgw/video/v1/recordsettings/getGet the recording schedule settings for a camera.
Request Parameters
| Name | Type | Required | Description |
|---|---|---|---|
resourceId | string | Required | Camera resource ID |
Response Parameters
| Name | Type | Required | Description |
|---|---|---|---|
settings | object | Required | Recording schedule configuration |
Example
// Get recording schedule settings for a camera
const response = await fetch('https://ius.hikcentralconnect.com/api/hccgw/video/v1/recordsettings/get', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'Token': accessToken,
},
body: JSON.stringify({
resourceId: 'camera_resource_id',
}),
})
const data = await response.json()
console.log('Recording settings:', data.data)Video Intercom Services
Building, resident, and pass management
Add Building
/api/hccgw/visp/v1/buildings/addRegister a new building for intercom services.
Request Parameters
| Name | Type | Required | Description |
|---|---|---|---|
buildingName | string | Required | Name of the building |
buildingNo | string | Required | Building number |
address | string | Optional | Building address |
Response Parameters
| Name | Type | Required | Description |
|---|---|---|---|
buildingId | string | Required | ID of the created building |
Example
const response = await fetch('https://ius.hikcentralconnect.com/api/hccgw/visp/v1/buildings/add', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'Token': accessToken,
},
body: JSON.stringify({
buildingName: 'Main Building',
buildingNo: 'A1',
address: '123 Main Street',
}),
})
const data = await response.json()
const buildingId = data.data.buildingIdGet Buildings
/api/hccgw/visp/v1/buildings/getRetrieve list of buildings.
Request Parameters
| Name | Type | Required | Description |
|---|---|---|---|
pageNo | number | Optional | Page number(Default: 1) |
pageSize | number | Optional | Items per page(Default: 20) |
Response Parameters
| Name | Type | Required | Description |
|---|---|---|---|
total | number | Required | Total building count |
list | array | Required | Array of building objects |
Example
const response = await fetch('https://ius.hikcentralconnect.com/api/hccgw/visp/v1/buildings/get', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'Token': accessToken,
},
body: JSON.stringify({
pageNo: 1,
pageSize: 20,
}),
})
const data = await response.json()
data.data.list.forEach(building => {
console.log(building.buildingName)
})Add Resident
/api/hccgw/visp/v1/residents/addRegister a new resident.
Request Parameters
| Name | Type | Required | Description |
|---|---|---|---|
residentName | string | Required | Name of the resident |
phoneNo | string | Required | Phone number |
buildingId | string | Required | Building ID |
roomNo | string | Required | Room number |
Response Parameters
| Name | Type | Required | Description |
|---|---|---|---|
residentId | string | Required | ID of the created resident |
Example
const response = await fetch('https://ius.hikcentralconnect.com/api/hccgw/visp/v1/residents/add', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'Token': accessToken,
},
body: JSON.stringify({
residentName: 'John Doe',
phoneNo: '+1234567890',
buildingId: 'building_001',
roomNo: '101',
}),
})
const data = await response.json()
const residentId = data.data.residentIdIssue Visitor Pass
/api/hccgw/visp/v1/passes/issueIssue a temporary visitor pass.
Request Parameters
| Name | Type | Required | Description |
|---|---|---|---|
residentId | string | Required | Resident ID issuing the pass |
visitorName | string | Required | Visitor name |
validFrom | string | Required | Pass validity start (ISO 8601) |
validTo | string | Required | Pass validity end (ISO 8601) |
Response Parameters
| Name | Type | Required | Description |
|---|---|---|---|
passCode | string | Required | Pass code for the visitor |
qrCode | string | Required | QR code image URL |
Example
const response = await fetch('https://ius.hikcentralconnect.com/api/hccgw/visp/v1/passes/issue', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'Token': accessToken,
},
body: JSON.stringify({
residentId: 'resident_001',
visitorName: 'Jane Smith',
validFrom: '2024-01-20T09:00:00Z',
validTo: '2024-01-20T18:00:00Z',
}),
})
const data = await response.json()
const passCode = data.data.passCode
const qrCode = data.data.qrCodeAccess Control Services
Door control and access permissions
Remote Door Control
/api/hccgw/acs/v1/remote/controlRemotely control a door (open/close/remain open).
- Ensure proper permissions before remote control
- Control actions are logged for audit purposes
Request Parameters
| Name | Type | Required | Description |
|---|---|---|---|
doorId | string | Required | Door identifier |
controlType | string | Required | Control actionopencloseremainOpenremainClose |
Example
const response = await fetch('https://ius.hikcentralconnect.com/api/hccgw/acs/v1/remote/control', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'Token': accessToken,
},
body: JSON.stringify({
doorId: 'door_001',
controlType: 'open',
}),
})
const data = await response.json()
if (data.errorCode === '0') {
console.log('Door opened successfully')
}Get Encryption Info
/api/hccgw/acs/v1/encryptinfo/getGet encryption information for secure Bluetooth communication.
Response Parameters
| Name | Type | Required | Description |
|---|---|---|---|
publicKey | string | Required | Public key for encryption |
algorithm | string | Required | Encryption algorithm |
Example
const response = await fetch('https://ius.hikcentralconnect.com/api/hccgw/acs/v1/encryptinfo/get', {
method: 'GET',
headers: {
'Token': accessToken,
},
})
const data = await response.json()
const publicKey = data.data.publicKey
const algorithm = data.data.algorithmGet Access Levels
/api/hccgw/acspm/v1/accesslevel/listRetrieve list of access levels.
Request Parameters
| Name | Type | Required | Description |
|---|---|---|---|
pageNo | number | Optional | Page number(Default: 1) |
pageSize | number | Optional | Items per page(Default: 20) |
Response Parameters
| Name | Type | Required | Description |
|---|---|---|---|
total | number | Required | Total count |
list | array | Required | Array of access level objects |
Example
const response = await fetch('https://ius.hikcentralconnect.com/api/hccgw/acspm/v1/accesslevel/list', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'Token': accessToken,
},
body: JSON.stringify({
pageNo: 1,
pageSize: 20,
}),
})
const data = await response.json()
data.data.list.forEach(level => {
console.log(`Access Level: ${level.name}`)
})Assign Access to Person
/api/hccgw/acspm/v1/personaccess/assignAssign access levels to a person.
Request Parameters
| Name | Type | Required | Description |
|---|---|---|---|
personId | string | Required | Person identifier |
accessLevelIds | array | Required | Array of access level IDs |
Example
const response = await fetch('https://ius.hikcentralconnect.com/api/hccgw/acspm/v1/personaccess/assign', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'Token': accessToken,
},
body: JSON.stringify({
personId: 'person_001',
accessLevelIds: ['level_001', 'level_002'],
}),
})
const data = await response.json()Person Management Services
Departments, persons, and credentials
Search Person Groups
/api/hccgw/person/v1/groups/searchSearch for person groups (departments).
Request Parameters
| Name | Type | Required | Description |
|---|---|---|---|
keyword | string | Optional | Search keyword |
pageNo | number | Optional | Page number(Default: 1) |
pageSize | number | Optional | Items per page(Default: 20) |
Response Parameters
| Name | Type | Required | Description |
|---|---|---|---|
total | number | Required | Total count |
list | array | Required | Array of group objects |
Example
const response = await fetch('https://ius.hikcentralconnect.com/api/hccgw/person/v1/groups/search', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'Token': accessToken,
},
body: JSON.stringify({
keyword: 'Engineering',
pageNo: 1,
pageSize: 20,
}),
})
const data = await response.json()
data.data.list.forEach(group => {
console.log(`Group: ${group.groupName}`)
})Add Person
/api/hccgw/person/v1/persons/addAdd a new person to the system.
Request Parameters
| Name | Type | Required | Description |
|---|---|---|---|
personName | string | Required | Full name of the person |
groupId | string | Required | Group/department ID |
phoneNo | string | Optional | Phone number |
email | string | Optional | Email address |
cardNo | string | Optional | Card number |
Response Parameters
| Name | Type | Required | Description |
|---|---|---|---|
personId | string | Required | ID of the created person |
Example
const response = await fetch('https://ius.hikcentralconnect.com/api/hccgw/person/v1/persons/add', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'Token': accessToken,
},
body: JSON.stringify({
personName: 'John Smith',
groupId: 'group_001',
phoneNo: '+1234567890',
email: 'john.smith@example.com',
cardNo: 'CARD123456',
}),
})
const data = await response.json()
const personId = data.data.personIdUpload Person Photo
/api/hccgw/person/v1/persons/photoUpload a photo for facial recognition.
- Photo should be a clear frontal face image
- Recommended resolution: 640x480 or higher
- Maximum file size: 200KB (base64 encoded)
Request Parameters
| Name | Type | Required | Description |
|---|---|---|---|
personId | string | Required | Person identifier |
photoBase64 | string | Required | Base64 encoded photo (JPEG/PNG) |
Example
// First, convert image to base64
const imageFile = await fetch('/path/to/photo.jpg')
const imageBlob = await imageFile.blob()
const base64 = await blobToBase64(imageBlob)
const response = await fetch('https://ius.hikcentralconnect.com/api/hccgw/person/v1/persons/photo', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'Token': accessToken,
},
body: JSON.stringify({
personId: 'person_001',
photoBase64: base64,
}),
})
const data = await response.json()Quick Add Person
/api/hccgw/person/v1/persons/quick/addQuickly add a person with photo and card in a single request.
Request Parameters
| Name | Type | Required | Description |
|---|---|---|---|
personName | string | Required | Full name |
groupId | string | Required | Group/department ID |
photoBase64 | string | Optional | Base64 encoded photo |
cardNo | string | Optional | Card number |
accessLevelIds | array | Optional | Access level IDs to assign |
Response Parameters
| Name | Type | Required | Description |
|---|---|---|---|
personId | string | Required | ID of the created person |
Example
const response = await fetch('https://ius.hikcentralconnect.com/api/hccgw/person/v1/persons/quick/add', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'Token': accessToken,
},
body: JSON.stringify({
personName: 'Jane Doe',
groupId: 'group_001',
photoBase64: photoBase64String,
cardNo: 'CARD789012',
accessLevelIds: ['level_001'],
}),
})
const data = await response.json()
const personId = data.data.personIdSearch Persons
/api/hccgw/person/v1/persons/searchSearch for persons with various filters.
Request Parameters
| Name | Type | Required | Description |
|---|---|---|---|
keyword | string | Optional | Search keyword |
groupId | string | Optional | Filter by group |
pageNo | number | Optional | Page number(Default: 1) |
pageSize | number | Optional | Items per page(Default: 20) |
Response Parameters
| Name | Type | Required | Description |
|---|---|---|---|
total | number | Required | Total count |
list | array | Required | Array of person objects |
Example
const response = await fetch('https://ius.hikcentralconnect.com/api/hccgw/person/v1/persons/search', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'Token': accessToken,
},
body: JSON.stringify({
keyword: 'John',
groupId: 'group_001',
pageNo: 1,
pageSize: 20,
}),
})
const data = await response.json()
console.log('Found:', data.data.total, 'persons')On-Board Monitoring Services
Vehicle and driver management
Add Vehicle
/api/hccgw/obd/v1/vehicles/addRegister a new vehicle.
Request Parameters
| Name | Type | Required | Description |
|---|---|---|---|
plateNo | string | Required | Vehicle plate number |
vehicleName | string | Optional | Vehicle name/identifier |
deviceId | string | Optional | Associated device ID |
Response Parameters
| Name | Type | Required | Description |
|---|---|---|---|
vehicleId | string | Required | ID of the created vehicle |
Example
const response = await fetch('https://ius.hikcentralconnect.com/api/hccgw/obd/v1/vehicles/add', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'Token': accessToken,
},
body: JSON.stringify({
plateNo: 'ABC-1234',
vehicleName: 'Delivery Truck 1',
deviceId: 'device_001',
}),
})
const data = await response.json()
const vehicleId = data.data.vehicleIdGet Vehicles
/api/hccgw/obd/v1/vehicles/getRetrieve list of vehicles.
Request Parameters
| Name | Type | Required | Description |
|---|---|---|---|
pageNo | number | Optional | Page number(Default: 1) |
pageSize | number | Optional | Items per page(Default: 20) |
plateNo | string | Optional | Filter by plate number |
Response Parameters
| Name | Type | Required | Description |
|---|---|---|---|
total | number | Required | Total count |
list | array | Required | Array of vehicle objects |
Example
const response = await fetch('https://ius.hikcentralconnect.com/api/hccgw/obd/v1/vehicles/get', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'Token': accessToken,
},
body: JSON.stringify({
pageNo: 1,
pageSize: 20,
}),
})
const data = await response.json()
data.data.list.forEach(vehicle => {
console.log(`${vehicle.plateNo}: ${vehicle.vehicleName}`)
})Add Driver
/api/hccgw/obd/v1/drivers/addRegister a new driver.
Request Parameters
| Name | Type | Required | Description |
|---|---|---|---|
driverName | string | Required | Driver name |
licenseNo | string | Required | License number |
phoneNo | string | Optional | Phone number |
Response Parameters
| Name | Type | Required | Description |
|---|---|---|---|
driverId | string | Required | ID of the created driver |
Example
const response = await fetch('https://ius.hikcentralconnect.com/api/hccgw/obd/v1/drivers/add', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'Token': accessToken,
},
body: JSON.stringify({
driverName: 'Mike Johnson',
licenseNo: 'DL123456789',
phoneNo: '+1234567890',
}),
})
const data = await response.json()
const driverId = data.data.driverIdGet Vehicle Location
/api/hccgw/obd/v1/vehicles/locationGet current location of a vehicle.
Request Parameters
| Name | Type | Required | Description |
|---|---|---|---|
vehicleId | string | Required | Vehicle identifier |
Response Parameters
| Name | Type | Required | Description |
|---|---|---|---|
latitude | number | Required | Latitude coordinate |
longitude | number | Required | Longitude coordinate |
speed | number | Required | Current speed (km/h) |
timestamp | string | Required | Location timestamp |
Example
const response = await fetch('https://ius.hikcentralconnect.com/api/hccgw/obd/v1/vehicles/location', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'Token': accessToken,
},
body: JSON.stringify({
vehicleId: 'vehicle_001',
}),
})
const data = await response.json()
const { latitude, longitude, speed, timestamp } = data.data
console.log(`Location: ${latitude}, ${longitude} - Speed: ${speed} km/h`)Attendance Services
Time card and attendance reports
Get Attendance Records
/api/hccgw/attendance/v1/records/getRetrieve attendance check-in/out records.
Request Parameters
| Name | Type | Required | Description |
|---|---|---|---|
startTime | string | Required | Start time (ISO 8601) |
endTime | string | Required | End time (ISO 8601) |
personIds | array | Optional | Filter by person IDs |
groupId | string | Optional | Filter by group |
pageNo | number | Optional | Page number(Default: 1) |
pageSize | number | Optional | Items per page(Default: 20) |
Response Parameters
| Name | Type | Required | Description |
|---|---|---|---|
total | number | Required | Total record count |
list | array | Required | Array of attendance records |
Example
const response = await fetch('https://ius.hikcentralconnect.com/api/hccgw/attendance/v1/records/get', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'Token': accessToken,
},
body: JSON.stringify({
startTime: '2024-01-01T00:00:00Z',
endTime: '2024-01-31T23:59:59Z',
groupId: 'group_001',
pageNo: 1,
pageSize: 50,
}),
})
const data = await response.json()
console.log('Total records:', data.data.total)Get Time Card Report
/api/hccgw/attendance/v1/timecard/reportGenerate a time card report for specified period.
Request Parameters
| Name | Type | Required | Description |
|---|---|---|---|
startDate | string | Required | Start date (YYYY-MM-DD) |
endDate | string | Required | End date (YYYY-MM-DD) |
personIds | array | Optional | Filter by person IDs |
groupId | string | Optional | Filter by group |
Response Parameters
| Name | Type | Required | Description |
|---|---|---|---|
report | array | Required | Array of time card entries |
Example
const response = await fetch('https://ius.hikcentralconnect.com/api/hccgw/attendance/v1/timecard/report', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'Token': accessToken,
},
body: JSON.stringify({
startDate: '2024-01-01',
endDate: '2024-01-31',
groupId: 'group_001',
}),
})
const data = await response.json()
data.data.report.forEach(entry => {
console.log(`${entry.personName}: ${entry.totalHours} hours`)
})Get Attendance Summary
/api/hccgw/attendance/v1/summary/getGet attendance summary statistics.
Request Parameters
| Name | Type | Required | Description |
|---|---|---|---|
date | string | Required | Date (YYYY-MM-DD) |
groupId | string | Optional | Filter by group |
Response Parameters
| Name | Type | Required | Description |
|---|---|---|---|
totalPersons | number | Required | Total persons |
checkedIn | number | Required | Number checked in |
absent | number | Required | Number absent |
late | number | Required | Number late |
Example
const response = await fetch('https://ius.hikcentralconnect.com/api/hccgw/attendance/v1/summary/get', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'Token': accessToken,
},
body: JSON.stringify({
date: '2024-01-15',
groupId: 'group_001',
}),
})
const data = await response.json()
const { totalPersons, checkedIn, absent, late } = data.data
console.log(`Checked in: ${checkedIn}/${totalPersons}, Late: ${late}, Absent: ${absent}`)Error Codes
Common error codes and their meanings
| Code | Message | Description | Solution |
|---|---|---|---|
0 | Success | The request was successful. | - |
0x1001 | Invalid Parameter | One or more request parameters are invalid or missing. | Check that all required parameters are provided and have valid values. |
0x1002 | Parameter Type Error | A parameter has an incorrect data type. | Verify that parameter types match the API specification (string, number, array, etc.). |
0x1003 | Parameter Out of Range | A parameter value is outside the allowed range. | Check the allowed range for numeric parameters in the API documentation. |
0x2001 | Authentication Failed | Invalid or expired access token. | Refresh your access token or obtain a new one using the /token/get endpoint. |
0x2002 | Invalid App Key | The provided app key is invalid or has been revoked. | Verify your app key is correct and active in the HikCentral Connect portal. |
0x2003 | Invalid Secret Key | The provided secret key is invalid. | Verify your secret key matches the one in the HikCentral Connect portal. |
0x2004 | Token Expired | The access token has expired. | Refresh your token using the /token/refresh endpoint or obtain a new one. |
0x2005 | Permission Denied | The account does not have permission for this operation. | Contact your administrator to grant the required permissions. |
0x2006 | Rate Limit Exceeded | Too many requests in a short period. Rate limit is 5 requests per second. | Implement request throttling in your application. Wait before retrying. |
0x3001 | Resource Not Found | The requested resource (device, camera, area, etc.) does not exist. | Verify the resource ID is correct and the resource has not been deleted. |
0x3002 | Resource Already Exists | A resource with the same identifier already exists. | Use a different identifier or update the existing resource instead. |
0x3003 | Resource Limit Exceeded | The maximum number of resources has been reached. | Upgrade your service package or delete unused resources. |
0x3004 | Device Offline | The device is currently offline and cannot respond to commands. | Check the device network connection and power status. |
0x3005 | Device Busy | The device is busy processing another request. | Wait and retry the request after a short delay. |
0x3006 | Invalid Device Serial | The device serial number is invalid or already registered. | Verify the serial number is correct and not registered to another account. |
0x3007 | Invalid Validation Code | The device validation code is incorrect. | Check the validation code on the device label or in the device documentation. |
EVZ60019 | Encrypted Stream | The camera stream is encrypted. HLS and FLV protocols cannot be used. | Use EZOPEN protocol (protocol: "1") and play the stream with EZUIKit JS SDK. See the EZUIKit Integration section. |
0x4001 | Video Stream Error | Failed to establish video stream connection. | Check camera connectivity and try again. Verify the protocol is supported. |
0x4002 | Recording Not Found | No recording available for the specified time range. | Verify the camera has recording enabled and check the time range. |
0x4003 | Stream Token Expired | The streaming token has expired. | Obtain a new streaming token using the /streamtoken/get endpoint. |
0x5001 | Subscription Failed | Failed to create message queue subscription. | Verify the event types are valid and try again. |
0x5002 | Queue Not Found | The specified message queue does not exist. | Create a new subscription to get a new queue ID. |
0x5003 | Message Acknowledge Failed | Failed to acknowledge messages. | Verify the message IDs are valid and belong to the specified queue. |
0x6001 | Person Photo Invalid | The uploaded photo does not meet requirements. | Ensure the photo is a clear frontal face image, minimum 640x480, under 200KB. |
0x6002 | Card Number Duplicate | The card number is already assigned to another person. | Use a different card number or remove it from the existing person. |
0x6003 | Face Recognition Failed | No face detected in the uploaded photo. | Upload a clear photo with a visible frontal face. |
0x7001 | Access Control Error | Failed to execute access control command. | Verify the door is connected and try again. |
0x7002 | Door Not Configured | The door is not properly configured for remote control. | Configure the door in the HikCentral Connect portal. |
0x8001 | Internal Server Error | An unexpected error occurred on the server. | Try again later. If the problem persists, contact support. |
0x8002 | Service Unavailable | The service is temporarily unavailable. | Wait and retry. Check the HikCentral Connect status page. |
0x8003 | Database Error | A database error occurred. | Try again later. If the problem persists, contact support. |