Creation of authorization failed

Hello,
we have our own system which use your API to create auth keypad codes for smartlocks (we have cca 35 smartlocks now). Your server always returns 2xx OK code but sometimes the code is not created in the Nuki for some reason and in that case nuki web account shows error modal with “Creation of authorization failed” message.

We need to be 100% sure at our system that code is successfully created in the smartlock keypad. We tried to activate advanced API and we checked all webhook features in the web but “Creation of authorization failed” is not present in fired webhook events.

How is technically managed “Creation of authorization failed” window event? We would like to do the same mechanism at our system to be notified about unsuccessful creation.

1 Like

Same issue for me.
Also, no webhook is triggered on update authorization (when the code and dates are the same)

Hi Filip and Yossi,

You could get a list of all the authorisations once they are created, run in a loop and check if its name appears.

Another way would be to go for the Advanced API where you can use PUT /smartlock/auth/advanced to get a response with the result from the device(s) on a set webhook URL. (see also Nuki Developers)

Hi Poonam,
endpoint PUT /smartlock/auth/advanced doesn´t look like endpoint which can be used to create smartlock keypad code auths. It has only accountUserId as body param.
Can we get trusted response for creating of smartlock keypad code auths too?

Hi Filip,

In case of unsuccessful authorisation creation, we are skipping the webhook events which have an error code, so the message “Creation of authorisation failed” is shown on the UI but not through the webhook events.

In the event of success authorisation creation, you must look for a web hook event fired for the successful response which looks like:
{
“feature”: “DEVICE_AUTHS”,
“deleted”: false,
“smartlockAuth”: {
“id”: “{AUTH_ID}”,
“smartlockId”: {SL_ID},
“authId”: 4,
“code”: {KP_CODE},
“type”: 13,
“name”: “{KP_CODE_NAME}”,
“enabled”: true,
“remoteAllowed”: true,
“lockCount”: 0,
“creationDate”: “2022-12-12T12:47:17.000Z”,
“updateDate”: “2022-12-12T12:47:17.930Z”
}
}

If you need the error message via the webhook event, we could take it as a feature request. Does this help?

@Yossi_Turjeman - If no data is changed above (such as the codes or date), then no web hook event is fired. This is the expected behavior.