Loading...
Loading...
Vercel CLI expert guidance. Use when deploying, managing environment variables, linking projects, viewing logs, managing domains, or interacting with the Vercel platform from the command line.
npx skill4agent add vercel-labs/vercel-plugin vercel-clivercelvcnpm i -g vercelvercel loginDeprecation notice: Email-based login () and the flagsvercel login your@email.com,--github,--gitlab,--bitbucketwere removed February 26, 2026. The--oobmethod (SAML-based login) remains supported until June 1, 2026, then will also be removed.team
# Preview deployment (from project root)
vercel
# Production deployment
vercel --prod
# Build locally, deploy build output only
vercel build
vercel deploy --prebuilt
# Build for production (uses production env vars)
vercel build --prod
vercel deploy --prebuilt --prod
# Force a new deployment (skip cache)
vercel --force
# Promote a preview deployment to production
vercel promote <deployment-url>
# Rollback to previous production deployment
vercel rollback# Start local dev server with Vercel features
vercel dev
# Link current directory to a Vercel project
vercel link
# Deterministic non-interactive link (recommended for bootstrap/automation)
vercel link --yes --project <name-or-id> --scope <team>
# Pull environment variables and project settings
vercel pull
# Pull specific environment
vercel pull --environment=production
# Open linked project in the Vercel Dashboard
vercel openvercel link --yes --project <name-or-id> --scope <team>vercel open--project--scope# List all environment variables
vercel env ls
# Add an environment variable
vercel env add MY_VAR
# Add for specific environments
vercel env add MY_VAR production
vercel env add MY_VAR preview development
# Add branch-scoped variable
vercel env add MY_VAR preview --branch=feature-x
# Add sensitive (write-only) variable
vercel env add MY_SECRET --sensitive
# Remove an environment variable
vercel env rm MY_VAR
# Pull all env vars to .env.local
vercel env pull
vercel env pull .env.production.local --environment=productionvercel logs# View runtime/function logs (real-time)
vercel logs <deployment-url>
# Follow logs in real-time (streaming mode)
vercel logs <deployment-url> --follow
# Query historical logs (no longer limited to live-only)
vercel logs --since 24h
vercel logs --since 7d
# Filter by time range
vercel logs <deployment-url> --since 1h
vercel logs <deployment-url> --since 30m
# Filter by log level
vercel logs <deployment-url> --level error
vercel logs <deployment-url> --level warning
# Filter by deployment ID, request ID, or arbitrary string
vercel logs --deployment-id dpl_xxxxx
vercel logs --request-id req_xxxxx
vercel logs --query "TypeError"
# Output as JSON (for piping to jq or other tools)
vercel logs <deployment-url> --json
# Combine filters: stream errors from the last hour as JSON
vercel logs <deployment-url> --follow --since 1h --level error --json
# Inspect a deployment (build details, metadata, function list)
vercel inspect <deployment-url>
# List recent deployments
vercel lsNote:shows runtime request logs only. For build output, usevercel logsor view build logs atvercel inspect <deployment-url>→ select deployment → Build Logs.https://vercel.com/{team}/{project}/deploymentsDrains and advanced observability: Log drains, trace export, and analytics data forwarding are configured via the Vercel Dashboard ator REST API (https://vercel.com/dashboard/{team}/~/settings/log-drains), not the CLI. See/v1/drainsfor drain setup, payload schemas, and signature verification.⤳ skill: observability
# List domains
vercel domains ls
# Add a domain to a project
vercel domains add example.com
# Remove a domain
vercel domains rm example.com# List DNS records
vercel dns ls example.com
# Add a DNS record
vercel dns add example.com @ A 1.2.3.4# List teams
vercel teams ls
# Switch to a team
vercel teams switch my-team# Purge all cache (CDN + Data cache) for current project
vercel cache purge
# Purge only CDN cache
vercel cache purge --type cdn
# Purge only Data cache
vercel cache purge --type data
# Purge without confirmation prompt
vercel cache purge --yes
# Invalidate by tag (stale-while-revalidate)
vercel cache invalidate --tag blog-posts
# Invalidate multiple tags
vercel cache invalidate --tag blog-posts,user-profiles,homepage
# Hard delete by tag (blocks until revalidated — use with caution)
vercel cache dangerously-delete --tag blog-posts
# Hard delete with revalidation deadline (deletes only if not accessed within N seconds)
vercel cache dangerously-delete --tag blog-posts --revalidation-deadline-seconds 3600
# Invalidate cached image transformations by source path
vercel cache invalidate --srcimg /api/avatar/1
# Hard delete cached image transformations
vercel cache dangerously-delete --srcimg /api/avatar/1invalidatedangerously-deleteinvalidate--tag--srcimg# Initialize global MCP client configuration for your Vercel account
vercel mcp
# Set up project-specific MCP access for the linked project
vercel mcp --projectvercel mcp@vercel/config# Compile vercel.ts to JSON (stdout)
npx @vercel/config compile
# Validate configuration and show summary
npx @vercel/config validate
# Generate vercel.json locally for development
npx @vercel/config generatevercel.ts.js.mjs.cjs.mtsvercel.jsonvercel.jsonvercel.tsNote: Legacysupport will be removed on March 31, 2026. Rename tonow.json(no content changes needed).vercel.json
vercel integration add# List installed integrations
vercel integration list
# Add an integration (auto-provisions env vars by default)
vercel integration add neon
# Open an integration's dashboard
vercel integration open neon
# Remove an integration
vercel integration remove neondiscoverguide# Search the integration catalog (returns JSON for automation)
vercel integration discover --format=json
# Search with a keyword filter
vercel integration discover database --format=json
# Get agent-friendly setup guide with code snippets
vercel integration guide neon
# Full workflow: discover → add → guide
vercel integration discover storage --format=json
vercel integration add neon
vercel integration guide neondiscover--format=jsonguide <name>Full subcommands:,discover,guide,add(aliaslist),ls,balance,open.remove
# Create a feature flag
vercel flags add redesigned-checkout --kind boolean --description "New checkout flow"
# List SDK keys
vercel flags sdk-keys ls
# Enable/disable, archive, and manage flags from CLI
vercel flags --help⤳ skill: vercel-flagsvercel api# Call any Vercel REST API endpoint
vercel api GET /v9/projects
vercel api GET /v13/deployments
vercel api POST /v9/projects/:id/env --body '{"key":"MY_VAR","value":"val","target":["production"]}'
# Pipe JSON output to jq
vercel api GET /v9/projects | jq '.[].name'# Query project metrics (rich text output with sparklines)
vercel metrics
# Raw values for scripting
vercel metrics --raw-valuesVERCEL_TOKEN=<your-token>
VERCEL_ORG_ID=<org-id>
VERCEL_PROJECT_ID=<project-id>- name: Deploy to Vercel
run: |
vercel pull --yes --environment=production --token=${{ secrets.VERCEL_TOKEN }}
vercel build --prod --token=${{ secrets.VERCEL_TOKEN }}
vercel deploy --prebuilt --prod --token=${{ secrets.VERCEL_TOKEN }}| Flag | Purpose |
|---|---|
| Authentication token (for CI) |
| Working directory |
| Verbose output |
| Skip confirmation prompts |
| Execute as a team |
vercel link # Connect to Vercel project
vercel env pull # Get environment variables
vercel dev # Start local devvercel pull --yes --environment=production --token=$TOKEN
vercel build --prod --token=$TOKEN
vercel deploy --prebuilt --prod --token=$TOKENvercel # Creates preview deployment, returns URL