# Join keys

Source: https://tiltas.openpanel.sh/docs/devices/join-keys

> Add Servers to your Network without a browser, from a script, a container or CI.

A Join key is a secret that adds a Server to your Network without a browser. Servers belong to the Account, not to a
Member, and their sign-in does not expire. Owners and Admins make Join keys.

## Create a Join key

In the [console](/app), open **Join keys** and choose **Create Join key**:

- **Name**: what it is for, such as “ci runners”. Only you see it, to tell keys apart.
- **Reusable**: off, the key adds one Server and is spent; on, it adds any number of Servers until it expires.
- **Expires after**: 1, 7, 30 or 90 days; 7 by default.
- **Put Servers into**: Groups every Server that joins with this key goes into, so [Access rules](/docs/access) for those
  Groups apply from the start.

The key starts with `qlj_` and is shown once. Tiltas keeps only a hash of it, so it cannot show it again: copy it while
it is on screen. The console shows two commands with it:

- **Install and join**, for a machine without Tiltas:

  ```bash
  curl -fsSL https://tiltas.openpanel.sh/install.sh | sudo sh -s -- --join-key qlj_your_join_key
  ```

- **Already installed**:

  ```bash
  sudo tiltas up --join-key qlj_your_join_key
  ```

## Keep the key out of sight

A Join key on a command line shows in the process list and your shell history. Two other ways:

```bash
sudo tiltas up --join-key file:/root/join-key
```

`file:` reads the key from a file, which only root should be able to read. The variable `TILTAS_JOIN_KEY` works too.
In containers, pass it as `TILTAS_JOIN_KEY`, `TILTAS_JOIN_KEY_FILE` or a Docker secret named `tiltas_join_key`: see
[Docker](/docs/devices/docker).

## Keys for scripts and CI

For a setup script or a CI job, make a key that does not outlive it. The API takes `expires_in_minutes` (5 minutes to
90 days) instead of `expires_in_days`:

```bash
curl -X POST https://tiltas.openpanel.sh/api/v1/accounts/acc_8f2k1/join-keys \
  -H "Authorization: Bearer $TILTAS_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"name": "ci run 4821", "reusable": false, "expires_in_minutes": 30}'
```

The answer carries `secret` (the key) and `install_command`, both shown once. Replace `acc_8f2k1` with your Account id.
Access tokens are in the [API overview](/docs/api); every field is on
[Create a Join key](/docs/api/devices/createJoinKey).

## When a key is used

Each Server that joins appears under **Devices** with the name it gave: its host name, or the name set with the
installer's `--name` or the image's `TILTAS_HOSTNAME`.
A single-use key shows as used once a Server has joined with it; an expired, used or revoked key is refused when a
Server tries to join.

## If a key leaks

Under **Join keys**, revoke it. Servers that already joined stay; nothing new can join with it. To remove a Server that
joined with it, see [Remove a Device](/docs/people/remove-a-device).
