Switchflag
Getting Started

Create a Flag

Define a feature flag with a key, type, and default value, then toggle it per environment.

Create a flag

  1. Navigate to your project's Flags page
  2. Click Create Flag
  3. Fill in the details:
FieldDescription
NameHuman-readable name (e.g. "New Checkout Flow")
KeyUnique identifier used in code (e.g. new-checkout-flow). Lowercase letters, numbers, and hyphens only.
TypeOne of: boolean, string, number, json
Default ValueThe value returned when no targeting rules match
DescriptionOptional notes about what this flag controls

Flag types

TypeDefault Value ExampleUse Case
booleanfalseSimple on/off toggles
string"control"A/B test variants, theme names
number0Rate limits, thresholds
json{"maxItems": 10}Complex configuration objects

Per-environment configuration

Flags exist at the project level, but their enabled state and targeting rules are configured independently per environment.

When you first create a flag, it's disabled in all environments. To start evaluating it:

  1. Go to the flag's detail page
  2. Select an environment (e.g. Development)
  3. Toggle the flag on
  4. Optionally add targeting rules

A flag that's disabled always returns the default value with reason: 'disabled'.

Adding targeting rules

Targeting rules let you return different values based on the evaluation context (user attributes). Rules are evaluated in order — the first match wins.

Each rule has:

  • Attribute — the context property to check (e.g. userId, email, country)
  • Operator — how to compare (e.g. equals, contains, in, percent)
  • Value — what to compare against
  • Return Value — the value to return when this rule matches

Example: return true for users where email contains @acme.com:

AttributeOperatorValueReturn Value
emailcontains@acme.comtrue

See Evaluation Engine for details on all operators, percentage rollouts, and rule ordering.

Next steps