# 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](https://docs.stripe.com/cli/resources.md). - [Tail API request logs](https://docs.stripe.com/cli/logs/tail.md) in real time. - [Securely test webhooks](https://docs.stripe.com/cli/listen.md) without relying on third-party tunneling software. Follow the [installation guide](https://docs.stripe.com/stripe-cli.md#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_******************************p7dc ... ``` ## sandbox If your CLI isn't logged into Stripe, this command provisions a new sandbox with working test API keys, without requiring an account. This enables you, a coding agent, or an automated workflow to start building a Stripe integration immediately. Your temporary sandbox credentials are saved to your CLI profile so that other commands work without needing to log in. You can convert a sandbox into a full Stripe account within seven days with the `sandbox claim` command. If you're already [logged in](https://docs.stripe.com/cli/login.md), `sandbox create` opens the sandbox management page in your Stripe Dashboard. > Sandbox environments expire after 7 days. Claim your sandbox before it expires by running `stripe sandbox claim` to keep your account and data. **Command:** `stripe sandbox [flags]` ### Subcommands - `create` Provision a new sandbox environment with test API keys. Uses a proof-of-work challenge to verify the request, then saves the keys to your current CLI profile so subsequent `stripe` commands work immediately. - `claim` Open the claim URL for your active sandbox in a browser. After claiming, run `stripe login` to get permanent keys. ### Flags for sandbox create - `--email
` Your email address. Required unless `--from-git` is used. Mutually exclusive with `--from-git`. - `--from-git` Infer your email and full name from `git config user.email` and `git config user.name`. Mutually exclusive with `--email`. - `--full-name ` Your full name (optional). Automatically inferred if `--from-git` is used. - `--non-interactive` Print output directly without waiting for input. Useful for scripting and agent-assisted workflows. ### Flags for sandbox claim - `--non-interactive` Print the claim URL directly without waiting for input. ### Examples **Create a sandbox with an email** ```sh stripe sandbox create --email you@example.com ``` ``` Setting up your sandbox... done. { "secret_key": "rkcs_test_abc123", "publishable_key": "pk_test_def456", "claim_url": "https://dashboard.stripe.com/onboard_sandbox/0000000...", "account_id": "acct_ghi789", "expires_at": "2026-06-23" } Use the keys above to start building your integration. This sandbox expires 2026-06-23 (in 7 days). Claim it before then by using the above claim_url or running `stripe sandbox claim`. ``` **Create a sandbox using git config** ```sh stripe sandbox create --from-git ``` ``` Using email: you@example.com (from git config) Setting up your sandbox... done. { "secret_key": "rkcs_test_abc123", "publishable_key": "pk_test_def456", "claim_url": "https://dashboard.stripe.com/onboard_sandbox/0000000...", "account_id": "acct_ghi789", "expires_at": "2026-06-23" } Use the keys above to start building your integration. This sandbox expires 2026-06-23 (in 7 days). Claim it before then by using the above claim_url or running `stripe sandbox claim`. ``` **Claim your sandbox** ```sh stripe sandbox claim ``` ``` Claim your sandbox (acct_ghi789) by visiting the claim link below. Press Enter to open the browser or visit https://dashboard.stripe.com/onboard_sandbox/000000... ``` ## Using Stripe API keys The Stripe CLI supports several different ways to set and use [API keys](https://docs.stripe.com/keys.md): 1. [`stripe login`](https://docs.stripe.com/cli/login.md) 2. [`stripe config`](https://docs.stripe.com/cli/config.md) 3. [`--api-key` flag](https://docs.stripe.com/cli/api_keys.md) 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. ### Example ```title Running commands with a specified API key ``` ## 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