Get Lock Dynamic PIN
Changed onCreates a temporary guest PIN for a smart lock.
PINs work differently on each lock, and each lock needs different inputs:
| Lock | Series | Send | PIN | Usable for |
|---|---|---|---|---|
| Cypheo Elite | G1 | device_id only | 10 digits | about 15 minutes |
| Azhero Smart Door Lock / SL1 | smart_lock_black | device_id, start_time, end_time | 6 digits | the time window you asked for |
How the PIN works on each lock
For G1 Cypheo Elite, the PIN comes from the clock. It is based on the minute it was created. The lock works out the same PIN from its own clock and checks that they match. Nothing is sent to the lock or stored, so the lock does not need to be online. The PIN works for about 15 minutes and you cannot choose the time window. start_time and end_time are not needed and are ignored if sent.
For the Azhero Smart Door Lock / SL1, the PIN is stored on the lock for the time window you choose, so you must send start_time and end_time. If a guest PIN already on the lock covers your time window, that PIN is returned and no new one is created.
Request
| Where | Name | Required | Value |
|---|---|---|---|
| Header | x-api-key | Yes | Your developer API key. |
| Header | Authorization | Yes | Bearer <access_token> |
| Header | Content-Type | Yes | application/json |
| Body | device_id | Yes | A lock on your account. |
| Body | start_time | Only for Azhero / SL1 | When the PIN starts working. UTC epoch seconds. Ignored by G1. |
| Body | end_time | Only for Azhero / SL1 | When the PIN stops working. UTC epoch seconds, later than start_time. Ignored by G1. |
If the device_id is not a lock, you get a 400 error that says what kind of device it is.
Both time fields are epoch seconds, not milliseconds. If you send milliseconds, the time window will be far too long.
Response
{
"status": "Success",
"message": {
"data": {
"otp": "482913",
"validStartTime": 1767304800,
"validEndTime": 1767305039
}
}
}
| Field | Type | Meaning |
|---|---|---|
| message.data.otp | string | The PIN to give your guest. It is a string, not a number, because it can start with 0. |
| message.data.validStartTime | integer | When it starts working, epoch seconds. |
| message.data.validEndTime | integer | When it stops working, epoch seconds. |
Always use the time window from the response. For G1, the time window is short and set by the lock. For Azhero / SL1, it can be wider than you asked for, because an existing guest PIN that covers your time window is reused.
A PIN cannot be cancelled before it expires, so ask for short time windows.
When an Azhero Smart Door Lock / SL1 creates a new PIN, the API returns the reply from the lock's own platform without changing it. Its format can differ from the example above.
Request
- Base URLhttps://api.developer.atomberg-iot.com/v2
- AuthAPI key in header x-api-key and HTTP bearer
Request body
Example request
{
"device_id": "aabbccddee01",
"start_time": 1767304800,
"end_time": 1767330000
}Response
OK
Example response
{
"status": "Success",
"message": {
"data": {
"otp": "482913"
}
}
}Changes
- info
endpoint added
- info