vercel flags
The vercel flags command manages Vercel Flags for a project directly from the command line. You can create, list, inspect, enable, disable, archive, and delete feature flags, as well as manage SDK keys.
vercel flags listUsing the vercel flags command to list all active
feature flags.
vercel flags add [slug]Using the vercel flags command to create a new
feature flag.
vercel flags inspect [flag]Using the vercel flags command to display information
about a feature flag.
vercel flags enable [flag]Using the vercel flags command to enable a boolean
feature flag in an environment.
vercel flags disable [flag]Using the vercel flags command to disable a boolean
feature flag in an environment.
vercel flags archive [flag]Using the vercel flags command to archive a feature
flag.
vercel flags rm [flag]Using the vercel flags command to delete a feature
flag.
Boolean flags are created by default. You can specify a different kind and an optional description:
vercel flags add my-feature --kind string --description "My feature flag"Creating a string feature flag with a description.
When you create a flag, default variants are generated based on the kind:
| Kind | Default variants |
|---|---|
boolean | Off (false) and On (true) |
string | Value 1 and Value 2 |
number | 50, 100, and 200 |
All three environments (production, preview, and development) start as paused.
The enable and disable commands control whether a boolean flag evaluates rules in a given environment. If you don't provide the --environment option, you'll be prompted to select one interactively.
vercel flags enable my-feature --environment productionEnabling a flag in production so it evaluates rules and serves variants.
vercel flags disable my-feature -e production --variant offDisabling a flag with a specific variant to serve while disabled.
The enable and disable
commands only work with boolean flags. For string or number flags, update them
in the
dashboard.
A flag must be archived before it can be deleted. Archived flags stop evaluating and can be restored from the dashboard.
vercel flags archive my-feature --yesArchiving a flag without a confirmation prompt.
vercel flags rm my-feature --yesDeleting an archived flag without a confirmation prompt.
The vercel flags sdk-keys subcommand manages SDK keys for your project. SDK keys authenticate your application when evaluating flags. You can create keys for different environments and key types.
vercel flags sdk-keys lsUsing the vercel flags sdk-keys ls command to list
all SDK keys.
vercel flags sdk-keys add --type server --environment productionCreating a server SDK key for the production environment.
vercel flags sdk-keys rm [hash-key]Using the vercel flags sdk-keys rm command to delete
an SDK key.
When you create an SDK key, the output includes:
- Hash key: A truncated identifier shown in the key list
- SDK key: The full key value, shown only at creation time
- Connection string: A
flags:URI containing all configuration needed to connect to Vercel Flags
Save the SDK key when it's created. It won't be shown again.
If you don't provide the --environment option, you'll be prompted to select one interactively.
These are options that only apply to the vercel flags command.
The --state option, shorthand -s, filters the list of flags by state when using vercel flags list. Valid values are active and archived. Defaults to active.
vercel flags ls --state archivedUsing the vercel flags ls command with the
--state option to list archived flags.
The --kind option, shorthand -k, specifies the type of a new flag when using vercel flags add. Valid values are boolean, string, and number. Defaults to boolean.
vercel flags add my-feature --kind stringUsing the vercel flags add command with the
--kind option to create a string flag.
The --description option, shorthand -d, sets a description for a new flag when using vercel flags add.
vercel flags add my-feature --description "Controls the new onboarding flow"Using the vercel flags add command with the
--description option.
The --environment option, shorthand -e, specifies the target environment for vercel flags enable, vercel flags disable, and vercel flags sdk-keys add. Valid values are production, preview, and development.
vercel flags enable my-feature --environment productionUsing the vercel flags enable command with the
--environment option.
The --variant option, shorthand -v, specifies the variant ID to serve when disabling a flag with vercel flags disable.
vercel flags disable my-feature -e production --variant offUsing the vercel flags disable command with the
--variant option.
The --type option specifies the type of SDK key when using vercel flags sdk-keys add.
vercel flags sdk-keys add --type server --environment productionUsing the vercel flags sdk-keys add command with
the --type option.
The --label option, shorthand -l, sets an optional label for an SDK key when using vercel flags sdk-keys add.
vercel flags sdk-keys add --type server -e production --label "Production Server Key"Using the vercel flags sdk-keys add command with
the --label option.
The --yes option, shorthand -y, skips the confirmation prompt when archiving or deleting a flag, or when deleting an SDK key.
vercel flags archive my-feature --yesUsing the vercel flags archive command with the
--yes option to skip confirmation.
The following global options can be passed when using the vercel flags command:
For more information on global options and their usage, refer to the options section.
Was this helpful?