Create Multiple Linked Access Codes

Create access codes across multiple devices that share a common code

/access_codes/create_multiple

post
Authorizations
Body
device_idsstring · uuid[]Required
behavior_when_code_cannot_be_sharedstring · enumOptionalDefault: throwPossible values:
namestringOptional
starts_atstringOptional
ends_atstringOptional
attempt_for_offline_devicebooleanOptionalDefault: true
Responses
200
OK
post
POST /access_codes/create_multiple HTTP/1.1
Host: connect.getseam.com
Authorization: Bearer API token
Content-Type: application/json
Accept: */*
Content-Length: 185

{
  "device_ids": [
    "123e4567-e89b-12d3-a456-426614174000"
  ],
  "behavior_when_code_cannot_be_shared": "throw",
  "name": "text",
  "starts_at": "text",
  "ends_at": "text",
  "attempt_for_offline_device": true
}

No content

Code Example

await seam.accessCodes.createMultiple({
    device_id: [
      "a83690b2-2b70-409a-9a94-426699b84c97", 
      "7bfe1838-5e64-432c-adb6-34e971bda001"
    ],
    preferred_code_length: 4
});

/*
[
  {
    code: '9913',
    type: 'ongoing',
    status: 'setting',
    created_at: '2022-08-26T11:08:24.161Z',
    access_code_id: 'e0e31756-9385-408b-89f8-9f5ea43f9adf',
    device_id: 'a83690b2-2b70-409a-9a94-426699b84c97',
    common_code_key: 'auto_set_by_create_multiple_996c8131-34a4-4d58-86c4-7820f2ccdefb',    
  },
  {
    code: '9913',
    type: 'ongoing',
    status: 'setting',
    created_at: '2022-08-26T11:08:24.161Z',
    access_code_id: 'f3a89135-1101-4197-b272-4b4c5ed092b5',
    device_id: '7bfe1838-5e64-432c-adb6-34e971bda001',
    common_code_key: 'auto_set_by_create_multiple_996c8131-34a4-4d58-86c4-7820f2ccdefb',    
  }
]
*/

Parameters

device_ids

type: string[]

ID of the Device

name

type: string Optional

Name of Access Codes

starts_at

type: string Optional

From when is the code valid

ends_at

type: string Optional

Code expiry

behavior_when_code_cannot_be_shared

type: enum Optional, default throw

If throw, no access codes will be created if any device cannot share a code. If create_random_code, a random code will be created on devices that cannot share a code.

preferred_code_length

type: number Optional

Preferred code length If the affected devices do not support the preferred code length, Seam reverts to using the shortest supported code length.

code

type: string Optional

Code (PIN) to assign to each created access code.

If you specify a code, Seam does not link the created access codes with a common_code_key, so you cannot then update these access codes using /access_codes/update_multiple. You can, however, update each access code individually using /access_codes/update.

Response

This section shows the JSON response returned by the API. Since each language encapsulates this response inside objects specific to that language and/or implementation, the actual type in your language might differ from what’s written here.

JSON format

{
  "access_codes": [
    {
      "code": "9913",
      "type": "ongoing",
      "status": "setting",
      "created_at": "2022-08-26T11:08:24.161Z",
      "access_code_id": "e0e31756-9385-408b-89f8-9f5ea43f9adf",
      "device_id": "a83690b2-2b70-409a-9a94-426699b84c97",
      "common_code_key": "auto_set_by_create_multiple_996c8131-34a4-4d58-86c4-7820f2ccdefb",    
    },
    {
      "code": "9913",
      "type": "ongoing",
      "status": "setting",
      "created_at": "2022-08-26T11:08:24.161Z",
      "access_code_id": "f3a89135-1101-4197-b272-4b4c5ed092b5",
      "device_id": "7bfe1838-5e64-432c-adb6-34e971bda001",
      "common_code_key": "auto_set_by_create_multiple_996c8131-34a4-4d58-86c4-7820f2ccdefb",    
    }
  ],
  "ok": true
}

Last updated

Was this helpful?

Revision created

ci: Generate docs