# Stripe CLI reference ## Stripe CLI reference This reference documents every command and flag available in Stripe’s command-line interface. The Stripe CLI helps you build, test, and manage your Stripe integration right from the terminal. With the CLI, you can: - Create, retrieve, update, and delete [API objects](/cli/resources). - [Tail API request logs](/cli/logs/tail) in real time. - [Securely test webhooks](/cli/listen) without relying on third-party tunneling software. Follow the [installation guide](/stripe-cli#install) to set up the Stripe CLI. ## login Connect the CLI to your Stripe account by logging in to persist your secret key locally. The Stripe CLI runs commands using a global configuration or project-specific configurations. To configure the CLI globally, run: ```sh stripe login ``` You'll be redirected to the Dashboard to confirm that you want to give the CLI access to your account. After confirming, a new API key will be created for the CLI. > All configurations are stored in `~/.config/stripe/config.toml`, including login credentials. You can use the [`XDG_CONFIG_HOME`](https://wiki.archlinux.org/index.php/XDG_Base_Directory) environment variable to override this location. The configuration file is not automatically removed when the CLI is uninstalled. **Command:** `stripe login` ### Flags - `-i, --interactive` Use interactive configuration mode if you cannot open a browser and would like to manually provide an API key. - `--project-name=` You can create project-specific configurations with the `--project-name` flag, which can be used in any context. If you do not provide the `--project-name` flag for a command, it will default to the global configuration. ### Examples **Basic login** ```sh stripe login ``` **Log in and specify a project** ```sh stripe login --project-name=rocket-rides ``` ``` Your pairing code is: excels-champ-wins-quaint This pairing code verifies your authentication with Stripe. Press Enter to open the browser ... ``` **Log in using interactive mode** ```sh stripe login --interactive ``` ``` Enter your API key: Your API key is: sk_******************************1234 ... ``` ## Using Stripe API keys The Stripe CLI supports several different ways to set and use [API keys](/keys): 1. [`stripe login`](/cli/login) 2. [`stripe config`](/cli/config) 3. [`--api-key` flag](/cli/api_keys) 4. Environment variables Each supports a different use case. `stripe login` is the easiest and recommended way to get started. Running this command will prompt you to log in from your browser and persist your API key locally, rather than requiring it for each command. If you want to provide an API key manually, you can use `stripe login --interactive`. Using `stripe config` allows you to set persistent keys manually: - `stripe config --set test_mode_api_key sk_test_123` `--api-key` is a global flag that overrides your local configuration if you need to run one-off commands with a specific API key. You can set two environment variables, which take precedence over all other values: - `STRIPE_API_KEY`: the API key to use for the CLI. - `STRIPE_DEVICE_NAME`: the device name for the CLI, visible in the Dashboard. ## config Use the `config` command to manually set configuration options for the CLI. The `config` command supports: * Setting options * Unsetting options * Listing all configured options * Opening the configuration file with your default editor All commands support the `--project-name` global flag. You can define a unique configuration for individual projects. **Command:** `stripe config` ### Flags - `-e, --edit` Opens the configuration file in your default editor. - `--list` Lists all configured options (including defaults). - `--set