Skip to main content

Overview

Seam provides a universal API to connect and control many brands of smart locks. This guide provides a rapid introduction to connecting and controlling your Omnitec lock using the Seam API. Omnitec locks must be connected through an Omnitec Rent&Pass Gateway for online access. To learn more about other smart lock brands supported by Seam, head over to our integration page.

1 — Install Seam SDK

Seam provides client libraries for many languages, such as JavaScript, Python, Ruby, PHP, and others, as well as a Postman collection and OpenAPI spec.
npm i seam
pip install seam
# For some development environments, use pip3 in this command instead of pip.
bundle add seam
composer require seamapi/seam
Install using nuget: https://www.nuget.org/packages/Seam
// Add to your pom.xml or build.gradle see Maven Central for details.
# cURL is already installed on most systems. No additional installation needed.
# Export your API key as an environment variable:
export SEAM_API_KEY=seam_test2ZTo_0mEYQW2TvNDCxG5Atpj85Ffw
Once installed, sign up for Seam to get your API key, and export it as an environment variable:
export SEAM_API_KEY=seam_test2ZTo_0mEYQW2TvNDCxG5Atpj85Ffw
This guide uses a Sandbox Workspace. Only virtual devices can be connected. If you need to connect a real Omnitec lock, use a non-sandbox workspace and API key.

To control your Omnitec lock via the Seam API, you must first authorize your Seam workspace against your Omnitec account. To do so, Seam provides Connect Webviews: pre-built UX flows that walk you through authorizing your application to control your Omnitec lock.

Request a Connect Webview

import { Seam } from "seam";

const seam = new Seam();

const connectWebview = await seam.connectWebviews.create({
  accepted_providers: ["omnitec"],
});

console.log(connectWebview.login_successful); // false

// Send the webview URL to your user
console.log(connectWebview.url);
from seam import Seam

seam = Seam()

webview = seam.connect_webviews.create(accepted_providers=["omnitec"])

assert webview.login_successful is False

# Send the webview URL to your user
print(webview.url)
require "seam"

seam = Seam.new(api_key: "MY_API_KEY")

webview = seam.connect_webviews.create(
  accepted_providers: ["omnitec"]
)

puts webview.login_successful # false

# Send the webview URL to your user
puts webview.url
<?php
use Seam\SeamClient;

$seam = new SeamClient("YOUR_API_KEY");

$webview = $seam->connect_webviews->create(
  accepted_providers: ["omnitec"]
);

echo $webview->login_successful; // false

// Send the webview URL to your user
echo $webview->url;
using Seam.Client;

var seam = new SeamClient(apiToken: "YOUR_API_KEY");

var webview = seam.ConnectWebviews.Create(
  acceptedProviders: new List<string> { "omnitec" }
);

Console.WriteLine(webview.LoginSuccessful); // false

// Send the webview URL to your user
Console.WriteLine(webview.Url);
import co.seam.Seam;
import co.seam.api.types.ConnectWebview;

Seam seam = Seam.builder().apiKey("YOUR_API_KEY").build();

ConnectWebview webview = seam.connectWebviews().create(
  ConnectWebviewsCreateRequest.builder()
    .acceptedProviders(List.of("omnitec"))
    .build()
);

System.out.println(webview.getLoginSuccessful()); // false

// Send the webview URL to your user
System.out.println(webview.getUrl());
curl -X 'POST' \
  'https://connect.getseam.com/connect_webviews/create' \
  -H "Authorization: Bearer ${SEAM_API_KEY}" \
  -H 'Content-Type: application/json' \
  -d '{
    "accepted_providers": ["omnitec"]
  }'

Authorize Your Workspace

Navigate to the URL returned by the Webview object. Since you are using a sandbox workspace, complete the login flow by entering the Omnitec sandbox test account credentials below: During the Connect Webview flow, you will also be prompted to select a time zone. You can choose any valid time zone. Confirm the Connect Webview was successful by querying its status:
const updatedWebview = await seam.connectWebviews.get(
  connectWebview.connect_webview_id
);

console.log(updatedWebview.login_successful); // true
updated_webview = seam.connect_webviews.get(
    connect_webview_id=webview.connect_webview_id
)

assert updated_webview.login_successful  # true
updated_webview = seam.connect_webviews.get(
  connect_webview_id: webview.connect_webview_id
)

puts updated_webview.login_successful # true
<?php
$updated_webview = $seam->connect_webviews->get(
  connect_webview_id: $webview->connect_webview_id
);

echo $updated_webview->login_successful; // true
var updatedWebview = seam.ConnectWebviews.Get(
  connectWebviewId: webview.ConnectWebviewId
);

Console.WriteLine(updatedWebview.LoginSuccessful); // true
ConnectWebview updatedWebview = seam.connectWebviews().get(
  ConnectWebviewsGetRequest.builder()
    .connectWebviewId(webview.getConnectWebviewId())
    .build()
);

System.out.println(updatedWebview.getLoginSuccessful()); // true
curl -X 'POST' \
  'https://connect.getseam.com/connect_webviews/get' \
  -H "Authorization: Bearer ${SEAM_API_KEY}" \
  -H 'Content-Type: application/json' \
  -d "{
    \"connect_webview_id\": \"${CONNECT_WEBVIEW_ID}\"
  }"

3 — Retrieve Omnitec Lock Devices

After an Omnitec account is linked with Seam, you can retrieve devices for this Omnitec account. The Seam API exposes most of the device’s properties such as battery level or door lock status.
const allLocks = await seam.locks.list();

const someLock = allLocks[0];

console.log(someLock.properties.online); // true
console.log(someLock.properties.locked); // true

console.log(someLock);
/*
{
  device_id: '...',
  device_type: 'omnitec_lock',
  capabilities_supported: ['access_code', 'lock'],
  properties: {
    locked: true,
    online: true,
    manufacturer: 'omnitec',
    omnitec_metadata: {
      lock_id: '...',
      lock_name: 'Room 101',
      has_gateway: true
    },
    name: 'Room 101'
  },
  ...
}
*/
all_locks = seam.locks.list()

some_lock = all_locks[0]

assert some_lock.properties["online"] is True
assert some_lock.properties["locked"] is True

print(some_lock)
# Device(
#   device_id='...',
#   device_type='omnitec_lock',
#   properties={
#     'locked': True,
#     'online': True,
#     'manufacturer': 'omnitec',
#     'omnitec_metadata': {...},
#     'name': 'Room 101'
#   },
#   capabilities_supported=['access_code', 'lock']
# )
some_lock = seam.locks.list.first

puts some_lock.properties.online # true
puts some_lock.properties.locked # true

puts some_lock
<?php
$locks = $seam->locks->list();

$some_lock = $locks[0];

echo $some_lock->properties->online; // true
echo $some_lock->properties->locked; // true
var locks = seam.Locks.List();

var someLock = locks[0];

Console.WriteLine(someLock.Properties.Online); // true
Console.WriteLine(someLock.Properties.Locked); // true
var locks = seam.locks().list();

var someLock = locks.get(0);

System.out.println(someLock.getProperties().getOnline()); // true
System.out.println(someLock.getProperties().getLocked()); // true
curl -X 'POST' \
  'https://connect.getseam.com/locks/list' \
  -H "Authorization: Bearer ${SEAM_API_KEY}" \
  -H 'Content-Type: application/json' \
  -d '{}'

4 — Locking & Unlocking a Door

You can perform the basic actions of locking and unlocking an Omnitec lock.
// lock the door
await seam.locks.lockDoor(someLock.device_id);
const updatedLock = await seam.locks.get(someLock.device_id);
console.log(updatedLock.properties.locked); // true

// unlock the door
await seam.locks.unlockDoor(someLock.device_id);
const unlockedLock = await seam.locks.get(someLock.device_id);
console.log(unlockedLock.properties.locked); // false
# lock the door
seam.locks.lock_door(device_id=some_lock.device_id)
updated_lock = seam.locks.get(device_id=some_lock.device_id)
assert updated_lock.properties["locked"] is True

# unlock the door
seam.locks.unlock_door(device_id=some_lock.device_id)
updated_lock = seam.locks.get(device_id=some_lock.device_id)
assert updated_lock.properties["locked"] is False
# lock the door
seam.locks.lock_door(device_id: some_lock.device_id)
updated_lock = seam.locks.get(device_id: some_lock.device_id)
puts updated_lock.properties.locked # true

# unlock the door
seam.locks.unlock_door(device_id: some_lock.device_id)
updated_lock = seam.locks.get(device_id: some_lock.device_id)
puts updated_lock.properties.locked # false
<?php
// lock the door
$seam->locks->lock_door(device_id: $some_lock->device_id);
$updated_lock = $seam->locks->get(device_id: $some_lock->device_id);
echo $updated_lock->properties->locked; // true

// unlock the door
$seam->locks->unlock_door(device_id: $some_lock->device_id);
$updated_lock = $seam->locks->get(device_id: $some_lock->device_id);
echo $updated_lock->properties->locked; // false
// lock the door
seam.Locks.LockDoor(deviceId: someLock.DeviceId);
var updatedLock = seam.Locks.Get(deviceId: someLock.DeviceId);
Console.WriteLine(updatedLock.Properties.Locked); // true

// unlock the door
seam.Locks.UnlockDoor(deviceId: someLock.DeviceId);
updatedLock = seam.Locks.Get(deviceId: someLock.DeviceId);
Console.WriteLine(updatedLock.Properties.Locked); // false
// lock the door
seam.locks().lockDoor(LocksLockDoorRequest.builder()
    .deviceId(someLock.getDeviceId())
    .build());
var updatedLock = seam.locks().get(LocksGetRequest.builder()
    .deviceId(someLock.getDeviceId())
    .build());
System.out.println(updatedLock.getProperties().getLocked()); // true

// unlock the door
seam.locks().unlockDoor(LocksUnlockDoorRequest.builder()
    .deviceId(someLock.getDeviceId())
    .build());
updatedLock = seam.locks().get(LocksGetRequest.builder()
    .deviceId(someLock.getDeviceId())
    .build());
System.out.println(updatedLock.getProperties().getLocked()); // false
# lock the door
curl -X 'POST' \
  'https://connect.getseam.com/locks/lock_door' \
  -H "Authorization: Bearer ${SEAM_API_KEY}" \
  -H 'Content-Type: application/json' \
  -d "{\"device_id\": \"${DEVICE_ID}\"}"

# unlock the door
curl -X 'POST' \
  'https://connect.getseam.com/locks/unlock_door' \
  -H "Authorization: Bearer ${SEAM_API_KEY}" \
  -H 'Content-Type: application/json' \
  -d "{\"device_id\": \"${DEVICE_ID}\"}"

5 — Setting Access Codes on an Omnitec Lock

Omnitec locks with a keypad support access code programming. The Seam API makes it easy to program both ongoing codes and timebound codes on an Omnitec lock. You can find out more about access codes in our guide on access codes.
// create an ongoing code
await seam.accessCodes.create({
  device_id: someLock.device_id,
  code: "123456",
  name: "Personal Access Code",
});

// create a timebound code
await seam.accessCodes.create({
  device_id: someLock.device_id,
  code: "888888",
  name: "Guest Access Code",
  starts_at: "2028-11-12T19:00:00+0000",
  ends_at: "2028-11-13T12:00:00+0000",
});

// list all access codes on the device
const accessCodes = await seam.accessCodes.list({
  device_id: someLock.device_id,
});

console.log(accessCodes);
/*
[
  {
    code: '123456',
    type: 'ongoing',
    status: 'setting',
    access_code_id: '...',
    name: 'Personal Access Code'
  },
  {
    code: '888888',
    type: 'timebound',
    status: 'setting',
    access_code_id: '...',
    name: 'Guest Access Code',
    starts_at: '2028-11-12T19:00:00.000Z',
    ends_at: '2028-11-13T12:00:00.000Z'
  }
]
*/
# create an ongoing code
seam.access_codes.create(
    device_id=some_lock.device_id,
    code="123456",
    name="Personal Access Code"
)

# create a timebound code
seam.access_codes.create(
    device_id=some_lock.device_id,
    code="888888",
    name="Guest Access Code",
    starts_at="2028-11-12T19:00:00+0000",
    ends_at="2028-11-13T12:00:00+0000"
)

# list all access codes on the device
access_codes = seam.access_codes.list(device_id=some_lock.device_id)

print(access_codes)
# create an ongoing code
seam.access_codes.create(
  device_id: some_lock.device_id,
  code: "123456",
  name: "Personal Access Code"
)

# create a timebound code
seam.access_codes.create(
  device_id: some_lock.device_id,
  code: "888888",
  name: "Guest Access Code",
  starts_at: "2028-11-12T19:00:00+0000",
  ends_at: "2028-11-13T12:00:00+0000"
)

# list all access codes on the device
access_codes = seam.access_codes.list(device_id: some_lock.device_id)

puts access_codes
<?php
// create an ongoing code
$seam->access_codes->create(
  device_id: $some_lock->device_id,
  code: "123456",
  name: "Personal Access Code"
);

// create a timebound code
$seam->access_codes->create(
  device_id: $some_lock->device_id,
  code: "888888",
  name: "Guest Access Code",
  starts_at: "2028-11-12T19:00:00+0000",
  ends_at: "2028-11-13T12:00:00+0000"
);

// list all access codes on the device
$access_codes = $seam->access_codes->list(
  device_id: $some_lock->device_id
);

print_r($access_codes);
// create an ongoing code
seam.AccessCodes.Create(
  deviceId: someLock.DeviceId,
  code: "123456",
  name: "Personal Access Code"
);

// create a timebound code
seam.AccessCodes.Create(
  deviceId: someLock.DeviceId,
  code: "888888",
  name: "Guest Access Code",
  startsAt: "2028-11-12T19:00:00+0000",
  endsAt: "2028-11-13T12:00:00+0000"
);

// list all access codes on the device
var accessCodes = seam.AccessCodes.List(
  deviceId: someLock.DeviceId
);

foreach (var code in accessCodes)
{
  Console.WriteLine(code.Code);
}
// create an ongoing code
seam.accessCodes().create(AccessCodesCreateRequest.builder()
    .deviceId(someLock.getDeviceId())
    .code("123456")
    .name("Personal Access Code")
    .build());

// create a timebound code
seam.accessCodes().create(AccessCodesCreateRequest.builder()
    .deviceId(someLock.getDeviceId())
    .code("888888")
    .name("Guest Access Code")
    .startsAt("2028-11-12T19:00:00+0000")
    .endsAt("2028-11-13T12:00:00+0000")
    .build());

// list all access codes on the device
var accessCodes = seam.accessCodes().list(AccessCodesListRequest.builder()
    .deviceId(someLock.getDeviceId())
    .build());

System.out.println(accessCodes);
# create an ongoing code
curl -X 'POST' \
  'https://connect.getseam.com/access_codes/create' \
  -H "Authorization: Bearer ${SEAM_API_KEY}" \
  -H 'Content-Type: application/json' \
  -d "{
    \"device_id\": \"${DEVICE_ID}\",
    \"code\": \"123456\",
    \"name\": \"Personal Access Code\"
  }"

# create a timebound code
curl -X 'POST' \
  'https://connect.getseam.com/access_codes/create' \
  -H "Authorization: Bearer ${SEAM_API_KEY}" \
  -H 'Content-Type: application/json' \
  -d "{
    \"device_id\": \"${DEVICE_ID}\",
    \"code\": \"888888\",
    \"name\": \"Guest Access Code\",
    \"starts_at\": \"2028-11-12T19:00:00+0000\",
    \"ends_at\": \"2028-11-13T12:00:00+0000\"
  }"

# list all access codes on the device
curl -X 'POST' \
  'https://connect.getseam.com/access_codes/list' \
  -H "Authorization: Bearer ${SEAM_API_KEY}" \
  -H 'Content-Type: application/json' \
  -d "{\"device_id\": \"${DEVICE_ID}\"}"

Next Steps

Now that you’ve completed this guide, you can try to connect a real Omnitec device. To do so, make sure to switch to a non-sandbox workspace and API key as real devices cannot be connected to sandbox workspaces. In addition, if you’d like to explore other aspects of Seam, here is a list of helpful resources: If you have any questions or want to report an issue, email us at support@seam.co.