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

# sumvin login, logout, whoami

> Sign in, sign out, and check your session from the terminal.

<Warning>
  **The CLI is for developers.** It's mainly for people building and experimenting on Sumvin. The recommended way to use Sumvin is the [MCP connector](/get-started/connect), or the API if you're building (docs coming).

  An agent running in your terminal can approve Stamped Mandates that the CLI signs for you. Never give an unattended agent `--yes`.
</Warning>

Every command below accepts the [global flags](/reference/cli/json-output): `--api-url`, `--json`, `--debug`, `--help`.

## `sumvin login`

Signs in using a device code: the CLI shows you a code and a link, you approve in your browser, and the CLI stores a token on this machine once you do.

```bash theme={null}
sumvin login
```

**Flags**

| Flag                | Effect                                                                                   |
| ------------------- | ---------------------------------------------------------------------------------------- |
| `--api-url <value>` | Sign in against a different Sumvin environment.                                          |
| `--json`            | Print a result object instead of the sign-in narration. Never includes the token itself. |

**Output states**

* A fresh sign-in prints a code and a link, then `Signed in. Token expires <date>.` once you approve.
* If you're already signed in, the CLI asks before replacing your current session.
* If the code expires before you approve, the CLI reports the sign-in as expired and you re-run it.

```bash theme={null}
sumvin login --json
```

```json theme={null}
{
  "ok": true,
  "exit_code": 0,
  "command": "login",
  "data": { "pat_id": "pat_01H", "expires_at": 1893456000000 },
  "next": [ { "command": "sumvin whoami", "reason": "Confirm you're signed in." } ]
}
```

## `sumvin logout`

Revokes the stored token on your account, then removes it from this machine, in that order.

```bash theme={null}
sumvin logout
```

**Output states**

* Signed in: `Signed out.`
* Already signed out: `Already signed out.` — this is not an error; running `logout` when there's nothing to sign out of is a no-op.
* If your account can't be reached, the local copy is still removed. Revoke the token from the Sumvin app as well if that matters to you.

## `sumvin whoami`

Shows the session you're currently signed in with, checked live against your account rather than read from a local file.

```bash theme={null}
sumvin whoami
```

**Output states**

* Signed in: name, status (`active`, `revoked`, or `expired`), expiry, and when it was last used.
* Not signed in, or the stored session no longer works: `You're not signed in.`

```bash theme={null}
sumvin whoami --json
```

```json theme={null}
{
  "ok": true,
  "exit_code": 0,
  "command": "whoami",
  "data": {
    "token": {
      "id": "pat_01H",
      "name": "sumvin-cli@my-laptop",
      "status": "active",
      "expires_at": 1893456000000,
      "last_used_at": 1704153600000
    }
  }
}
```

## Exit codes

All three commands use `0` for success and `1` for failure — there is no "answer is no" case here, only "the run worked" or "it didn't."
