Create Multiple Linked Access Codes

Create access codes across multiple devices that share a common code

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

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

Logo

© Seam Labs, Inc. All rights reserved.