Users with more than one door lock in a property may want to create groups of linked access codes, all of which have the same code (PIN). For example, a short-term rental host may want to provide guests the same PIN for both a front door lock and a back door lock. In this case, use . Specify the device_id of each device for which you want to create linked access codes. You can also include additional optional properties, such as the following:
A name to apply to all of the access codes.
The preferred_code_length.
Whether to throw an error or create a random code if any of the included devices cannot share a code.
Starting and ending timestamps if you want to create time-bound access codes.
When you use /access_codes/create_multiple, Seam assigns a common_code_key to all of the created access codes and returns this key. The common_code_key identifies all the access codes within this linked group.
Then, you can change the starting or ending time for the group of access codes—for example, if a short-term rental guest requests an early check-in or late checkout. To update a group of linked access codes, use , specifying the common_code_key of the linked access code group, along with the replacement starting and ending timestamps.
Specifying Custom Codes
When you use /access_codes/create_multiple, you can specify a custom code. Seam assigns this custom code to each of the resulting access codes. However, in this case, Seam does not link these access codes together with a common_code_key. That is, common_code_key remains null for these access codes.
If you want to change these access codes that are not linked by a common_code_key, you cannot use /access_codes/update_multiple. However, you can update each of these access codes individually, using .
Create Linked Access Codes
The following example creates two linked access codes for two devices.
Request:
# Create the group of linked access codes.
# Each returned access code includes a common_code_key.
seam.access_codes.create_multiple(
device_ids = [
"8e94044d-a4d1-4691-9f7e-e97d3e8a0b73",
"d87eea5d-71c6-4633-a966-396c5ac51177"
],
name = "Jane's reservation",
starts_at = "2024-11-15T15:00:00Z",
ends_at = "2024-11-17T11:00:00Z",
preferred_code_length = 4
)
// Create the group of linked access codes.
// Each returned access code includes a common_code_key.
await seam.accessCodes.createMultiple({
device_ids: [
"8e94044d-a4d1-4691-9f7e-e97d3e8a0b73",
"d87eea5d-71c6-4633-a966-396c5ac51177"
],
name: "Jane's reservation",
starts_at: "2024-11-15T15:00:00Z",
ends_at: "2024-11-17T11:00:00Z",
preferred_code_length: 4
});
# Create the group of linked access codes.
# Each returned access code includes a common_code_key.
client.access_codes.create_multiple(
device_ids: [
"8e94044d-a4d1-4691-9f7e-e97d3e8a0b73",
"d87eea5d-71c6-4633-a966-396c5ac51177"
],
name: "Jane's reservation",
starts_at: "2024-11-15T15:00:00Z",
ends_at: "2024-11-17T11:00:00Z",
preferred_code_length: 4
)
Response:
<Seam::AccessCode:0x00438
access_code_id="a1c682b1-c909-473f-926a-442a4ffc54c2"
name="Jane's reservation"
device_id="8e94044d-a4d1-4691-9f7e-e97d3e8a0b73"
code="5974"
common_code_key="auto_set_by_create_multiple_72f81ee3-997f-4fdc-81d0-289dabc28ae7"
starts_at=2024-12-15 15:00:00 UTC
ends_at=2024-12-17 11:00:00 UTC
...
>,
<Seam::AccessCode:0x00438
access_code_id="49261a24-103c-4880-8e58-d1d98f301ba7"
name="Jane's reservation"
device_id="d87eea5d-71c6-4633-a966-396c5ac51177"
code="5974"
common_code_key="auto_set_by_create_multiple_72f81ee3-997f-4fdc-81d0-289dabc28ae7"
starts_at=2024-12-15 15:00:00 UTC
ends_at=2024-12-17 11:00:00 UTC
...
>
Request:
// Create the group of linked access codes.
// Each returned access code includes a common_code_key.
$seam->access_codes->create_multiple(
device_ids: [
"8e94044d-a4d1-4691-9f7e-e97d3e8a0b73",
"d87eea5d-71c6-4633-a966-396c5ac51177"
],
name: "Jane's reservation",
starts_at: "2024-11-15T15:00:00Z",
ends_at: "2024-11-17T11:00:00Z",
preferred_code_length: 4
);
// Create the group of linked access codes.
// Each returned access code includes a common_code_key.
seam.AccessCodes.CreateMultiple(
deviceIds: new List<string>(new string[] {
"8e94044d-a4d1-4691-9f7e-e97d3e8a0b73",
"d87eea5d-71c6-4633-a966-396c5ac51177"
}),
name: "Jane's reservation",
startsAt: "2024-11-15T15:00:00Z",
endsAt: "2024-11-17T11:00:00Z",
preferredCodeLength: 4
);
// Create the group of linked access codes.
// Each returned access code includes a common_code_key.
seam.accessCodes()
.createMultiple(AccessCodesCreateMultipleRequest.builder()
.deviceIds(new ArrayList<>(Arrays.asList(
"8e94044d-a4d1-4691-9f7e-e97d3e8a0b73",
"d87eea5d-71c6-4633-a966-396c5ac51177"
)))
.name("Jane's reservation")
.startsAt("2024-11-15T15:00:00Z")
.endsAt("2024-11-17T11:00:00Z")
.preferredCodeLength(4)
.build());
The following example changes both the starting and ending times for a group of linked access codes:
Request:
# Update the starting and ending times
# for all these linked access codes,
# using the common_code_key to identify
# the group of access codes to update.
seam.access_codes.update_multiple(
common_code_key = common_code_key,
starts_at = "2024-11-15T12:00:00Z",
ends_at = "2024-11-17T15:00:00Z"
)
Response:
None
Request:
# Update the starting and ending times
# for all these linked access codes,
# using the common_code_key to identify
# the group of access codes to update.
curl -X 'POST' \
'https://connect.getseam.com/access_codes/update_multiple' \
-H 'accept: application/json' \
-H "Authorization: Bearer ${SEAM_API_KEY}" \
-H 'Content-Type: application/json' \
-d "{
\"common_code_key\": \"${common_code_key}\",
\"starts_at\": \"2024-11-15T12:00:00Z\",
\"ends_at\": \"2024-11-17T15:00:00Z\"
}"
Response:
{
"ok": true
}
Request:
// Update the starting and ending times
// for all these linked access codes,
// using the common_code_key to identify
// the group of access codes to update.
await seam.accessCodes.updateMultiple({
common_code_key: commonCodeKey,
starts_at: "2024-11-15T12:00:00Z",
ends_at: "2024-11-17T15:00:00Z"
});
Response:
void
Request:
# Update the starting and ending times
# for all these linked access codes,
# using the common_code_key to identify
# the group of access codes to update.
client.access_codes.update_multiple(
common_code_key: common_code_key,
starts_at: "2024-11-15T12:00:00Z",
ends_at: "2024-11-17T15:00:00Z"
)
Response:
void
Request:
// Update the starting and ending times
// for all these linked access codes,
// using the common_code_key to identify
// the group of access codes to update.
$seam->access_codes->update_multiple(
common_code_key: $common_code_key,
starts_at: "2024-11-15T12:00:00Z",
ends_at: "2024-11-17T15:00:00Z"
);
Response:
void
Request:
// Update the starting and ending times
// for all these linked access codes,
// using the common_code_key to identify
// the group of access codes to update.
seam.AccessCodes.UpdateMultiple(
commonCodeKey: commonCodeKey,
startsAt: "2024-11-15T12:00:00Z",
endsAt: "2024-11-17T15:00:00Z"
);
Response:
void
Request:
// Update the starting and ending times
// for all these linked access codes,
// using the common_code_key to identify
// the group of access codes to update.
seam.accessCodes()
.updateMultiple(AccessCodesUpdateMultipleRequest.builder()
.commonCodeKey(commonCodeKey)
.startsAt("2024-11-15T12:00:00Z")
.endsAt("2024-11-17T15:00:00Z")
.build());
Response:
void
Request:
// Update the starting and ending times
// for all these linked access codes,
// using the common_code_key to identify
// the group of access codes to update.
client.AccessCodes.UpdateMultiple(
context.Background(),
&api.AccessCodesUpdateMultipleRequest{
CommonCodeKey: commonCodeKey,
StartsAt: api.String("2024-11-15T12:00:00Z"),
EndsAt: api.String("2024-11-17T15:00:00Z"),
},
)
if uErr != nil {
return uErr
}
return nil