IT Docs
CLI

Environment Variables (CLI)

The vercel env command and the difference between vercel env pull and vercel pull.

The vercel env command manages a project's environment variables across the Production, Preview, and Development targets.

vercel env ls

Lists configured variables — names and targets, never the values.

vercel env ls
vercel env ls production    # only a specific target

vercel env add

Adds a variable. You're prompted for the value and target if not supplied.

vercel env add API_KEY production

# Pipe a value from a file (avoids shell history exposure)
vercel env add API_KEY production < ./secret.txt

You can't combine development with production or preview in one add — add development variables in a separate command. If your team enforces sensitive-variable policy, development adds may be disallowed and production/preview writes treated as sensitive.

vercel env rm

vercel env rm API_KEY production

vercel env pull

Exports development variables to a local file (default .env.local) for framework dev servers like next dev or vite.

vercel env pull
vercel env pull .env.local
vercel env pull --environment=preview .env.preview

vercel env pull vs vercel pull

This is the common point of confusion:

CommandWrites toUse when you run
vercel env pulla .env fileyour framework's dev server (next dev, vite, …)
vercel pullthe .vercel/ directoryvercel dev or vercel build

vercel dev and vercel build read project settings and variables from .vercel/, which vercel pull provides. Framework dev commands read .env files, which vercel env pull provides.

Running a command with the variables

vercel env pull .env.local
# then start your dev server, which reads .env.local
npm run dev

On this page