Retrieving Access Codes

Learn how to retrieve access codes using various filters or by referencing their specific IDs

Retrieving All Access Codes for a Device

To retrieve all access codes for a device, include the device_id in the List Access Codes request.

Request:

device_id = "6aae9d08-fed6-4ca5-8328-e36849ab48fe"
access_codes = seam.access_codes.list(device=device_id)

pprint(access_codes)

Response:

[AccessCode(access_code_id='1bbd1eba-e4a2-4f96-b1b9-8498a5405b2b',
            device_id='6aae9d08-fed6-4ca5-8328-e36849ab48fe',
            type='time_bound',
            code='2345',
            created_at='2023-10-19T02:21:58.738Z',
            errors=[],
            warnings=[],
            starts_at='2025-01-01T16:00:00.000Z',
            ends_at='2025-01-22T12:00:00.000Z',
            name='my time-bound code',
            status='unset',
            common_code_key=None,
            is_managed=True,
            is_waiting_for_code_assignment=None,
            is_scheduled_on_device=False,
            pulled_backup_access_code_id=None,
            is_backup_access_code_available=False,
            is_backup=None,
            appearance=None,
            is_external_modification_allowed=False),
 AccessCode(access_code_id='daf89de3-ad3a-49aa-93bd-25f27d58f699',
            device_id='6aae9d08-fed6-4ca5-8328-e36849ab48fe',
            type='ongoing',
            code='1234',
            created_at='2023-10-19T02:15:04.911Z',
            errors=[],
            warnings=[],
            starts_at=None,
            ends_at=None,
            name='my ongoing code',
            status='set',
            common_code_key=None,
            is_managed=True,
            is_waiting_for_code_assignment=None,
            is_scheduled_on_device=None,
            pulled_backup_access_code_id=None,
            is_backup_access_code_available=False,
            is_backup=None,
            appearance={'first_name': 'my',
                        'last_name': 'ongoing code',
                        'name': 'my ongoing code'},
            is_external_modification_allowed=False)]

Retrieving Access Codes Using Access Code IDs

To retrieve access codes by IDs, include the desired access_code_ids in the List Access Codes request.

Request:

access_code_ids = [
    "1bbd1eba-e4a2-4f96-b1b9-8498a5405b2b",
    "daf89de3-ad3a-49aa-93bd-25f27d58f699"
]
access_codes = seam.access_codes.list(access_codes=access_code_ids)

pprint(access_codes)

Response:

[AccessCode(access_code_id='1bbd1eba-e4a2-4f96-b1b9-8498a5405b2b',
            device_id='6aae9d08-fed6-4ca5-8328-e36849ab48fe',
            type='time_bound',
            code='2345',
            created_at='2023-10-19T02:21:58.738Z',
            errors=[],
            warnings=[],
            starts_at='2025-01-01T16:00:00.000Z',
            ends_at='2025-01-22T12:00:00.000Z',
            name='my time-bound code',
            status='unset',
            common_code_key=None,
            is_managed=True,
            is_waiting_for_code_assignment=None,
            is_scheduled_on_device=False,
            pulled_backup_access_code_id=None,
            is_backup_access_code_available=False,
            is_backup=None,
            appearance=None,
            is_external_modification_allowed=False),
 AccessCode(access_code_id='daf89de3-ad3a-49aa-93bd-25f27d58f699',
            device_id='6aae9d08-fed6-4ca5-8328-e36849ab48fe',
            type='ongoing',
            code='1234',
            created_at='2023-10-19T02:15:04.911Z',
            errors=[],
            warnings=[],
            starts_at=None,
            ends_at=None,
            name='my ongoing code',
            status='set',
            common_code_key=None,
            is_managed=True,
            is_waiting_for_code_assignment=None,
            is_scheduled_on_device=None,
            pulled_backup_access_code_id=None,
            is_backup_access_code_available=False,
            is_backup=None,
            appearance={'first_name': 'my',
                        'last_name': 'ongoing code',
                        'name': 'my ongoing code'},
            is_external_modification_allowed=False)]

Retrieving Individual Access Codes

To retrieve a specific access code, include the desired access_code_id in the Get Access Code request.

Request:

access_code_id = "daf89de3-ad3a-49aa-93bd-25f27d58f699"
access_code = seam.access_codes.get(access_code_id)

pprint(access_code)

Response:

AccessCode(access_code_id='daf89de3-ad3a-49aa-93bd-25f27d58f699',
           device_id='6aae9d08-fed6-4ca5-8328-e36849ab48fe',
           type='ongoing',
           code='1234',
           created_at='2023-10-19T02:15:04.911Z',
           errors=[],
           warnings=[],
           starts_at=None,
           ends_at=None,
           name='my ongoing code',
           status='set',
           common_code_key=None,
           is_managed=True,
           is_waiting_for_code_assignment=None,
           is_scheduled_on_device=None,
           pulled_backup_access_code_id=None,
           is_backup_access_code_available=False,
           is_backup=None,
           appearance={'first_name': 'my',
                       'last_name': 'ongoing code',
                       'name': 'my ongoing code'},
           is_external_modification_allowed=False)

Last updated

Logo

© Seam Labs, Inc. All rights reserved.