# Teams

A team holds your scopes, devices, dashboards and automations. Everyone who works on them is a
member of the team. You can belong to several teams. The app works on one at a time: your current
team.

## Switch team

Open **Teams** and choose a team. If it isn't your current team, choose **Switch to** it. You manage
a team only while it is your current team.

**Create team** makes a new team with you as its owner.

## Team settings

A team's **Settings** holds its pages: **General**, **Members**, **API tokens**, **Plan**, **Usage**
and **Invoices**. Open it from the foot of the sidebar, or choose a team on **Teams**. **General**
holds the team's name. Owners rename it there.

## Roles

Each member has one role:

- **Owner**: everything a manager can do, plus renaming and deleting the team and managing its plan
  and billing.
- **Manager**: everything a viewer can do, plus changing devices, scopes, dashboards and
  automations, inviting and removing members, and reading [Activity](https://docs.qualithm.com/activity.md).
- **Viewer**: reads the team's devices, readings, dashboards, automations and usage, and creates
  their own API tokens.

A team always keeps at least one owner.

## Invite a member

Owners and managers invite from **Members**. Choose **Invite members**, choose a **Role**, and enter
one or more email addresses. Choose **Send invites**. A manager can invite managers and viewers.

Each person gets an email with a link to join the team. The link works for 7 days. They can also
accept the invite under **Pending invites** on their **Teams** page.

**Members** lists each invite you've sent as **Invited**. From its menu, **Resend** sends it again
and **Withdraw** cancels it.

## Change a role or remove a member

Open the member from **Members**:

- **Change role** sets their role. Owners can change anyone. Managers can change viewers and
  themselves.
- **Remove member** ends their access to the team and everything in it straight away. An owner or
  manager can invite them again.

To make someone else the owner, change their role to **Owner**.

## Leave a team

Open your own entry in **Members** and choose **Leave team**. You lose access straight away. The
last owner can't leave: make another member an owner first.

## Sign in from the CLI

Sign in to the Qualithm CLI, then connect your coding agent to it:

```bash
qualithm login
qualithm agents connect
```

`qualithm login` opens your browser, where you approve the CLI for one team and choose its role.
Your agent uses the same sign-in, so no config file holds a token.

## Create an API token

An API token lets CI and scripts act as you in this team, where no browser can approve a sign-in.
Every role can create one under **API tokens**:

1. Enter a **Name**, such as `deploy workflow`.
2. Choose a **Role** for the token: yours or a lower one. The token can do what that role allows,
   and never more than you.
3. Copy the token when it appears. It is shown once.

Store it as a secret in your CI, and set it as `QUALITHM_API_TOKEN` for the job. When it's set, it
takes precedence over a `qualithm login` sign-in. A token expires after 90 days. **Revoke** stops
everything that uses it from signing in. This cannot be undone.

## Delete a team

Only an owner can delete a team, from **General**. Deleting it removes its scopes, devices and data,
and every member loses access. Confirm by entering `DELETE`. This cannot be undone.

## See also

- [Account](https://docs.qualithm.com/account.md)
- [Billing and usage](https://docs.qualithm.com/billing-and-usage.md)
- [Activity](https://docs.qualithm.com/activity.md)
