/* * Automatically generated by codegen/smith.ts. * Do not edit this file. */ /** * Represents a smart lock [access code](https://docs.seam.co/low-level-apis/smart-locks/access-codes). * * An access code is a code used for a keypad or pinpad device. Unlike physical keys, which can easily be lost or duplicated, PIN codes can be customized, tracked, and altered on the fly. Using the Seam Access Code API, you can easily generate access codes on the hundreds of door lock models with which we integrate. * * Seam supports programming two types of access codes: [ongoing](https://docs.seam.co/low-level-apis/smart-locks/access-codes#ongoing-access-codes) and [time-bound](https://docs.seam.co/low-level-apis/smart-locks/access-codes#time-bound-access-codes). To differentiate between the two, refer to the `type` property of the access code. Ongoing codes display as `ongoing`, whereas time-bound codes are labeled `time_bound`. An ongoing access code is active, until it has been removed from the device. To specify an ongoing access code, leave both `starts_at` and `ends_at` empty. A time-bound access code will be programmed at the `starts_at` time and removed at the `ends_at` time. * * In addition, for certain devices, Seam also supports [offline access codes](https://docs.seam.co/low-level-apis/smart-locks/access-codes#offline-access-codes). Offline access (PIN) codes are designed for door locks that might not always maintain an internet connection. For this type of access code, the device manufacturer uses encryption keys (tokens) to create server-based registries of algorithmically-generated offline PIN codes. Because the tokens remain synchronized with the managed devices, the locks do not require an active internet connection—and you do not need to be near the locks—to create an offline access code. Then, owners or managers can share these offline codes with users through a variety of mechanisms, such as messaging applications. That is, lock users do not need to install a smartphone application to receive an offline access code. * * For granting a person access to a space, [Access Grants](https://docs.seam.co/use-cases/granting-access) are the default and recommended approach and work across both standalone smart locks and access systems. Use the lower-level Access Codes API directly only when you specifically need to manage individual PIN codes. */ export type AccessCode = { /** * Unique identifier for the access code. */ access_code_id: string /** * Code used for access. Typically, a numeric or alphanumeric string. */ code: string | null /** * Unique identifier for a group of access codes that share the same code. */ common_code_key: string | null /** * Date and time at which the access code was created. */ created_at: string /** * Unique identifier for the device associated with the access code. */ device_id: string /** * Metadata for a dormakaba Oracode managed access code. Only present for access codes from dormakaba Oracode devices. */ dormakaba_oracode_metadata?: | { /** * Indicates whether the stay can be cancelled via the Dormakaba Oracode API. */ is_cancellable?: boolean | undefined /** * Indicates whether early check-in is available for this stay. */ is_early_checkin_able?: boolean | undefined /** * Indicates whether the stay can be extended via the Dormakaba Oracode API. */ is_extendable?: boolean | undefined /** * Indicates whether the access code can be overridden. When false, the maximum number of overrides has been reached. */ is_overridable?: boolean | undefined /** * Dormakaba Oracode site name associated with this access code. */ site_name?: string | undefined /** * Dormakaba Oracode stay ID associated with this access code. */ stay_id?: number | undefined /** * Dormakaba Oracode user level ID associated with this access code. */ user_level_id?: string | undefined /** * Dormakaba Oracode user level name associated with this access code. */ user_level_name?: string | null | undefined } | null | undefined /** * Date and time after which the time-bound access code becomes inactive. */ ends_at?: string | null | undefined /** * Errors associated with the [access code](https://docs.seam.co/low-level-apis/smart-locks/access-codes). */ errors: Array< /** * Indicates a provider-specific issue that prevents the access code from being set or managed. Check the error message for details. */ | { /** * Date and time at which Seam created the error. */ created_at?: string | undefined /** * Unique identifier of the type of error. Enables quick recognition and categorization of the issue. */ error_code: 'provider_issue' /** * Indicates that this is an access code error. */ is_access_code_error: boolean /** * Detailed description of the error. Provides insights into the issue and potentially how to rectify it. */ message: string } /** * Failed to set code on device. */ | { /** * Date and time at which Seam created the error. */ created_at?: string | undefined /** * Unique identifier of the type of error. Enables quick recognition and categorization of the issue. */ error_code: 'failed_to_set_on_device' /** * Indicates that this is an access code error. */ is_access_code_error: boolean /** * Detailed description of the error. Provides insights into the issue and potentially how to rectify it. */ message: string } /** * Failed to remove code from device. */ | { /** * Date and time at which Seam created the error. */ created_at?: string | undefined /** * Unique identifier of the type of error. Enables quick recognition and categorization of the issue. */ error_code: 'failed_to_remove_from_device' /** * Indicates that this is an access code error. */ is_access_code_error: boolean /** * Detailed description of the error. Provides insights into the issue and potentially how to rectify it. */ message: string } /** * Duplicate access code detected on device. */ | { /** * Date and time at which Seam created the error. */ created_at?: string | undefined /** * Unique identifier of the type of error. Enables quick recognition and categorization of the issue. */ error_code: 'duplicate_code_on_device' /** * Indicates that this is an access code error. */ is_access_code_error: boolean /** * ID of the managed access code that conflicts with this managed access code, when Seam can identify it. */ managed_access_code_id?: string | undefined /** * Detailed description of the error. Provides insights into the issue and potentially how to rectify it. */ message: string /** * ID of the unmanaged access code that conflicts with this managed access code, when Seam can identify it. */ unmanaged_access_code_id?: string | undefined } /** * No space for access code on device. */ | { /** * Date and time at which Seam created the error. */ created_at?: string | undefined /** * Unique identifier of the type of error. Enables quick recognition and categorization of the issue. */ error_code: 'no_space_for_access_code_on_device' /** * Indicates that this is an access code error. */ is_access_code_error: boolean /** * Detailed description of the error. Provides insights into the issue and potentially how to rectify it. */ message: string } /** * Code was modified or removed externally after Seam successfully set it on the device. The external change conflicts with the state that Seam is trying to apply, so Seam will attempt to set the code on the device again. */ | { /** * Indicates the type of external modification. `modified` means the code's PIN or schedule was changed. `removed` means the code was deleted from the device. */ change_type?: 'modified' | 'removed' | undefined /** * Date and time at which Seam created the error. */ created_at?: string | undefined /** * Unique identifier of the type of error. Enables quick recognition and categorization of the issue. */ error_code: 'conflicting_external_modification' /** * Indicates that this is an access code error. */ is_access_code_error: boolean /** * Detailed description of the error. Provides insights into the issue and potentially how to rectify it. */ message: string /** * List of fields that were changed externally, with their previous and new values. */ modified_fields?: | Array<{ /** * The name of the field that was changed (e.g. `code`, `starts_at`, `ends_at`). */ field: string /** * The previous value of the field. */ from: string | null /** * The new value of the field. */ to: string | null }> | undefined } /** * Indicates that the access code is disabled or inactive on the device. The code exists but will not grant access until re-enabled. */ | { /** * Date and time at which Seam created the error. */ created_at?: string | undefined /** * Unique identifier of the type of error. Enables quick recognition and categorization of the issue. */ error_code: 'access_code_inactive' /** * Indicates that this is an access code error. */ is_access_code_error: boolean /** * Detailed description of the error. Provides insights into the issue and potentially how to rectify it. */ message: string } /** * Admin role required—insufficient permissions to manage PINs on this device. Please have an admin update your role, or ask them to set the PIN. */ | { /** * Date and time at which Seam created the error. */ created_at?: string | undefined /** * Unique identifier of the type of error. Enables quick recognition and categorization of the issue. */ error_code: 'insufficient_permissions' /** * Indicates that this is an access code error. */ is_access_code_error: boolean /** * Detailed description of the error. Provides insights into the issue and potentially how to rectify it. */ message: string } /** * Indicates that the account is disconnected. */ | { /** * Date and time at which Seam created the error. */ created_at: string /** * Unique identifier of the type of error. Enables quick recognition and categorization of the issue. */ error_code: 'account_disconnected' /** * Indicates that the error is a [connected account](https://docs.seam.co/api/connected_accounts) error. */ is_connected_account_error: boolean /** * Indicates that the error is not a device error. */ is_device_error: boolean /** * Detailed description of the error. Provides insights into the issue and potentially how to rectify it. */ message: string } /** * Indicates that the Salto site user limit has been reached. */ | { /** * Date and time at which Seam created the error. */ created_at: string /** * Unique identifier of the type of error. Enables quick recognition and categorization of the issue. */ error_code: 'salto_ks_subscription_limit_exceeded' /** * Indicates that the error is a [connected account](https://docs.seam.co/api/connected_accounts) error. */ is_connected_account_error: boolean /** * Indicates that the error is not a device error. */ is_device_error: boolean /** * Detailed description of the error. Provides insights into the issue and potentially how to rectify it. */ message: string } /** * Indicates that one or more dormakaba sites associated with the connected account could not be connected. Contact dormakaba support. */ | { /** * Date and time at which Seam created the error. */ created_at: string /** * Unique identifier of the type of error. Enables quick recognition and categorization of the issue. */ error_code: 'dormakaba_sites_disconnected' /** * Indicates that the error is a [connected account](https://docs.seam.co/api/connected_accounts) error. */ is_connected_account_error: boolean /** * Indicates that the error is not a device error. */ is_device_error: boolean /** * Detailed description of the error. Provides insights into the issue and potentially how to rectify it. */ message: string } /** * Indicates that the device is offline. */ | { /** * Date and time at which Seam created the error. */ created_at: string /** * Unique identifier of the type of error. Enables quick recognition and categorization of the issue. */ error_code: 'device_offline' /** * Indicates that the error is a device error. */ is_device_error: boolean /** * Detailed description of the error. Provides insights into the issue and potentially how to rectify it. */ message: string } /** * Indicates that the device has been removed. */ | { /** * Date and time at which Seam created the error. */ created_at: string /** * Unique identifier of the type of error. Enables quick recognition and categorization of the issue. */ error_code: 'device_removed' /** * Indicates that the error is a device error. */ is_device_error: boolean /** * Detailed description of the error. Provides insights into the issue and potentially how to rectify it. */ message: string } /** * Indicates that the hub is disconnected. */ | { /** * Date and time at which Seam created the error. */ created_at: string /** * Unique identifier of the type of error. Enables quick recognition and categorization of the issue. */ error_code: 'hub_disconnected' /** * Indicates that the error is a device error. */ is_device_error: boolean /** * Detailed description of the error. Provides insights into the issue and potentially how to rectify it. */ message: string } /** * Indicates that the device is disconnected. */ | { /** * Date and time at which Seam created the error. */ created_at: string /** * Unique identifier of the type of error. Enables quick recognition and categorization of the issue. */ error_code: 'device_disconnected' /** * Indicates that the error is a device error. */ is_device_error: boolean /** * Detailed description of the error. Provides insights into the issue and potentially how to rectify it. */ message: string } /** * Indicates that the [backup access code pool](https://docs.seam.co/low-level-apis/smart-locks/access-codes/backup-access-codes) is empty. */ | { /** * Date and time at which Seam created the error. */ created_at: string /** * Unique identifier of the type of error. Enables quick recognition and categorization of the issue. */ error_code: 'empty_backup_access_code_pool' /** * Indicates that the error is a device error. */ is_device_error: boolean /** * Detailed description of the error. Provides insights into the issue and potentially how to rectify it. */ message: string } /** * Indicates that the user is not authorized to use the August lock. */ | { /** * Date and time at which Seam created the error. */ created_at: string /** * Unique identifier of the type of error. Enables quick recognition and categorization of the issue. */ error_code: 'august_lock_not_authorized' /** * Indicates that the error is a device error. */ is_device_error: boolean /** * Detailed description of the error. Provides insights into the issue and potentially how to rectify it. */ message: string } /** * Indicates that device credentials are missing. */ | { /** * Date and time at which Seam created the error. */ created_at: string /** * Unique identifier of the type of error. Enables quick recognition and categorization of the issue. */ error_code: 'missing_device_credentials' /** * Indicates that the error is a device error. */ is_device_error: boolean /** * Detailed description of the error. Provides insights into the issue and potentially how to rectify it. */ message: string } /** * Indicates that the auxiliary heat is running. */ | { /** * Date and time at which Seam created the error. */ created_at: string /** * Unique identifier of the type of error. Enables quick recognition and categorization of the issue. */ error_code: 'auxiliary_heat_running' /** * Indicates that the error is a device error. */ is_device_error: boolean /** * Detailed description of the error. Provides insights into the issue and potentially how to rectify it. */ message: string } /** * Indicates that a subscription is required to connect. */ | { /** * Date and time at which Seam created the error. */ created_at: string /** * Unique identifier of the type of error. Enables quick recognition and categorization of the issue. */ error_code: 'subscription_required' /** * Indicates that the error is a device error. */ is_device_error: boolean /** * Detailed description of the error. Provides insights into the issue and potentially how to rectify it. */ message: string } /** * Indicates that the Seam API cannot communicate with [Seam Bridge](https://docs.seam.co/capability-guides/seam-bridge), for example, if the Seam Bridge executable has stopped or if the computer running the Seam Bridge executable is offline. See also [Troubleshooting Your Access Control System](https://docs.seam.co/low-level-apis/access-systems/troubleshooting-your-access-control-system#acs_system-errors-seam_bridge_disconnected). */ | { /** * Date and time at which Seam created the error. */ created_at: string /** * Unique identifier of the type of error. Enables quick recognition and categorization of the issue. */ error_code: 'bridge_disconnected' /** * Indicates whether the error is related to [Seam Bridge](https://docs.seam.co/capability-guides/seam-bridge). */ is_bridge_error?: boolean | undefined /** * Indicates whether the error is related specifically to the connected account. */ is_connected_account_error?: boolean | undefined /** * Detailed description of the error. Provides insights into the issue and potentially how to rectify it. */ message: string } > /** * Indicates whether the access code is a backup code. */ is_backup?: boolean | undefined /** * Indicates whether a backup access code is available for use if the primary access code is lost or compromised. */ is_backup_access_code_available: boolean /** * Indicates whether changes to the access code from external sources are permitted. */ is_external_modification_allowed: boolean /** * Indicates whether Seam manages the access code. */ is_managed: boolean /** * Indicates whether the access code is intended for use in offline scenarios. If `true`, this code can be created on a device without a network connection. */ is_offline_access_code: boolean /** * Indicates whether the access code can only be used once. If `true`, the code becomes invalid after the first use. */ is_one_time_use: boolean /** * Indicates whether the code is set on the device according to a preconfigured schedule. */ is_scheduled_on_device?: boolean | undefined /** * Indicates whether the access code is waiting for a code assignment. */ is_waiting_for_code_assignment?: boolean | undefined /** * Name of the access code. Enables administrators and users to identify the access code easily, especially when there are numerous access codes. Note that the name provided on Seam is used to identify the code on Seam and is not necessarily the name that will appear in the lock provider's app or on the device. This is because lock providers may have constraints on names, such as length, uniqueness, or characters that can be used. In addition, some lock providers may break down names into components such as `first_name` and `last_name`. To provide a consistent experience, Seam identifies the code on Seam by its name but may modify the name that appears on the lock provider's app or on the device. For example, Seam may add additional characters or truncate the name to meet provider constraints. To help your users identify codes set by Seam, Seam provides the name exactly as it appears on the lock provider's app or on the device as a separate property called `appearance`. This is an object with a `name` property and, optionally, `first_name` and `last_name` properties (for providers that break down a name into components). */ name: string | null /** * Collection of pending mutations for the access code. Indicates changes that Seam is in the process of pushing to the device. */ pending_mutations: Array< /** * Seam is in the process of setting an access code on the device. */ | { /** * Date and time at which the mutation was created. */ created_at: string /** * Detailed description of the mutation. */ message: string /** * Mutation code to indicate that Seam is in the process of setting an access code on the device. */ mutation_code: 'creating' } /** * Seam is waiting until closer to the access code's start time before programming it on the device. */ | { /** * Date and time at which the mutation was created. */ created_at: string /** * Detailed description of the mutation. */ message: string /** * Mutation code to indicate that Seam is waiting until closer to the access code's start time before programming it on the device. */ mutation_code: 'deferring_creation' /** * Date and time at which Seam will attempt to program this access code on the device. */ scheduled_at: string } /** * Seam is in the process of removing an access code from the device. */ | { /** * Date and time at which the mutation was created. */ created_at: string /** * Detailed description of the mutation. */ message: string /** * Mutation code to indicate that Seam is in the process of removing an access code from the device. */ mutation_code: 'deleting' } /** * Seam is in the process of pushing an updated PIN code to the device. */ | { /** * Date and time at which the mutation was created. */ created_at: string /** * Previous code configuration. */ from: { /** * Previous PIN code. */ code: string | null } /** * Detailed description of the mutation. */ message: string /** * Mutation code to indicate that Seam is in the process of pushing an updated PIN code to the device. */ mutation_code: 'updating_code' /** * New code configuration. */ to: { /** * New PIN code. */ code: string | null } } /** * Seam is in the process of pushing an updated access code name to the device. */ | { /** * Date and time at which the mutation was created. */ created_at: string /** * Previous name configuration. */ from: { /** * Previous access code name. */ name: string | null } /** * Detailed description of the mutation. */ message: string /** * Mutation code to indicate that Seam is in the process of pushing an updated access code name to the device. */ mutation_code: 'updating_name' /** * New name configuration. */ to: { /** * New access code name. */ name: string | null } } /** * Seam is in the process of pushing an updated time frame to the device. */ | { /** * Date and time at which the mutation was created. */ created_at: string /** * Previous time frame configuration. */ from: { /** * Previous end time for the access code. */ ends_at: string | null /** * Previous start time for the access code. */ starts_at: string | null } /** * Detailed description of the mutation. */ message: string /** * Mutation code to indicate that Seam is in the process of pushing updated access code time frame to the device. */ mutation_code: 'updating_time_frame' /** * New time frame configuration. */ to: { /** * New end time for the access code. */ ends_at: string | null /** * New start time for the access code. */ starts_at: string | null } } > /** * Identifier of the pulled backup access code. Used to associate the pulled backup access code with the original access code. */ pulled_backup_access_code_id?: string | null | undefined /** * Date and time at which the time-bound access code becomes active. */ starts_at?: string | null | undefined /** * Current status of the access code within the operational lifecycle. Values are `setting`, a transitional phase that indicates that the code is being configured or activated; `set`, which indicates that the code is active and operational; `unset`, which indicates a deactivated or unused state, either before activation or after deliberate deactivation; `removing`, which indicates a transitional period in which the code is being deleted or made inactive; and `unknown`, which indicates an indeterminate state, due to reasons such as system errors or incomplete data, that highlights a potential need for system review or troubleshooting. See also [Lifecycle of Access Codes](https://docs.seam.co/low-level-apis/smart-locks/access-codes/lifecycle-of-access-codes). */ status: 'setting' | 'set' | 'unset' | 'removing' | 'unknown' /** * Type of the access code. `ongoing` access codes are active continuously until deactivated manually. `time_bound` access codes have a specific duration. */ type: 'time_bound' | 'ongoing' /** * Warnings associated with the [access code](https://docs.seam.co/low-level-apis/smart-locks/access-codes). */ warnings: Array< /** * The access code's PIN rotates periodically when the code is renewed. Retrieve the latest code before each use. */ | { /** * Date and time at which Seam created the warning. */ created_at?: string | undefined /** * Detailed description of the warning. Provides insights into the issue and potentially how to rectify it. */ message: string /** * Unique identifier of the type of warning. Enables quick recognition and categorization of the issue. */ warning_code: 'code_rotates_periodically' } /** * The device's time zone is unknown and this code's time frame crosses a daylight-saving transition in at least one plausible time zone. A 1-hour safety buffer has been applied to the side of the time frame affected by the transition (`ends_at` for spring-forward, `starts_at` for fall-back) so the code stays active through the shift — the code may be usable up to 1 hour beyond your requested window. Set the device's time zone via `/devices/report_provider_metadata` to clear the buffer and guarantee exact handling. */ | { /** * Date and time at which Seam created the warning. */ created_at?: string | undefined /** * Detailed description of the warning. Provides insights into the issue and potentially how to rectify it. */ message: string /** * Unique identifier of the type of warning. Enables quick recognition and categorization of the issue. */ warning_code: 'time_frame_adjusted_for_unknown_time_zone' } /** * Code was modified or removed externally after Seam successfully set it on the device. External modification is allowed for this code, so the externally modified state is being honored. */ | { /** * Indicates the type of external modification. `modified` means the code's PIN or schedule was changed. `removed` means the code was deleted from the device. */ change_type?: 'modified' | 'removed' | undefined /** * Date and time at which Seam created the warning. */ created_at?: string | undefined /** * Detailed description of the warning. Provides insights into the issue and potentially how to rectify it. */ message: string /** * List of fields that were changed externally, with their previous and new values. */ modified_fields?: | Array<{ /** * The name of the field that was changed (e.g. `code`, `starts_at`, `ends_at`). */ field: string /** * The previous value of the field. */ from: string | null /** * The new value of the field. */ to: string | null }> | undefined /** * Unique identifier of the type of warning. Enables quick recognition and categorization of the issue. */ warning_code: 'external_modification_in_effect' } /** * Delay in setting code on device. */ | { /** * Date and time at which Seam created the warning. */ created_at?: string | undefined /** * Detailed description of the warning. Provides insights into the issue and potentially how to rectify it. */ message: string /** * Unique identifier of the type of warning. Enables quick recognition and categorization of the issue. */ warning_code: 'delay_in_setting_on_device' } /** * Delay in removing code from device. */ | { /** * Date and time at which Seam created the warning. */ created_at?: string | undefined /** * Detailed description of the warning. Provides insights into the issue and potentially how to rectify it. */ message: string /** * Unique identifier of the type of warning. Enables quick recognition and categorization of the issue. */ warning_code: 'delay_in_removing_from_device' } /** * Third-party integration detected that may cause access codes to fail. */ | { /** * Date and time at which Seam created the warning. */ created_at?: string | undefined /** * Detailed description of the warning. Provides insights into the issue and potentially how to rectify it. */ message: string /** * Unique identifier of the type of warning. Enables quick recognition and categorization of the issue. */ warning_code: 'third_party_integration_detected' } /** * Algopins must be used within 24 hours. */ | { /** * Date and time at which Seam created the warning. */ created_at?: string | undefined /** * Detailed description of the warning. Provides insights into the issue and potentially how to rectify it. */ message: string /** * Unique identifier of the type of warning. Enables quick recognition and categorization of the issue. */ warning_code: 'igloo_algopin_must_be_used_within_24_hours' } /** * Management was transferred to another workspace. */ | { /** * Date and time at which Seam created the warning. */ created_at?: string | undefined /** * Detailed description of the warning. Provides insights into the issue and potentially how to rectify it. */ message: string /** * Unique identifier of the type of warning. Enables quick recognition and categorization of the issue. */ warning_code: 'management_transferred' } /** * A backup access code has been pulled and is being used in place of this access code. */ | { /** * Date and time at which Seam created the warning. */ created_at?: string | undefined /** * Detailed description of the warning. Provides insights into the issue and potentially how to rectify it. */ message: string /** * Unique identifier of the type of warning. Enables quick recognition and categorization of the issue. */ warning_code: 'using_backup_access_code' } /** * Access code is being deleted. */ | { /** * Date and time at which Seam created the warning. */ created_at?: string | undefined /** * Detailed description of the warning. Provides insights into the issue and potentially how to rectify it. */ message: string /** * Unique identifier of the type of warning. Enables quick recognition and categorization of the issue. */ warning_code: 'being_deleted' } /** * An unknown issue occurred with the access code. */ | { /** * Date and time at which Seam created the warning. */ created_at?: string | undefined /** * Detailed description of the warning. Provides insights into the issue and potentially how to rectify it. */ message: string /** * Unique identifier of the type of warning. Enables quick recognition and categorization of the issue. */ warning_code: 'unknown_issue_with_access_code' } > /** * Unique identifier for the Seam workspace associated with the access code. */ workspace_id: string }