Check if the user has Unloc

The first step of the process is to make sure your user has Unloc, and specifically, if your user has Unloc enabled Locks active at the target location.

Keep in mind that Unloc users can have Unloc enabled Locks at their main residence, office, holiday home, etc. That's why the Get Key Request options end point receives two query parameters: Mobile Phone Number and Postal code.

To check for Unloc enabled Locks for a user at a target location, make a GET request to:

https://api.unloc.app/v1/partners/Your_Service_Provider_ID/key-requests-options/User_Mobile_Phone_number?postalCode=User_postal_code

Example:

curl --location --request GET '<<api_url>>/v1/partners/2a8940de-a223-7afed-012a-e860a55c69c4/key-requests-options/+47666555444?postalCode=4242' \
--header 'Authorization: Bearer Hu99mEigx3OZMIpez9yx1X01HPg+pt99zx+04SLOL='

If the user doesn't have any Unloc enabled Locks at the specified postal code or the Mobile Phone Number is not associated with an Unloc account, the response will be an empty array, like this:

{
    "locks": []
}

On the other hand, if the Mobile Phone Number is associated with an Unloc account and it has Unloc enabled Locks at the location, the array will contain a list of the available Locks:

{
    "locks": [
        {
            "id": "47423a9a-22a9-42bd-9c9e-7d8e22dff545",
            "name": "Building door",
            "isPrivatelyOwned": false,
            "keyCreationOptions": "key-request-not-required"
        },
        {
            "id": "768351d8-7337-423f-8c11-32a5fecb68b6",
            "name": "Apartment door",
            "isPrivatelyOwned": true,
            "keyCreationOptions": "key-request-required"
        },
        {
            "id": "fa98d201-1773-1337-1001-af43a9ae403",
            "name": "Storage room",
            "isPrivatelyOwned": true,
            "keyCreationOptions": "key-request-not-possible"
        }
    ]
}

On your integration, you just need to check if the length of the locks array is greater than 0, if so, then you move on to the next step, that will be creating a Key Request.


What’s Next

Now that you know for sure if your service can be provided for the specified user and location, you can move on to Creating a Key Request:

Did this page help you?