DEV Community

Alex Spinov
Alex Spinov

Posted on

Flagsmith Has a Free API — Heres How to Add Feature Flags Without LaunchDarkly

Flagsmith is an open-source feature flag and remote config service. Toggle features, A/B test, and do gradual rollouts — self-hosted or cloud, for free.

Why Flagsmith?

  • Open source: Self-host with full control
  • Feature flags: Toggle features without deployments
  • Remote config: Change values without releasing
  • A/B testing: Built-in experiment framework
  • Segments: Target users by attributes
  • Multi-platform: SDKs for every language
  • Free tier: 50K requests/month on cloud

Self-Host

git clone https://github.com/Flagsmith/flagsmith.git
cd flagsmith
docker compose up -d
Enter fullscreen mode Exit fullscreen mode

Dashboard at http://localhost:8000

REST API: Get Flags

curl https://edge.api.flagsmith.com/api/v1/flags/ \
  -H 'X-Environment-Key: YOUR_ENV_KEY'
Enter fullscreen mode Exit fullscreen mode

REST API: Get Flags for User

curl -X POST https://edge.api.flagsmith.com/api/v1/identities/ \
  -H 'X-Environment-Key: YOUR_ENV_KEY' \
  -H 'Content-Type: application/json' \
  -d '{"identifier": "user-123"}'
Enter fullscreen mode Exit fullscreen mode

JavaScript SDK

import flagsmith from 'flagsmith';

await flagsmith.init({
  environmentID: 'YOUR_ENV_KEY',
  identity: 'user-123',
});

// Check feature flag
if (flagsmith.hasFeature('new_checkout')) {
  renderNewCheckout();
} else {
  renderOldCheckout();
}

// Get remote config value
const maxItems = flagsmith.getValue('max_cart_items'); // 25
Enter fullscreen mode Exit fullscreen mode

React SDK

import { FlagsmithProvider, useFlags } from 'flagsmith/react';

function App() {
  return (
    <FlagsmithProvider
      options={{ environmentID: 'YOUR_ENV_KEY' }}
      flagsmith={flagsmith}
    >
      <MyComponent />
    </FlagsmithProvider>
  );
}

function MyComponent() {
  const flags = useFlags(['new_checkout', 'dark_mode']);

  return (
    <div>
      {flags.new_checkout.enabled && <NewCheckout />}
      {flags.dark_mode.enabled && <DarkModeToggle />}
    </div>
  );
}
Enter fullscreen mode Exit fullscreen mode

Python SDK

from flagsmith import Flagsmith

flagsmith = Flagsmith(environment_key='YOUR_ENV_KEY')

flags = flagsmith.get_environment_flags()
if flags.is_feature_enabled('new_pricing'):
    show_new_pricing()

# Per-user flags
identity_flags = flagsmith.get_identity_flags('user-123')
max_items = identity_flags.get_feature_value('max_cart_items')
Enter fullscreen mode Exit fullscreen mode

Segments (Target Users)

Create segments in the dashboard:

  • beta_users: Users with plan = premium
  • new_users: Users with created_at > 2026-01-01
  • us_users: Users with country = US

Then enable features for specific segments.

Real-World Use Case

A SaaS company used environment variables for feature toggles — every change needed a redeploy. After switching to Flagsmith, PMs toggle features themselves in the dashboard. They caught a bug in the new billing system and disabled it in 3 seconds — no deploy, no downtime.


Need to automate data collection? Check out my Apify actors for ready-made scrapers, or email spinov001@gmail.com for custom solutions.

Top comments (0)