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

# bt login

> Log in to Braintrust from the CLI or refresh an OAuth login.

`bt login` creates or updates a saved Braintrust login profile. A profile stores credentials and connection details, while organization and project context are selected separately. One profile can be used with every organization its credentials can access.

After logging in, use [`bt switch`](/docs/reference/cli/switch) to select your active organization and project. Use [`bt profiles`](/docs/reference/cli/profiles) to list, rename, or delete saved profiles.

In an interactive terminal, `bt login` prompts you to choose OAuth or API key authentication. OAuth is selected by default.

```bash theme={"theme":{"light":"github-light","dark":"github-dark-dimmed"}}
bt login
bt login --oauth --profile work
bt login --refresh --profile work
```

## Flags

| Flag                    | Description                                                                                                              |
| ----------------------- | ------------------------------------------------------------------------------------------------------------------------ |
| `--oauth`               | Use OAuth login instead of API key login                                                                                 |
| `--refresh`             | Immediately refresh credentials for a saved OAuth profile. OAuth credentials otherwise refresh automatically when needed |
| `--client-id CLIENT_ID` | OAuth client ID. Defaults to `bt_cli_<profile>`                                                                          |
| `--no-browser`          | For OAuth, do not open a browser automatically                                                                           |

`bt login` also accepts credential-related [global flags](/docs/reference/cli/overview#global-flags), such as `--profile`, `--api-url`, and `--app-url`. It does not accept `--org` or `--project`; select those with [`bt switch`](/docs/reference/cli/switch).

## Authentication

For the full credential resolution order, see [Credential precedence](/docs/reference/cli/overview#credential-precedence).
