> For the complete documentation index, see [llms.txt](https://docs.okup.ai/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.okup.ai/okupai-platform/properties-and-platforms/integrations/ttlock-smart-locks.md).

# TTLock (Smart Locks)

Smart locks with automatic, booking-specific door codes.

***

## 🔐 TTLock (Smart Locks)

Connect your TTLock smart locks to OkupAI and every booking automatically gets its **own door code**, valid exactly for the stay — sent to the guest without you doing anything.

***

## ⚙️ Connecting your TTLock account

Open the **Integrations** card on the [Properties page](/okupai-platform/properties-and-platforms/property-settings.md) and open **TTLocks**:

1. Under **Add a TTLocks account**, enter a label (e.g. `Main`, `Holiday homes`)
2. Click **Connect** — you are redirected to TTLock to grant access
3. After granting access, your locks are synced into OkupAI automatically

Each connected account shows its status — **Connected**, **Pending**, **Needs reconnect**, or **Disconnected** — with the last sync time and **Sync now** / **Reconnect** / **Disconnect** actions.

{% hint style="info" %}
You can connect **multiple TTLock accounts** — useful if locks are split across owners or buildings.
{% endhint %}

***

## 🔗 Linking locks to units

In the **Units & locks** table you see every linked lock with:

* **Unit** and **Account** it belongs to
* **Battery** level and **Gateway** status (**Online** / **Bluetooth only**)
* The **Current code** (masked — click to reveal, with a **Copy code** button) and its validity
* **Last used** timestamp

New locks appear under **Unassigned locks** — use the searchable dropdown to select a unit and click **Link**. Use **Sync all** to refresh everything at once, and **Unlink from unit** to detach a lock.

To rename a lock (or an account), hover over its name and click the **pencil icon** — the new name is updated in both OkupAI and the TTLock app.

{% hint style="warning" %}
A lock needs an **online gateway** (or built-in WiFi) to receive codes remotely. Locks showing **Bluetooth only** cannot get new codes automatically — install a TTLock gateway within Bluetooth range of the lock.
{% endhint %}

***

## 🔑 Booking-specific codes

Once a lock is linked to a unit:

* Every booking gets a **unique passcode**, generated automatically
* The code is valid **from check-in to check-out** — using the **Check-In From** and **Check-Out** times configured in [Property Settings](/okupai-platform/properties-and-platforms/property-settings.md), in the property's timezone
* After checkout the code expires and is removed from the lock automatically
* Use **Refresh code** in the table to regenerate the code for the current or next booking (requires an online gateway)

### 📅 Door codes per booking

Click **Door codes per booking** on a lock to manage codes for current and upcoming stays:

* A dialog lists each booking with its guest name, stay dates, and current code
* Click **Regenerate** on a booking to issue a fresh code — the previous code is revoked immediately, and guests are **not** notified automatically

***

## ✉️ Sending codes to guests automatically

Add the variable to your [message templates](/okupai-platform/messaging/automatic-messages/message-templates.md):

```
{{ttlock_passcode}}
```

It resolves to the booking-specific code of the guest receiving the message. A typical setup: an arrival-instructions template with the door code, sent automatically **one day before check-in** via an [automatic message rule](/okupai-platform/messaging/automatic-messages/automatic-message-rules.md).

{% hint style="info" %}
For static entry codes that don't change per booking (building door, garage, basement), use the property-level variables `{{building_code}}`, `{{unit_door_code}}`, `{{garage_door_code}}`, `{{basement_code}}`, or `{{custom_code}}` instead — set their values in Property Settings.
{% endhint %}

***

## 💡 Getting the most out of TTLock

* **Check the Gateway column first.** Remote code automation only works for locks with an **Online** gateway — fix this before relying on automatic codes.
* **Set your check-in/check-out times correctly.** They define exactly when each code starts and stops working. Guests arriving early won't get in before your **Check-In From** time.
* **Watch the battery level.** The table shows it per lock — replace batteries before they die, a dead lock means a locked-out guest.
* **Automate the full arrival flow.** Combine the door code message with your Online Check-In reminder: guest completes check-in → receives arrival instructions with `{{ttlock_passcode}}` → walks straight in.

***

## 🧭 Related

* [Message Templates](/okupai-platform/messaging/automatic-messages/message-templates.md) — build the arrival message with the code variable
* [Automatic Message Rules](/okupai-platform/messaging/automatic-messages/automatic-message-rules.md) — schedule when the code is sent
