Skip to content

Feature Flags

Feature flags let you control feature availability without code deployments.

Creating a Flag

Via Dashboard

  1. Navigate to Flags in your dashboard
  2. Click New Flag
  3. Enter a unique key (e.g., new-pricing-page)
  4. Add a description
  5. Set up targeting rules
  6. Save and enable

Via API

bash
curl -X POST https://api.experimentplus.io/v1/flags \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "key": "new-pricing-page",
    "description": "New pricing page design",
    "enabled": true
  }'

Evaluating Flags

typescript
// Simple boolean check
const isEnabled = await client.isEnabled('new-pricing-page', {
  userId: 'user-123'
})

// With default value
const isEnabled = await client.isEnabled('new-pricing-page', {
  userId: 'user-123',
  default: false
})

Targeting Rules

Percentage Rollout

Roll out to a percentage of users:

json
{
  "rules": [
    {
      "type": "percentage",
      "percentage": 25
    }
  ]
}

User Attributes

Target based on user properties:

json
{
  "rules": [
    {
      "type": "attribute",
      "attribute": "plan",
      "operator": "equals",
      "value": "enterprise"
    }
  ]
}

Specific Users

Target specific user IDs:

json
{
  "rules": [
    {
      "type": "users",
      "userIds": ["user-123", "user-456"]
    }
  ]
}

Built with VitePress