Skip to content

Users API

The Users API is a part of the Integrators API, and is used to work with users in relation to a lock holder.

Using these endpoints requires having a JWT scoped for the Lock Holder.
See Authentication for details.

If you don't have a Lock Holder yet you can create one using the Lock Holder API

Endpoints

Get all users

This endpoint will be deprecated soon.
The data returned can be aggregated from the Roles and Keys APIs instead

GET integrators/v1/lock-holders/:lockHolderId/users

Returns a list of all users with keys or roles on locks belonging to the specified lock holder.

Request

Field Optional Type Location Description
lockHolderId no string url Id of the lock holder. Must match the one in the JWT scope.

Example: GET https://api.unloc.app/integrators/v1/lock-holders/5d7c7d59-dd94-4b0e-8df4-501c028e37ea/users

Response

200

Returns an array named "users", with each entry having the following fields:

Field Optional Type Location Description
userId no string body E.164-formatted phone number
userDisplayName no string body Displayname for this user, fetched from Role. Will be empty if displayname is not set or if user has no roles. We have no guarantee for which name is picked if the roles have different display names.
keysCount no number body Number of keys this user has been given via the Keys API.
rolesCount no number body Number of Roles this user has.

Example:

{
    "users": [
        { 
            "userId": "+61452912447",
            "userDisplayName": "User A",
            "keysCount": 1,
            "rolesCount": 1 
        },
        { 
            "userId": "+61452912448",
            "userDisplayName": "",
            "keysCount": 2,
            "rolesCount": 0 
        },
        { 
            "userId": "+61452912449",
            "userDisplayName": "User B",
            "keysCount": 3,
            "rolesCount": 2 
        },
    ]
}

4xx
Field Optional Type Location Description
error no string body The type of error that occurred
error_description no string body Verbose description of the error

Example:

{ 
    "error": "notFound",
    "error_description": "Could not find lock holder"
}

Delete all shared keys

DELETE integrators/v1/lock-holders/:lockHolderId/users/:userId/shared-keys

Delete all keys a user have shared to locks belonging to this lock holder.

Request

Field Optional Type Location Description
lockHolderId no string url Id of the lock holder. Must match the one in the JWT scope.
userId no string url URL-Encoded E.164-formatted id for the user

Example: DELETE https://api.unloc.app/integrators/v1/lock-holders/5d7c7d59-dd94-4b0e-8df4-501c028e37ea/users/%2B61452912447/shared-keys

Response

200

Returns the number of keys deleted

Field Optional Type Location Description
keysDeleted no number body The number of keys deleted

Example:

{
    "keysDeleted": 1
}

4xx
Field Optional Type Location Description
error no string body The type of error that occurred
error_description no string body Verbose description of the error

Example:

{ 
    "error": "notFound",
    "error_description": "Could not find lock holder"
}