Switch features are simple on/off flags that let you gate capabilities based on a customer’s plan. Unlike meter features, they don’t track usage — they simply indicate whether a customer has access to something.
Use Cases
- Enable/disable specific dashboard sections
- Grant access to advanced exports, priority support, or SSO
- Control access to beta features for higher-tier plans
- Toggle API rate limit overrides
Creating a Switch Feature
- Go to Features in the sidebar
- Click Add Feature
- Select Switch as the type
- Enter a name and
lookup_key
- Click Create
curl -X POST https://api.fluxrate.co/api/v1/features \
-H "Content-Type: application/json" \
-H "Cookie: access_token=<token>" \
-d '{
"name": "Advanced Analytics",
"lookup_key": "advanced_analytics",
"description": "Access to advanced analytics dashboard and exports",
"type": "switch"
}'
Attaching to a Plan
# Enable for a higher-tier plan
curl -X POST https://api.fluxrate.co/api/v1/plans/<plan_id>/features \
-H "Content-Type: application/json" \
-H "Cookie: access_token=<token>" \
-d '{
"feature_id": "<feature_id>",
"is_enabled": true
}'
# Explicitly disabled for a starter plan
curl -X POST https://api.fluxrate.co/api/v1/plans/<starter_plan_id>/features \
-H "Content-Type: application/json" \
-H "Cookie: access_token=<token>" \
-d '{
"feature_id": "<feature_id>",
"is_enabled": false
}'
Checking a Feature in Your App
Query the customer’s subscription to check if a switch feature is enabled:
GET /api/v1/subscriptions/<subscription_id>
The response includes the plan’s feature entitlements. Check is_enabled for switch features.
Switch features are the simplest way to implement plan-based feature gating. Combine them with meter features for a complete entitlement model.