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 Aqara lock using the Seam API. 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.
Once installed, sign up for Seam to get your API key, and export it as an environment variable:
This guide uses a Sandbox Workspace. Only virtual devices can be connected. If you need to connect a real Aqara lock, use a non-sandbox workspace and API key.
To control your Aqara lock via the Seam API, you must first authorize your Seam workspace against your Aqara account. To do so, Seam provides Connect Webviews: pre-built UX flows that walk you through authorizing your application to control your Aqara lock.

Request a Connect Webview

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 Aqara sandbox test account credentials below: Confirm the Connect Webview was successful by querying its status:

3 — Retrieve Aqara Lock Devices

After an Aqara account is linked with Seam, you can retrieve devices for this Aqara account. The Seam API exposes most of the device’s properties such as battery level or door lock status.

4 — Lock and Unlock a Door

Next, you can perform the basic action of locking and unlocking the door.

Lock a door

Unlock a door

5 — Set Access Codes

Seam enables you to set access codes on Aqara locks with a keypad. You can create ongoing codes that remain active until removed, or timebound codes that are only active during a specified time window.

Create an ongoing access code

Create a timebound access code

Next Steps

Now that you’ve connected and controlled your Aqara lock with the Seam API, explore the following resources:
  • Access Codes — Learn more about managing access codes.
  • Webhooks — Set up event-driven notifications for lock activity.
  • Connect Webviews — Build custom authorization flows for your users.
  • Core Concepts — Understand workspaces, devices, and connected accounts.