Visitar URL original
Getting Started with Vercel FlagsSkip to content

Getting Started with Vercel Flags

This guide walks you through creating a feature flag in the Vercel Dashboard and evaluating it in your application. By the end you'll have a working flag that you can toggle from the dashboard.

Agent Prompt

Help me set up Vercel Flags in this project. First, make sure the Vercel CLI is installed (`npm i -g vercel`). If I'm using Claude Code or Cursor, install the Vercel Plugin (`npx plugins add vercel/vercel-plugin`). For other agents, install Vercel Skills (`npx skills add vercel-labs/agent-skills`). Then: 1. Run `vercel link` and `vercel env pull` to get OpenID Connect (OIDC) credentials locally. 2. Use `vercel flags` to create a feature flag for the project. Install the flags SDK and configure it to evaluate the flag. 3. Use the flag to conditionally render content in a page. 4. Deploy with `vercel --prod`.

    1. Go to your Vercel Dashboard.
    2. Open Flags in the sidebar for your project.
    3. Create a new flag named marketing-banner.
    4. Leave the Type set to Boolean and configure the environment settings to be on for Development and off for Preview and Production.
  1. Vercel Flags authenticates with the Vercel OpenID Connect (OIDC) token associated with your project. Vercel deployments receive this token automatically. For local development, pull environment variables into your .env.local file:

    terminal
    vercel env pull

    If your project isn't linked yet, run vercel link first.

  2. Toggle the flag off for the Development environment in the Vercel Dashboard, then press Review and save and leave a message for the change. Reload the page to see the change.

  3. Now that your flag is working, you can add an identify function to pass user and team context for targeting rules. This lets you roll out flags to specific users, plans, or teams from the dashboard.

When you deploy to Vercel, the build process fetches your latest flag definitions once at build time and bundles them into the deployment. This guarantees every function uses the same snapshot during the build, and provides a runtime fallback if the Vercel Flags service is temporarily unreachable. Definitions are only fetched when you are using the Flags SDK packages or when your project has at least one environment variable containing an SDK key for Vercel Flags.

Learn more about embedded definitions.

Your flag is working. Here's what to explore next:

  • Entities and targeting: Define user attributes and create rules to show flags to specific groups.
  • Segments: Build reusable audience groups like "Beta Testers" or "Internal Team."
  • Flags Explorer: Override flags in the Vercel Toolbar during development without affecting other users.
  • Drafts: Define flags in code first, then promote them in the dashboard when you're ready.
  • Observability: Track flag evaluations in Runtime Logs and Web Analytics.
  • Managing flags: Configure rules, environments, and flag lifecycles in the dashboard.
Last updated August 11, 2026

Was this helpful?

supported.