Web API Example: Fob with changing restrictions

Preparation

Pair a fob with your smartlock via the Nuki App.

Authenticate

See Authentification. Use the access token as e.g. ACCESS_TOKEN .

Get the fob ID:

curl -X GET --header 'Accept: application/json' --header 'Authorization: Bearer ACCESS_TOKEN' 
'https://api.nuki.io/smartlock/SMARTLOCK_ID/auth'

with fobs having 'type' : 2.

Edit a fob-key

See also Web API Example: Create a key for your Nuki Smart Lock

e.g. allow access from now on for all weekdays without further restrictions:

curl -X POST --header 'Content-Type: application/json' --header 'Accept: application/json' --header 'Authorization: Bearer ACCESS_TOKEN' -d '{ \
"allowedFromDate": "2019-01-01T00:00Z", \
"allowedWeekDays": 124 \
}' 'https://api.nuki.io/smartlock/SMARTLOCK_ID/auth/KEY_ID'

To remove an allowedUntilDate again you have to set it to Null.

curl -X POST --header 'Content-Type: application/json' --header 'Accept: application/json' --header 'Authorization: Bearer ACCESS_TOKEN' -d '{ \
"allowedUntilDate": Null \
}' 'https://api.nuki.io/smartlock/SMARTLOCK_ID/auth/KEY_ID'