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 ACS. 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.
Retrieve a credential manager for your Latch ACS.
Set up an enrollment automation for the user identity, to enable mobile keys.
Create an ACS user on the Latch ACS or assign an existing ACS user to the user identity. The resources that you create for the ACS user are available under the associated user identity.
In the ACS user creation command, set the
user_identity_id
property for a new ACS user. Alternately, use theadd_acs_user
command for user identities to assign an existing ACS user to a user identity.If you choose to create a new ACS user, specify the
acs_system_id
of the Latch ACS in the building to which you want to grant the new user access.Specify the details of the ACS user, such as their
full_name
,email_address
, and so on.
Create an ACS 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 ACS 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:
# Retrieve a credential manager.
latch_credential_manager = seam.acs.systems.list_compatible_credential_manager_acs_systems(
acs_system_id=building_a.acs_system_id
)[0]
# Step 3:
# Set up an enrollment automation for the user identity, to enable mobile keys.
seam.user_identities.enrollment_automations.launch(
user_identity_id=jane_user.user_identity_id,
create_credential_manager_user=True,
credential_manager_acs_system_id=latch_credential_manager.acs_system_id
)
# Step 4:
# Create an ACS user on the Latch ACS
# or assign the ACS user to the user identity.
building_a_resident = seam.acs.users.create(
# To associate the ACS user with a user identity,
# include the user_identity_id.
# Resources that you create for this ACS 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 5:
# Create a mobile key for the entrances to which
# you want to grant the ACS 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?