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

# login

Authenticate with Runpod and save your API key for all Flash operations, including CLI commands and standalone `@Endpoint` functions.

```bash theme={"theme":{"light":"github-light","dark":"github-dark"}}
flash login [OPTIONS]
```

## Example

Authenticate with Runpod (opens browser automatically):

```bash theme={"theme":{"light":"github-light","dark":"github-dark"}}
flash login
```

The command opens your default browser to the Runpod authorization page. After you approve the request, your API key is saved locally for future CLI operations.

## How it works

1. Flash generates an authorization request.
2. Your browser opens to the Runpod console authorization page.
3. You approve the request in your browser.
4. Flash saves your API key to `~/.runpod/config.toml`.

## Flags

<ResponseField name="--no-open">
  Don't automatically open the browser. Instead, manually copy the authorization URL and open it yourself.
</ResponseField>

<ResponseField name="--timeout" type="float" default="600">
  Maximum time in seconds to wait for authorization. Default is 600 seconds (10 minutes).
</ResponseField>

<ResponseField name="--force">
  Force re-authentication even if credentials already exist. By default, `flash login` skips the browser flow when it finds existing credentials.
</ResponseField>

## Credential storage

After successful login, your API key is saved to `~/.runpod/config.toml`. This file is used by:

* All Flash CLI commands (`flash dev`, `flash deploy`, etc.)
* Standalone Python scripts using `@Endpoint` functions
* Any code using the Flash SDK

<Note>
  Keep your API key secure. Never commit it to version control. The credentials file is stored in your home directory, outside of project directories.
</Note>

## Alternative: Environment variable authentication

Instead of using `flash login`, you can set your API key directly as an environment variable:

```bash theme={"theme":{"light":"github-light","dark":"github-dark"}}
export RUNPOD_API_KEY=your_api_key_here
```

Or add it to your project's `.env` file for local CLI use:

```bash theme={"theme":{"light":"github-light","dark":"github-dark"}}
RUNPOD_API_KEY=your_api_key_here
```

Generate an API key from [Settings > API Keys](https://www.runpod.io/console/user/settings) in the Runpod console.

## Credential resolution priority

Flash checks for credentials in this order:

1. `RUNPOD_API_KEY` environment variable
2. `RUNPOD_API_KEY` in a `.env` file (loaded automatically at startup)
3. Credentials file (`~/.runpod/config.toml`)

The first valid credential found is used. Environment variables take precedence over the credentials file, so you can override per-project or per-session without modifying stored credentials.

<Warning>
  Values in your `.env` file are only used for local CLI commands and development. They are **not** passed to deployed endpoints. To set environment variables on deployed endpoints, use the `env` parameter in your endpoint configuration. See [Endpoint parameters](/flash/configuration/parameters#env) for details.
</Warning>

<Warning>
  Your Runpod API key needs **All** access permissions.
</Warning>

## Related commands

* [`flash init`](/flash/cli/init) - Create a new Flash project
* [`flash dev`](/flash/cli/dev) - Start the development server
* [`flash deploy`](/flash/cli/deploy) - Build and deploy to Runpod
