Implementation guide
Lock provisioning (activation, setup, and access)
The lock setup and activation is handled using the Master Lock Connected Products Web API. For the latest details, always refer to the official API specification. In general, you’ll need the following steps to provision a lock, retrieve its information, and provision a new access profile for your users.Step 1: API authentication
Use the/authenticate endpoint to retrieve an API token by using your license and password.
Step 2: Activate a lock (optional)
Use the/v2/device/activate endpoint to activate a new lock. Skip this step if your locks are already provisioned.
Step 3: Retrieve lock information
Use the/v2/device endpoint to obtain the Firmware Version of your lock(s). The Firmware Version is a required parameter to unlock the lock using the SDK.
Step 4: Create an access profile
Use the/v2/device/accessprofile/create endpoint to create a new temporary access profile for your users. Make sure the access profile has the Unlock permission, otherwise the user won’t be able to unlock the Bluetooth locks.
There are multiple API endpoints to create access profiles. The endpoint above creates a single profile for a single lock, but you can also create an access profile for multiple locks, or multiple access profiles for a single lock.
Note: access profile permissions
Always validate with the latest permissions outlined in the Master Lock Access Profile and Permissions documentation.
JavaScript Bridge functions
Plugin permissions
The Master Lock plugin requires Bluetooth and location permissions to scan for and interact with nearby locks. These permissions are requested automatically at runtime. If you prefer to check and request permissions before initializing the plugin, see the permissions overview for implementation details.Initialize Master Lock SDK
The SDK must be initialized before scanning or unlocking. This design supports multiple Master Lock licenses within the same app.Scan for locks
Discover nearby Master Lock devices. You can define a scanning timeout in milliseconds (otherwise a default value of 15 seconds is used) and define functions for each of the following events:onScanStart: App started scanning for nearby locks.onScanStop: App stopped scanning for nearby locks.onDeviceDiscover: App discovered locks.
Unlock a lock
Unlocking requires the Device ID, Access Profile, Firmware Version, and a timeout value (in milliseconds).deviceId: The lock’s unique identifier, available during setup or from the Master Lock API.accessProfile: Profile generated via the Master Lock API.firmwareVersion: Lock firmware version.mechanism: Defines the primary or secondary lock mechanism.timeout: Time in ms before auto-relock.
Update firmware
Initiate an OTA firmware update on a Master Lock device. The update process runs automatically once initiated.deviceId: The lock’s unique identifier.accessProfile: Profile generated via the Master Lock API.currentFirmwareVersion: Current firmware version on the lock.targetFirmwareVersion: Target firmware version to update to (from Master Lock API).
Firmware update listener
Subscribe to firmware update state changes and progress. Use this to display real-time progress to users.deviceId: The lock being updated.state: Current state:downloading,downloadComplete,applying,validating,done, orerror.percentage: Progress percentage (0-100), only populated when state isapplying.error: Error details when state iserror.
Lock reset
Perform a lock reset to invalidate all access profiles, temporary codes, and secondary codes. Use this when re-keying a lock or revoking all access. Lock reset is only available for the D1000 Deadbolt.deviceId: The lock’s unique identifier.accessProfile: Profile generated via the Master Lock API.firmwareVersion: Lock firmware version.
success: Boolean indicating if reset completed.deviceId: The lock that was reset.accessProfilesInvalidated: Confirms access profiles are now invalid.temporaryCodesInvalidated: Confirms temporary codes are now invalid.secondaryCodesErased: Confirms secondary codes have been erased.
Get deadbolt handedness
Read the current bolt direction configuration from a D1000 Deadbolt. This is useful for displaying the current configuration in your app UI.deviceId: The lock’s unique identifier.accessProfile: Profile generated via the Master Lock API.firmwareVersion: Lock firmware version.
success: Boolean indicating if read completed.deviceId: The lock that was queried.handedness: Current configuration:leftorright.
Set deadbolt handedness
Configure the bolt direction on a D1000 Deadbolt. This must be set correctly for proper unlock/relock motor operation.deviceId: The lock’s unique identifier.accessProfile: Profile generated via the Master Lock API.firmwareVersion: Lock firmware version.handedness: The desired bolt direction:leftorright.
success: Boolean indicating if configuration was saved.handedness: The configured handedness.
Determining handednessStand inside the door looking at the thumbturn side of the deadbolt:
- If the bolt is on the left and extends left → use
left - If the bolt is on the right and extends right → use
right
Relock (D1000 Deadbolt only)
Manually relock a D1000 Deadbolt by extending the bolt to the locked position. This is required because the D1000 does not support automatic relocking like padlocks and lockboxes.deviceId: The lock’s unique identifier.accessProfile: Profile generated via the Master Lock API.firmwareVersion: Lock firmware version.
success: Boolean indicating if relock completed.deviceId: The lock that was relocked.
Testing your integration
Test environmentHardware-dependent features cannot be tested using simulators. You’ll need a physical Master Lock padlock or lockbox.For iOS, test on a physical device using TestFlight after an App Studio distribution build, or install a development IPA on registered tester devices. A local Xcode build is only needed if you are building from downloaded source. For Android, download and install the APK from App Studio.
- Activate and set up a lock using the Master Lock API.
- Collect the Device ID and Firmware Version using the Master Lock API.
- Create a new access profile via the API.
- Switch to your mobile app and initialize the SDK by providing your license key.
- Use the collected parameters to unlock the test lock.
- The lock automatically re-locks after the configured timeout.
Frequently asked questions
Can I manually relock my padlock or lockbox?
Can I manually relock my padlock or lockbox?
No. Padlocks and lockboxes cannot be manually re-locked via the integration. They automatically lock after a preset timeout.
How do I relock my D1000 Deadbolt?
How do I relock my D1000 Deadbolt?
The D1000 Deadbolt does not support automatic relocking. Use the
median.masterlock.relock() method to manually extend the bolt to the locked position. Ensure you have configured the correct handedness before calling this method.Why am I receiving a "Not Permitted" error when unlocking?
Why am I receiving a "Not Permitted" error when unlocking?
This error indicates the access profile does not include the required permissions for the lock type. Confirm that the correct permissions (e.g.
Unlock, UnlockDoor, or UnlockShackle) are assigned to the access profile.Full error response:What happens if a firmware update is interrupted?
What happens if a firmware update is interrupted?
If an update is interrupted or fails, the lock will remain in bootloader mode until the update is completed. You should retry the firmware update to restore normal lock operation.
Why do I need to set deadbolt handedness?
Why do I need to set deadbolt handedness?
The D1000 Deadbolt needs to know which direction the bolt extends so the motor operates correctly during unlock and relock commands. Incorrect handedness configuration will cause the motor to turn the wrong direction.