This article is a simple guide on how to use CLUe API to retrieve event logs from CLUe Server.

Below examples uses cURL and C# WPF .NET examples.


TABLE OF CONTENTS


Prerequisite

In order to use CLUe API, you must have the following information provided .

  • Your store's PlaceID
  • API Key
  • Device connected to CLUe for authentication


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/be/places/:placeId/auths


Request Header:

KeyTypeRequiredValue
Authorization
JWT TokenyesUse API Key obtained from Suprema
Content-TypeStringyesapplication/json
AcceptStringyes*/*


Path Variables:

KeyTypeRequiredDescription
placeId
NumberyesThe assigned placeID of your store.
Please request information from Suprema




2. Request Body

Please request below information from your Suprema Agent.

FieldTypeRequiredRemarks
userObjectyes
user.nameStringyes
user.keyStringyesUnique Key that customer can define.
authObjectyes
auth.activeStatusStringyesACTIVE or INACTIVE
auth.startTime NumberyesUnix Time (Epoch milli second )
auth.endTimeNumberyesUnix Time (Epoch milli second )
auth.doorAccessTypeStringyesALL_DOOR or SPECIFIC
** If SPECIFIC, list the doors in auth.doorIds
auth.scheduleTypeStringyesALWAYS or SPECIFIC
** If SPECIFIC, list the schedule in auth.scheduleId
auth.scheduleIdString
auth.doorIdsArray
list of doors
auth.credentialsObjectyes
auth.credentials.cardsArray
list of card ID (decimal)
auth.credentials.faceImagesString
base64 image
auth.credentials.pinNumber

auth.credentials.phoneNumber


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


FieldTypeNullableRemarks
code
Number
No
API response code
status
Boolean
No
API response status
message
String
No
API response message
dataObjectNo
data.authId
Number
No
data.lastModifiedAt
Number
No
userObjectNo
user.userIdNumberNo
user.keyStringNo
user.nameStringNo
user.realNameAuthStatusTypeStringNo
authObjectNo
auth.startTimeNumberNo
auth.endTimeNumberNo
auth.doorAccessTypeStringNo
auth.scheduleTypeStringNo
auth.scheduleIdNumberYes
auth.doorsObjectYes
auth.doors.doorIdStringYes
auth.doors.doorNameStringYes
auth.credentialsObjectYes
auth.credentials.modesArrayYes
auth.credentials.faceImagesStringYes
auth.credentials.nameStringYes
auth.activeStatusStringNo

 


{
    "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"
        }
    }
}




Retrieve Logs


1. API endpoint and Parameters

[GET] 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={placeID}


Request Header:

KeyTypeRequiredValue
Authorization
JWT TokenyesUse API Key obtained from Suprema
Content-TypeStringyesapplication/json
AcceptStringyes*/*


Query Parameter:

KeyTypeRequiredDescription
startTime
Unix Time (Millisec)noretrieve logs starting this date. Must be within 7 days from the end date.
if not specified, all logs are displayed
endTimeUnix Time (Millisec)noretrieve logs until this date
if not specified, all logs are displayed
filterEventsstringnofilter by events
pageNumbernologs are displayed in multiples pages.
if not specified, displayed in 1 page only.
sizeNumbernonumber of logs to be retirieved from the startTime
qstringnoquery
sortstringnosort 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

 

FieldTypeNullableDescription
code
Number
false
API response code
status
Boolean
false
API response status
message
String
false
API response message
totalNumberfalsetotal number of retrieved logs.
data.logIdNumberfalseCLUe server side's log ID.
data.eventAtUnix TimefalseDate and time when the event occurred.
data.placeIdNumberfalsePlace ID
data.deviceIdNumbertrueDevice ID
data.doorIdNumbertrueDoor ID
data.doorNameStringtrueDoor Name
data.authIdNumbertrueAuthentication ID
data.userIdNumbertrueUser Key
data.useNameStringtrueUser Name
data.localLogIdNumberfalseDevice side's log ID
data.eventTypeEvent Typefalseevent 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

  1. DEV_FACE_AUTH_SUCCESS - The user's face template is registered in CLUe server. Thus, it is successful when user authenticated from the device
  2. VENDOR_AUTH_SUCCESS - It means that the user's ID (example 64455 above) is registered and allowed access from the 3rd party system.
  3. DEV_DOOR_RELAY_ON - The relay of the device is turned ON. Door is unlocked.
  4. 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)