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:

KeyTypeRequiredValue
Authorization
JWT Access TokenyesUse API Key obtained from Suprema or generate your own API key from CLUe Portal. 
Content-TypeStringyesapplication/json
AcceptStringyes*/*


Path Variables:

KeyTypeRequiredDescription
placeId
NumberyesThe assigned placeID of your store.
This will be provided by Suprema in advance.




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.scheduleIdStringno
auth.doorIdsArraynolist of doors
auth.credentialsObjectyes
auth.credentials.cardsArraynolist of card ID (decimal)
auth.credentials.faceImagesArraynobase64 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


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.faceImagesArrayYes
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"
        }
    }
}


■ 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:

KeyTypeRequiredValue
Authorization
JWT Access TokenyesUse API Key obtained from Suprema or generate your own API key from CLUe Portal. 
Content-TypeStringyesapplication/json
AcceptStringyes*/*


Path Variables:

KeyTypeRequiredDescription
authID
NumberyesUnique code assigned to user during user registration.




2. Request Body

Please request below information from your Suprema Agent.

FieldTypeRequiredRemarks
activeStatusString
ACTIVE or INACTIVE
startTimeNumber
Unix Time (Epoch milli second )
endTimeNumber
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


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



■ 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:

KeyTypeRequiredValue
Authorization
JWT Access TokenyesUse API Key obtained from Suprema or generate your own API key from CLUe Portal. 
Content-TypeStringyesapplication/json
AcceptStringyes*/*



■ 

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:

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)