# kindgi connections

> Connections: accounts at other apps that tools act with (list / get / connect / update / disconnect)

## `kindgi connections`

**Synopsis**

```sh signature
kindgi connections <command>
```

Connections: accounts at other apps that tools act with (list / get / connect / update / disconnect).

**Commands**

| Command                                                                                                                      | Description                                                                                                                                                                  |
| ---------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| [`kindgi connections list`](https://docs.kindgi.com/v0.5.0/reference/cli/connections.md#kindgi-connections-list)             | List connections: a member's own, every one for a tenant admin.                                                                                                              |
| [`kindgi connections get`](https://docs.kindgi.com/v0.5.0/reference/cli/connections.md#kindgi-connections-get)               | One connection: whose account it is, its permissions and its state.                                                                                                          |
| [`kindgi connections connect`](https://docs.kindgi.com/v0.5.0/reference/cli/connections.md#kindgi-connections-connect)       | Connect your account at an app (the company's with --for-company): prints the link to open, and at a terminal waits until the connect finishes and says whose account it is. |
| [`kindgi connections update`](https://docs.kindgi.com/v0.5.0/reference/cli/connections.md#kindgi-connections-update)         | Rename a connection: its label, which `--connection`, `kindgi connection-choices set` and the console name it by.                                                            |
| [`kindgi connections disconnect`](https://docs.kindgi.com/v0.5.0/reference/cli/connections.md#kindgi-connections-disconnect) | Disconnect: withdraws the access at the app where it can, destroys the token, and prints what was done.                                                                      |

**See also**

- [Choose a connection](https://docs.kindgi.com/v0.5.0/guides/connections/choose-a-connection.md)
- [Connect your apps](https://docs.kindgi.com/v0.5.0/guides/connections.md)
- [Start runs from new mail](https://docs.kindgi.com/v0.5.0/guides/runs/start-runs-from-new-mail.md)
- [How connections work](https://docs.kindgi.com/v0.5.0/guides/connections/reference.md)

### `kindgi connections list`

**Synopsis**

```sh signature
kindgi connections list [--project=<project-id>] [--app=<app>] [--mine] [--include-removed] [--limit=<n>] [--cursor=<c>] [--table]
```

List connections: a member's own, every one for a tenant admin. `--mine` keeps to your own. Removed ones are left out unless `--include-removed`.

**Options**

| Option              | Default              | Description                                                                    |
| ------------------- | -------------------- | ------------------------------------------------------------------------------ |
| `--app <value>`     | none                 | Only this app's, by its entry id: `google`, `microsoft`, `github`, `linkedin`. |
| `--cursor <value>`  | none                 | The next page, from `nextCursor`.                                              |
| `--include-removed` | off                  | Removed connections too, with when (`removedAt`).                              |
| `--limit <value>`   | `25` (at most `100`) | Page size.                                                                     |
| `--mine`            | off                  | Only your own, even as a tenant admin.                                         |
| `--project <value>` | none                 | Only those whose registration allows this project.                             |

Every command also takes the [global flags](https://docs.kindgi.com/v0.5.0/reference/cli.md#global-flags).

**Examples**

List your own connections to Google, as a table.

```sh
kindgi connections list --app=google --mine --table
```

List the connections a project's registrations allow.

```sh
kindgi connections list --project=<project-id>
```

List connections, removed ones too, as a table.

```sh
kindgi connections list --include-removed --table
```

**See also**

- [Choose a connection](https://docs.kindgi.com/v0.5.0/guides/connections/choose-a-connection.md)
- [Connect your apps](https://docs.kindgi.com/v0.5.0/guides/connections.md)
- [Start runs from new mail](https://docs.kindgi.com/v0.5.0/guides/runs/start-runs-from-new-mail.md)
- [How connections work](https://docs.kindgi.com/v0.5.0/guides/connections/reference.md)
- [`kindgi connections`](https://docs.kindgi.com/v0.5.0/reference/cli/connections.md#kindgi-connections)

### `kindgi connections get`

**Synopsis**

```sh signature
kindgi connections get <connection-id>
```

One connection: whose account it is, its permissions and its state.

**Options**

Every command also takes the [global flags](https://docs.kindgi.com/v0.5.0/reference/cli.md#global-flags).

**Examples**

Show one connection: whose account, its permissions and its state.

```sh
kindgi connections get <connection-id>
```

**See also**

- [Choose a connection](https://docs.kindgi.com/v0.5.0/guides/connections/choose-a-connection.md)
- [Connect your apps](https://docs.kindgi.com/v0.5.0/guides/connections.md)
- [Start runs from new mail](https://docs.kindgi.com/v0.5.0/guides/runs/start-runs-from-new-mail.md)
- [How connections work](https://docs.kindgi.com/v0.5.0/guides/connections/reference.md)
- [`kindgi connections`](https://docs.kindgi.com/v0.5.0/reference/cli/connections.md#kindgi-connections)

### `kindgi connections connect`

**Synopsis**

```sh signature
kindgi connections connect <app> [--label=<name>] [--reconnect=<connection>] [--app-id=<registration-id>] [--project=<project-id>] [--permissions=<key>,…] [--for-company]
```

Connect your account at an app (the company's with --for-company): prints the link to open, and at a terminal waits until the connect finishes and says whose account it is. --quiet prints the link alone, and still waits.

**Options**

| Option                  | Default                                                                                        | Description                                                                                                                                                                                                                    |
| ----------------------- | ---------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| `--app-id <value>`      | none: the app's one registration                                                               | Which registration, when the workspace has more than one for the app.                                                                                                                                                          |
| `--for-company`         | off                                                                                            | Connect the company's account, not your own. Tenant admins only.                                                                                                                                                               |
| `--label <value>`       | none: named by its account's label                                                             | The new connection's name, which `--connection` and `kindgi connection-choices set` name it by (default: its account's label); another of the owner's connections at the app can't have it. A reconnect keeps the name it has. |
| `--permissions <value>` | none picked: at a terminal it asks about each one the app's entry offers; required without one | The entry's permission keys to ask for, comma-separated (`gmail.send,gmail.readonly`). Left out, it asks you at the terminal about each one the app's entry offers, none picked for you; without a terminal it's required.     |
| `--project <value>`     | none                                                                                           | The project it's for; the registration must allow it.                                                                                                                                                                          |
| `--reconnect <value>`   | none (a new connection)                                                                        | Connect this connection again, by id or name, so it's granted more or works again: the same account is required. Its owner's own (the company's with --for-company), at \<app>.                                                |

Every command also takes the [global flags](https://docs.kindgi.com/v0.5.0/reference/cli.md#global-flags).

**Examples**

Connect your Google account to send email; open the link it prints.

```sh
kindgi connections connect google --permissions=gmail.send
```

Connect the company's GitHub installation for a project (tenant admins).

```sh
kindgi connections connect github --project=<project-id> --for-company
```

Connect another of the company's Google accounts, named `support`.

```sh
kindgi connections connect google --permissions=gmail.readonly --for-company --label=support
```

Reconnect the connection named `support`, signing in again.

```sh
kindgi connections connect google --permissions=gmail.readonly --for-company --reconnect=support
```

From [Choose a connection](https://docs.kindgi.com/v0.5.0/guides/connections/choose-a-connection.md):

```sh
pnpm exec kindgi connections connect google --label=home --permissions=calendar.events.owned.readonly
pnpm exec kindgi connections connect google --for-company --label=support --permissions=gmail.readonly,gmail.send
```

**See also**

- [Choose a connection](https://docs.kindgi.com/v0.5.0/guides/connections/choose-a-connection.md)
- [Connect your apps](https://docs.kindgi.com/v0.5.0/guides/connections.md)
- [Start runs from new mail](https://docs.kindgi.com/v0.5.0/guides/runs/start-runs-from-new-mail.md)
- [`kindgi connections`](https://docs.kindgi.com/v0.5.0/reference/cli/connections.md#kindgi-connections)

### `kindgi connections update`

**Synopsis**

```sh signature
kindgi connections update <connection> (--label=<name> | --main) [--app=<app>]
```

Rename a connection: its label, which `--connection`, `kindgi connection-choices set` and the console name it by. Whoever may disconnect it renames it: its owner or a tenant admin, and only a tenant admin the company's. Or make your own connection your main one at its app (--main). One change at a time.

**Options**

| Option            | Default                                  | Description                                                                                                                                                                           |
| ----------------- | ---------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `--app <value>`   | none                                     | With a name: only connections at this app, by its entry id (`google`).                                                                                                                |
| `--label <value>` | none (`--label` or `--main` is required) | Its new name; another of the owner's connections at the app can't have it.                                                                                                            |
| `--main`          | off                                      | Make it your main connection at its app, in place of the one that was: your agents use it when no choice names another. Your own only; a mail trigger keeps the connection it stored. |

Every command also takes the [global flags](https://docs.kindgi.com/v0.5.0/reference/cli.md#global-flags).

**Examples**

Rename a connection.

```sh
kindgi connections update support --label=helpdesk
```

Rename the Google connection named `support`, when another app has one named so too.

```sh
kindgi connections update support --app=google --label=helpdesk
```

Make your own connection named `home` your main one, which your agents use when no choice names another.

```sh
kindgi connections update home --main
```

From [Choose a connection](https://docs.kindgi.com/v0.5.0/guides/connections/choose-a-connection.md):

```sh
pnpm exec kindgi connections update home --main
pnpm exec kindgi connections update support --label=helpdesk
```

**See also**

- [Choose a connection](https://docs.kindgi.com/v0.5.0/guides/connections/choose-a-connection.md)
- [`kindgi connections`](https://docs.kindgi.com/v0.5.0/reference/cli/connections.md#kindgi-connections)

### `kindgi connections disconnect`

**Synopsis**

```sh signature
kindgi connections disconnect <connection-id> [--yes]
```

Disconnect: withdraws the access at the app where it can, destroys the token, and prints what was done. Asks first, unless --yes.

**Options**

| Option  | Default | Description                    |
| ------- | ------- | ------------------------------ |
| `--yes` | off     | Don't ask first (for scripts). |

Every command also takes the [global flags](https://docs.kindgi.com/v0.5.0/reference/cli.md#global-flags).

**Examples**

Disconnect a connection without being asked (for scripts).

```sh
kindgi connections disconnect <connection-id> --yes
```

From [How connections work](https://docs.kindgi.com/v0.5.0/guides/connections/reference.md):

```sh
npx --yes @kindgi/cli@0.2 connections disconnect <connection-id>
```

**See also**

- [How connections work](https://docs.kindgi.com/v0.5.0/guides/connections/reference.md)
- [`kindgi connections`](https://docs.kindgi.com/v0.5.0/reference/cli/connections.md#kindgi-connections)
