# swb accounts

Deletes an account of the tenant's directory in one environment class: one
this Switchboard created and that holds nothing — no install, no data and no
sub-account. It is the act an app's Access tab offers on such an account, and
the way a run that made an account for itself takes it away again.

## Synopsis

```
usage: swb accounts --class <class> --app <app> --delete <account> [--json]
```

## Arguments and flags

| Argument or flag | Takes | Default |
|---|---|---|
| `--class` | `dev`, `staging` or `production` — the Frontegg environment the account is deleted in. Required. | — |
| `--app` | An **app id** — the app whose Access tab acts. Required. | — |
| `--delete` | An **account id** of the tenant's directory. Required. | — |
| `--json` | Nothing. Prints the answer as the API gave it instead of the sentence. | off |
| `--help`, `-h` | Prints the command's help and exits. | off |

## What it prints

One sentence naming the account and the class. In the same write the
account's grants, its invitations, its place in every audience that admitted
it and, where it is a tenant, its tenant row are gone, and the account reads
`DELETING`. Switchboard then deletes it in that Frontegg environment, and its
directory row and the people mirrored for it after that; while the vendor
still holds an account under it, the deletion waits and a finding names it.

`--json` prints the account as `Mutation.deleteIdentityTenant` answers it,
with its status `DELETING`.

## The operation and the permission

`Mutation.deleteIdentityTenant`, which needs `swb.identity.admin`. It writes
Switchboard's own records and calls no vendor. Asking again for an account
already `DELETING` answers it as it stands.

## The same act in the console

None yet: the console's Access tab offers *Remove from app*, which suspends an
account's access, and no screen deletes one.

## Refusals and exit status

Exit status is 0 on success and 1 on every refusal below.

| Refusal | When |
|---|---|
| `swb accounts takes --app: the app whose Access tab acts` | `--app` is missing. |
| `swb accounts takes --delete <account>` | `--delete` is missing. |
| `swb accounts takes --class: dev, staging or production` | The class is missing. |
| `--class takes dev, staging or production, not "<value>"` | The class is not one of the three. |
| `this Switchboard did not create <account> in <class>, so it does not delete it` | The account was made by a stack, found standing or mirrored from Frontegg. |
| `<account> has a sub-account, <sub>; delete it first` | An account stands under it. |
| `<account> is a tenant whose partition holds <rows> — an install or data` | The tenant holds an install, a connection, an app, a repository or a deploy. |
| `not signed in or token expired — run swb login` | There is no usable credential. |
| The API's own error text | Any other refusal — a caller without `swb.identity.admin`, or an account the directory does not hold. |

## Example

```console
$ swb accounts --class dev --app switchboard --delete run-20261006
run-20261006 is being deleted in dev: its grants, invitations and audience places are gone, and Switchboard deletes it in that Frontegg environment next
```
