Bluetooth API

1. Terms of Use

Thank you for using one of NUKI’s Application Programming Interfaces. By accessing or using our APIs, you are agreeing to NUKI’s Terms of Use API’s - Nuki

2. Introduction

Bluetooth-API documentation contains a description of the Bluetooth protocol used by the Nuki Smart Lock, the encryption functions in use and some communication examples.

3. Bluetooth GATT services

See: Bluetooth GATT services

4. Message Format

Terminology

ADATA (additional data) data that is not encrypted (e.g. protocol data)
PDATA (plaintext) data to be encrypted and authenticated

ADATA:

  • nonce (number only used once, NEVER reused with same secret key)
  • authorization identifier
  • message length

PDATA:

  • command identifier
  • payload data depending on command
  • CRC

Transfer format for encrypted messages

ADATA PDATA
nonce authorization identifier message length
24 Byte 4 Byte 2 Byte
unencrypted unencrypted unencrypted
authorization identifier command identifier payload CRC
4 Byte 2 Byte n Byte 2 Byte
encrypted encrypted encrypted encrypted
PDATA    
command identifier payload CRC
2 Byte n Byte 2 Byte
unencrypted  

CRC calculation

Algorithm: CRC-CCITT
Polynomial representation: normal (0x1021)
Initial remainder: 0xFFFF

5. Encryption

See: Bluetooth API Encryption

6. Commands

See: Nuki Developers

7. Error codes

See: Nuki Developers

8. Status Codes

Code Name Usage
0x00 COMPLETE Returned to signal the successful completion of a command
0x01 ACCEPTED Returned to signal that a command has been accepted but the completion status will be signaled later.

9. List of Timezone IDs

See: Nuki Developers

10. Command usage examples

see PDF file for now

Complete document:

Nuki Smart Lock Bluetooth API Documentation 2.1 as PDF download

Updated the document:

Changelog v.2.0.0

New:

0x0031 - 0x0034: Reworked log commands

0x0035 - 0x0037: Advanced config commands

0x0039 - 0x003F: Time control commands

0x0041 - 0x0048: Keypad commands

Updated:

0x000C: Updated Smart Lock states for scheduled events, auto-lock and the door sensor

0x0011: Added more details to the battery report command

0x0015: Added Homekit status

0x000C, 0x0013, 0x0015: Added Timezone support

Error codes: More detailed error codes available

Removed:

0x0022, 0x0023, 0x0024, 0x0026: Replaced log commands

1 Like

Hello, Please help me. I received message from NUKI fter getstate (0x0C) command"<Buffer 38 a3 62 75 41 0f 40 89 1e fa d2 2d e5 3e 2a 65 80 0a 71 02 bf 80 ab ee 03 01 00 00 25 00 25 3b 70 07 d9 ae bd 64 52 4e>". What is it? Decrypted method failed with [Error: BAD_MSG]