# Orgs

An org is a named group of accounts: an **admin** or two who run it, and the **members** they invite. `surge orgs` creates and manages them. Orgs don't hold domains yet—publishing access is still granted per domain with [collaborators](https://surge.sh/docs/cli/teams)—so for now an org is its membership: who's in, and who can administer it.

The namespace reads target-first, like the project commands: the org comes first, then the verb.

```sh
surge orgs                                  # every org you belong to, with your role
surge orgs <org>                            # one org: its name, your role, member count
surge orgs <org> create [--name <name>]     # create it; you become its admin
surge orgs <org> rename <slug> [--name <name>]
surge orgs <org> remove                     # remove the org
```

`<org>` is the org's slug (or its id). Every command that changes something names its org—there's no "current org" to get wrong.

## Creating an org

```sh
surge orgs acme create --name "Acme Inc."
```

The slug (`acme`) is the org's handle; `--name` is the display name and defaults to the slug. Creating an org needs a verified email address (see [`surge verify`](https://surge.sh/docs/cli/account#verify)).

`rename` changes the slug, the name, or both. After a slug change the old slug keeps resolving to the org for 30 days, so scripts and links don't break overnight.

## Members

```sh
surge orgs acme members                            # members and pending invites
surge orgs acme members jane@example.com           # one of them
surge orgs acme members jane@example.com invite    # email an invite
surge orgs acme members jane@example.com revoke    # withdraw an invite, or remove a member
surge orgs acme members jane@example.com mkadmin   # make an admin
surge orgs acme members jane@example.com rmadmin   # back to member
```

Only admins invite, change roles, and remove others; any member can remove themselves (`revoke` on your own email leaves the org).

An invite goes to an email address and carries a one-time code. Whoever receives it joins from whichever account they're signed in as—the email is where the invite goes, not who has to accept it:

```sh
surge orgs acme join <code>
```

Codes are single-use and expire after 7 days. Inviting the same address again sends a fresh code.

## Limits

Free orgs hold up to three people, admins and members together—pending invites don't count until they're accepted. Each account can be the admin of up to three free orgs.

## Removing an org

```sh
surge orgs acme remove
```

The slug is free for anyone to use as soon as the org is gone. Removal is refused while the org holds any domains, and the refusal lists them.
