This article is a simple guide on how to use CLUe API to add, update and delete user, including retrieve event logs from CLUe Server. Below examples uses cURL and C# examples.
■ Prerequisite
In order to use CLUe API, you must have the following information provided .
- Place ID - a space in CLUe server where you user data are stored
- API Key - fixed API token to call CLUe API
- Door ID - value of the door added to your Place
- Device - to be used for authentication
When calling below APIs, it’s necessary to set a time interval between calls to account for the processing time required to extract templates and sync devices. Therefore, it is recommended to set at least 300ms between calls when enrolling multiple users in bulk.
■ Register User
In order to authenticate user in device, you need to first register the user in CLUe.
Users are then automatically synced to connected devices in realtime.
1. API endpoint and Parameters
[POST] https://api.moon.supremainc.com/v1/places/{{placeId}}/auths
Request Header:
Key | Type | Required | Value |
---|---|---|---|
Authorization | JWT Access Token | yes | Use API Key obtained from Suprema or generate your own API key from CLUe Portal. |
Content-Type | String | yes | application/json |
Accept | String | yes | */* |
Path Variables:
Key | Type | Required | Description |
---|---|---|---|
placeId | Number | yes | The assigned placeID of your store. This will be provided by Suprema in advance. |
2. Request Body
Please request below information from your Suprema Agent.
Field | Type | Required | Remarks |
---|---|---|---|
user | Object | yes | |
user.name | String | yes | |
user.key | String | yes | Unique Key that customer can define. |
auth | Object | yes | |
auth.activeStatus | String | yes | ACTIVE or INACTIVE |
auth.startTime | Number | yes | Unix Time (Epoch milli second ) |
auth.endTime | Number | yes | Unix Time (Epoch milli second ) |
auth.doorAccessType | String | yes | ALL_DOOR or SPECIFIC ** If SPECIFIC, list the doors in auth.doorIds |
auth.scheduleType | String | yes | ALWAYS or SPECIFIC ** If SPECIFIC, list the schedule in auth.scheduleId |
auth.scheduleId | String | no | |
auth.doorIds | Array | no | list of doors |
auth.credentials | Object | yes | |
auth.credentials.cards | Array | no | list of card ID (decimal) |
auth.credentials.faceImages | Array | no | base64 image (maximum of 2 images) |
Sample:
curl --location 'https://api.moon.supremainc.com/v1/be/places/178/auths' \ --header 'Content-Type: application/json' \ --header 'Authorization: ••••••' \ --data '{ "user": { "key": "1234567", "name": "namehere" }, "auth": { "startTime": 1718809200000, "endTime": 1718895540000, "doorAccessType": "SPECIFIC", "doorIds":[234, 235,236], "scheduleType":"SPECIFIC", "scheduleId":333, "credentials": { "cards": [ { "cardNumber": "12345", "formatType": "CSN" } ], "faceImages":["/9j/4AAQSkZJRgABAQAASABIAA..."] }, "activeStatus":"ACTIVE" } }'
3. Response Body
Field | Type | Nullable | Remarks |
---|---|---|---|
code | Number | No | API response code |
status | Boolean | No | API response status |
message | String | No | API response message |
data | Object | No | |
data.authId | Number | No | |
data.lastModifiedAt | Number | No | |
user | Object | No | |
user.userId | Number | No | |
user.key | String | No | |
user.name | String | No | |
user.realNameAuthStatusType | String | No | |
auth | Object | No | |
auth.startTime | Number | No | |
auth.endTime | Number | No | |
auth.doorAccessType | String | No | |
auth.scheduleType | String | No | |
auth.scheduleId | Number | Yes | |
auth.doors | Object | Yes | |
auth.doors.doorId | String | Yes | |
auth.doors.doorName | String | Yes | |
auth.credentials | Object | Yes | |
auth.credentials.modes | Array | Yes | |
auth.credentials.faceImages | Array | Yes | |
auth.credentials.name | String | Yes | |
auth.activeStatus | String | No |
{ "code": 200, "status": true, "message": "OK", "data": { "authId": 118926, "lastModifiedAt": 1718841401642, "user": { "userId": 106569, "key": "34dab180-a14b-103b-8a4e-1166f21964da", "name": "test", "realNameAuthStatusType": "REAL_NAME_AUTH_BEFORE" }, "auth": { "startTime": 1718809200000, "endTime": 1718895540000, "doorAccessType": "SPECIFIC", "scheduleType": "SPECIFIC", "scheduleId": 333, "doors": [ { "doorId": 234, "doorName": "SmartLight" } ], "credentials": { "modes": [ "FACE" ], "faceImages": [ "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAHAAAA..." ], "name": "test" }, "activeStatus": "ACTIVE" } } }
■ Update User
AuthID needs to be passed as a parameter to modify.
1. API endpoint and Parameters
[PUT] https://api.moon.supremainc.com/v1/places/auths/{{authid}}
Request Header:
Key | Type | Required | Value |
---|---|---|---|
Authorization | JWT Access Token | yes | Use API Key obtained from Suprema or generate your own API key from CLUe Portal. |
Content-Type | String | yes | application/json |
Accept | String | yes | */* |
Path Variables:
Key | Type | Required | Description |
---|---|---|---|
authID | Number | yes | Unique code assigned to user during user registration. |
2. Request Body
Please request below information from your Suprema Agent.
Field | Type | Required | Remarks |
---|---|---|---|
activeStatus | String | ACTIVE or INACTIVE | |
startTime | Number | Unix Time (Epoch milli second ) | |
endTime | Number | Unix Time (Epoch milli second ) | |
doorAccessType | String | ALL_DOOR or SPECIFIC ** If SPECIFIC, list the doors in auth.doorIds | |
scheduleType | String | ALWAYS or SPECIFIC ** If SPECIFIC, list the schedule in auth.scheduleId | |
scheduleId | Number | ||
doorIds | Number | ||
credentials | Object | ||
credentials.cards | Array | card list in decimal | |
credentials.faceImages | Array | base64 images (max of 2 images) | |
name | String |
Sample:
curl --location --request PUT 'https://api.moon.supremainc.com/v1/places/auths/107904' \ --header 'Content-Type: application/json' \ --header 'Accept: application/json' \ --header 'Authorization: Bearer eyJ0eXAiOiJKV1*concatenated*' \ --data '{ "activeStatus": "ACTIVE", "startTime": 1745506800000, "endTime": 2147353200000, "doorAccessType": "ALL_DOOR", "scheduleType": "ALWAYS", "scheduleId": null, "doorIds": null, "credentials": { "cards": [], "faceImages": [ "iVBORw0KGgoAAAANSUhEUgAAAHAAA **concatenated**", "iVBORw0KGgoAAAANSUhEUgAAAHAAA **concatenated**", ], "name": "Test" } }'
3. Response Body
Field | Type | Nullable | Remarks |
---|---|---|---|
code | Number | No | API response code |
status | Boolean | No | API response status |
message | String | No | API response message |
data | Object | No | |
data.authId | Number | No | |
data.lastModifiedAt | Number | No | |
user | Object | No | |
user.userId | Number | No | |
user.key | String | No | |
user.name | String | No | |
user.realNameAuthStatusType | String | No | |
auth | Object | No | |
auth.startTime | Number | No | |
auth.endTime | Number | No | |
auth.doorAccessType | String | No | |
auth.scheduleType | String | No | |
auth.scheduleId | Number | Yes | |
auth.doors | Object | Yes | |
auth.doors.doorId | String | Yes | |
auth.doors.doorName | String | Yes | |
auth.credentials | Object | Yes | |
auth.credentials.modes | Array | Yes | |
auth.credentials.faceImages | String | Yes | |
auth.credentials.name | String | Yes | |
auth.activeStatus | String | No |
{ "code": 200, "status": true, "message": "OK", "data": { "authId": 118926, "lastModifiedAt": 1718841401642, "user": { "userId": 106569, "key": "34dab180-a14b-103b-8a4e-1166f21964da", "name": "test", "realNameAuthStatusType": "REAL_NAME_AUTH_BEFORE" }, "auth": { "startTime": 1718809200000, "endTime": 1718895540000, "doorAccessType": "SPECIFIC", "scheduleType": "SPECIFIC", "scheduleId": 333, "doors": [ { "doorId": 234, "doorName": "SmartLight" } ], "credentials": { "modes": [ "FACE" ], "faceImages": [ "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAHAAAA..." ], "name": "test" }, "activeStatus": "ACTIVE" } } }
■ Delete User
AuthID needs to be passed as a parameter to delete.
When deleting auth, user data such as “key value” is remained for future use.
1. API endpoint and Parameters
[DELETE] https://api.moon.supremainc.com/v1/places/auths/{{authID}}
Request Header:
Key | Type | Required | Value |
---|---|---|---|
Authorization | JWT Access Token | yes | Use API Key obtained from Suprema or generate your own API key from CLUe Portal. |
Content-Type | String | yes | application/json |
Accept | String | yes | */* |
■
Retrieve Logs
1. API endpoint and Parameters
[GET] https://api.moon.supremainc.com/v1/events?startTime=1719932400000&endTime=1720623540000&filterEvents=DEV_FACE_AUTH_SUCCESS%2CDEV_FACE_AUTH_FAIL&page=0&size=200&sort=id%2Casc&placeId={placeID}
Request Header:
Key | Type | Required | Value |
---|---|---|---|
Authorization | JWT Token | yes | Use API Key obtained from Suprema |
Content-Type | String | yes | application/json |
Accept | String | yes | */* |
Query Parameter:
Key | Type | Required | Description |
---|---|---|---|
startTime | Unix Time (Millisec) | no | retrieve logs starting this date. Must be within 7 days from the end date. if not specified, all logs are displayed |
endTime | Unix Time (Millisec) | no | retrieve logs until this date if not specified, all logs are displayed |
filterEvents | string | no | filter by events |
page | Number | no | logs are displayed in multiples pages. if not specified, displayed in 1 page only. |
size | Number | no | number of logs to be retirieved from the startTime |
q | string | no | query |
sort | string | no | sort the logs by ID in ascending ('asc') or descending ('desc') order Example: id,desc |
curl --location 'https://api.moon.supremainc.com/v1/be/events?startTime=1719932400000&endTime=1720623540000&filterEvents=DEV_FACE_AUTH_SUCCESS%2CDEV_FACE_AUTH_FAIL&page=0&size=200&sort=id%2Casc&placeId=' \ --header 'Authorization: Bearer api_key_here'
2. Request Body
None
3. Response Body
Field | Type | Nullable | Description |
---|---|---|---|
code | Number | false | API response code |
status | Boolean | false | API response status |
message | String | false | API response message |
total | Number | false | total number of retrieved logs. |
data.logId | Number | false | CLUe server side's log ID. |
data.eventAt | Unix Time | false | Date and time when the event occurred. |
data.placeId | Number | false | Place ID |
data.deviceId | Number | true | Device ID |
data.doorId | Number | true | Door ID |
data.doorName | String | true | Door Name |
data.authId | Number | true | Authentication ID |
data.userId | Number | true | User Key |
data.useName | String | true | User Name |
data.localLogId | Number | false | Device side's log ID |
data.eventType | Event Type | false | event type |
{ "code": 200, "status": true, "message": "OK", "total": 75, "data": [ { "logId": "XjIAM5ABcB2c2xupDI6m", "eventAt": 1718842554980, "placeId": 448, "deviceId": 1343, "doorId": 645, "localLogId": 25280, "eventType": "DEV_DOOR_RELAY_OFF" }, { "logId": "XTIAM5ABcB2c2xupDI6m", "eventAt": 1718842553962, "placeId": 448, "deviceId": 1343, "doorId": 645, "localLogId": 25279, "eventType": "DEV_DOOR_RELAY_ON" }, { "logId": "WzIAM5ABcB2c2xupDI6m", "eventAt": 1718842553904, "placeId": 448, "authId": 107909, "deviceId": 1343, "doorId": 645, "doorName": "SupremaJP_In", "userId": "c2119100-fbb0-1fdf-82c6-7dba89b5fe29", "userName": "jinlee", "localLogId": 25278, "eventType": "DEV_FACE_AUTH_SUCCESS" }, { "logId": "iI7-MpABqzmfp6-HrEH7", "eventAt": 1718842462256, "placeId": 448, "deviceId": 1343, "doorId": 645, "localLogId": 25277, "eventType": "DEV_DOOR_RELAY_OFF" }, { "logId": "h47-MpABqzmfp6-HrEH7", "eventAt": 1718842461243, "placeId": 448, "deviceId": 1343, "doorId": 645, "localLogId": 25276, "eventType": "DEV_DOOR_RELAY_ON" } ] }
Event Explanation
- DEV_FACE_AUTH_SUCCESS - The user's face template is registered in CLUe server. Thus, it is successful when user authenticated from the device
- VENDOR_AUTH_SUCCESS - It means that the user's ID (example 64455 above) is registered and allowed access from the 3rd party system.
- DEV_DOOR_RELAY_ON - The relay of the device is turned ON. Door is unlocked.
- DEV_DOOR_RELAY_OFF - The relay of the device is turned OFF. Door is locked.
Sample Flow of Events for Authentication Success
Sample Flow of Events for Authentication Failed (CLUe Side)
Sample Flow of Events for Authentication Failed (3rd Party System side)