> ## Documentation Index
> Fetch the complete documentation index at: /llms.txt
> Use this file to discover all available pages before exploring further.

# Organizations and teams

> Create an organization, invite people, set their roles, and group them into teams from the console, the CLI, or the SDKs.

Every account works inside an organization, and every user has a default org of their own. An org is where machines are billed, where sharing happens, and where secrets live. This page is about the org itself: its members, their roles, and the teams inside it. For what sharing does to a machine, see [Machine sharing](/guides/share-a-vm.md).

Everything here is available from the console's **Organization** page, from `boxd auth org` and `boxd teams` on the CLI, and from the SDKs' `orgs` and `teams` namespaces.

## Roles

| Role | Can |
| - | - |
| **member** | use the org's shared machines, create org-billed machines, read the org's settings |
| **admin** | everything a member can, plus invite and remove members, change roles, rename the org, set org-wide defaults, create teams, see and revoke the org's org API keys, create machines for other members, manage the org's unattached secrets |
| **owner** | everything an admin can, plus demote other admins. There is one owner, and ownership is transferred by the boxd team on request |

## Create an org and manage its roster

```bash
boxd auth org new "Acme"                        # you become owner and admin; the CLI switches to it
boxd auth org rename "Acme Labs"                # admin only
boxd auth org members                           # roster, plus pending invites for admins (alias: ls)
boxd auth org invite alice@example.com --role member # admin only; emails the link and prints it too
boxd auth org revoke-invite <token>             # admin only
boxd auth org remove-member <user_id> -y        # admin only; plain members only
boxd auth org set-role <user_id> admin          # promote; `member` demotes
```

A few rules keep the org safe from its own credentials:

* **Invites carry a role.** The invitee lands as `member` or `admin`, and an admin invite can only be sent from an interactive login. An API key or a token minted inside a machine cannot send one, and cannot read the links of pending invites either. It still sees that an invite is pending.
* **Demoting another admin is owner-only.** An admin can always demote themselves.
* **The owner's role is fixed.** It cannot be changed with `set-role`, and an owner or admin cannot be removed with `remove-member`. Both go through the boxd team.
* **A member who still owns org-billed machines cannot be removed.** Move those machines to their owner's default org or delete them first.
* **Org API keys outlive the person who made them.** A `--kind org` key keeps working after its maker leaves, so CI doesn't break when someone moves on. Every admin sees the org's org keys, with who made each one, in `boxd auth keys list` and on the console's API keys page, and can revoke them. When someone leaves, check the keys they made. See [API keys](/cli/authentication.md#api-keys).

Every one of these commands follows the active org context, so `boxd auth switch acme` first, or pass `--org acme` for one call.

## Teams

A team is a group of members inside an org, with an optional default snapshot. A machine created by a team member is created from that snapshot unless they pick another one, which is how a team hands every new machine the same starting point. See [Snapshot your app](/guides/snapshot-your-app.md).

```bash
boxd teams new backend                          # org admin only
boxd teams list                                 # every team for an admin; your own teams otherwise (alias: ls)
boxd teams get backend                          # roster and default snapshot
boxd teams add-member backend <user_id>         # team admin only; must already be an org member
boxd teams remove-member backend <user_id>
boxd teams set-role backend <user_id> admin
boxd teams set-default-snapshot backend base    # must be a shared snapshot
boxd teams set-default-snapshot backend --clear
boxd teams rename backend platform
boxd teams destroy backend -y                   # alias: rm
```

An org admin has team-admin authority on every team. A team admin has it on their own team.

## Create a machine for a member

An owner or admin can create a machine that belongs to another member from the start, ready to work: their team's snapshot, the packages and secrets they need, and their own integrations and agent logins. It takes a [machine spec](/guides/machine-specs.md) with `assignTo`, from the SDKs or the API:

```typescript TypeScript
import { Machine, team, claude } from "@boxd-sh/sdk";

await boxd.machines.create({
  name: "mike-dev",
  org: "acme",
  spec: Machine.spec().from(team("eng")).with(claude()).assignTo("usr_..."),
});
```

```python Python
from boxd import Machine, team, claude

boxd.machines.create(
    "mike-dev",
    org="acme",
    spec=Machine.spec().from_(team("eng")).with_(claude()).assign_to("usr_..."),
)
```

The machine is private to the member and billed to the org, and the admin who created it can't reach it afterwards. It runs the spec the admin wrote, packages as root included, with the member's own credentials, so assign only a spec the member would run themselves. See [Create a machine for someone else](/guides/machine-specs.md#create-a-machine-for-someone-else).

The secrets such a machine gets are usually the org's **unattached** secrets, which reach only the machines whose spec lists them. Only owners and admins can set, move or remove an org's unattached secrets, or list one in a spec. A member's own unattached secrets are theirs. See [Unattached secrets](/guides/env-secrets.md#unattached-secrets).

## Regions

Every org runs machines in both Frankfurt and New York. Members, roles, teams, secrets and billing are the same in both. Owners and admins set the org's default region, where new machines go when nobody picks one.

```bash
boxd manage regions                     # the regions, and which one is the org's default
boxd manage regions default nyc         # admin only, and `none` goes back to the closest region
```

A team's default snapshot is per region, since a snapshot lives in one region. `boxd teams set-default-snapshot backend base.nyc` sets the one new team machines in New York start from. See [Regions](/guides/regions.md).

## From the SDKs

```typescript TypeScript
const org = await boxd.orgs.create("Acme");
await boxd.orgs.getMembers("acme");                 // { members, invites }
await boxd.orgs.invite("alice@example.com", { role: "member", org: "acme" });
await boxd.orgs.setMemberRole("usr_...", "admin", "acme");
await boxd.orgs.removeMember("usr_...", "acme");

const team = await boxd.teams.create("backend", "acme");
await boxd.teams.addMember(team.id, "usr_...");
await boxd.teams.setDefaultSnapshot(team.id, snapshot.id);
```

```python Python
org = boxd.orgs.create("Acme")
boxd.orgs.get_members("acme")                       # OrgMembers(members, invites)
boxd.orgs.invite("alice@example.com", role="member", org="acme")
boxd.orgs.set_member_role("usr_...", "admin", org="acme")
boxd.orgs.remove_member("usr_...", org="acme")

team = boxd.teams.create("backend", org="acme")
boxd.teams.add_member(team.id, "usr_...")
boxd.teams.set_default_snapshot(team.id, snapshot.id)
```

See [Organizations](/reference/typescript-sdk.md#organizations) and [Teams](/reference/typescript-sdk.md#teams) in the TypeScript reference, and the same sections in the [Python reference](/reference/python-sdk.md#organizations).

## Live everywhere

A change made on one surface shows up on the others without a reload. Invite someone from the CLI and the console's Organization page lists the invite as it lands. The same goes for role changes, team rosters, and every machine setting.
