Programming Latch ACS Mobile Credentials
Learn how to create mobile credentials in the Latch ACS.
You can create mobile credentials that enable your mobile app users to unlock entrances in your Latch access system. For more information about Seam mobile keys, see Mobile Access.
To use the Seam API to create mobile credentials for mobile app users in a Latch ACS:
Create a user identity that corresponds to your user's app account.
Seam user identities enable you to match your own mobile app users to ACS users that you create using the Seam API.
Create an access system user on the Latch access system or assign an existing access system user to the user identity. The resources that you create for the access system user are available under the associated user identity.
In the access system user creation command, set the
user_identity_id
property for a new access system user. Alternately, use theadd_acs_user
command for user identities to assign an existing access system user to a user identity.If you choose to create a new access system user, specify the
acs_system_id
of the Latch access system in the building to which you want to grant the new user access.Specify the details of the access system user, such as their
full_name
,email_address
, and so on.
Create a credential to represent the mobile key.
Specify the
acs_user_id
.Set
is_multi_phone_sync_credential
totrue
.Set the
access_method
tomobile_key
.Specify the IDs of the entrances to which you want to grant access. Note that you can include multiple entrances in a single mobile key credential.
Specify the desired start and end dates and times for this access.
Creating a new
acs_credential
object prompts the Latch access system to generate a PIN code for the user.
The following example walks you through this process:
Code:
# Step 1:
# Create a user identity that corresponds to your user's mobile app account.
jane_user = seam.user_identities.create(
email_address = "[email protected]"
)
# Step 2:
# Create an access system user on the Latch access system
# or assign the ACS user to the user identity.
building_a_resident = seam.acs.users.create(
# To associate the access system user with a user identity,
# include the user_identity_id.
# Resources that you create for this access system user
# are available under the associated user identity.
user_identity_id = jane_user.user_identity_id,
acs_system_id = building_a.acs_system_id,
full_name = "Jane Doe",
email_address = "[email protected]"
)
# Step 3:
# Create a mobile key for the entrances to which
# you want to grant the access system user access.
mobile_key = seam.acs.credentials.create(
acs_user_id = building_a_resident.acs_user_id,
is_multi_phone_sync_credential = True,
access_method = "mobile_key",
allowed_acs_entrance_ids = [
# You can include multiple entrances per mobile key.
room_entrance.acs_entrance_id,
common_door_entrance.acs_entrance_id
],
starts_at = "2024-07-13T16:50:42.072Z",
ends_at = "2024-07-18T16:50:42.072Z"
)
pprint(mobile_key)
# It is also useful to list the entrances
# to which the mobile key grants access.
seam.acs.credentials.list_accessible_entrances(
acs_credential_id = mobile_key.acs_credential_id
)
Output:
AcsCredential(
acs_credential_id='66666666-6666-6666-6666-666666666666',
acs_user_id='33333333-3333-3333-3333-333333333333',
access_method='mobile_key',
starts_at='2024-07-13T16:50:42.072Z',
ends_at='2024-07-18T16:50:42.072Z',
...
)
[
AcsEntrance(
acs_entrance_id='55555555-5555-5555-5555-555555555555',
display_name='Room Entrance',
...
),
AcsEntrance(
acs_entrance_id='55555555-5555-5555-5555-000000000000',
display_name='Common Door Entrance',
...
)
]
Next Steps
To learn more about using the Seam API with your Latch ACS, see the following topics:
Access Control Systems in the Seam API reference
User Identities in the Seam API reference
Last updated
Was this helpful?