Documentation

Everything you need to integrate FlagFeature into your app.

Quick Start

Get up and running with FlagFeature in under 5 minutes.

  1. 1Register an account at FlagFeature
  2. 2Create a new project from the dashboard
  3. 3Generate an API key in Settings → API Keys
  4. 4Create your first feature flag
  5. 5Call the SDK evaluate endpoint from your app

SDK Usage

Evaluate feature flags from any language using our REST API.

GETGET /api/sdk/evaluate

Query Parameters

ParamTypeRequiredDescription
projectIdstringrequiredYour project ID
environmentstringrequiredEnvironment name: development, staging, production
userIdstringoptionalUser ID for deterministic rollout hashing
const res = await fetch(
  'https://your-app.vercel.app/api/sdk/evaluate?projectId=PROJ_ID&environment=production&userId=user_123',
  { headers: { 'x-api-key': 'YOUR_API_KEY' } }
)
const { flags } = await res.json()

if (flags.new_feature) {
  // show new feature
}

React Integration

Use this custom hook to evaluate flags in any React component.

import { useEffect, useState } from 'react'

export function useFlags(userId: string) {
  const [flags, setFlags] = useState<Record<string, boolean>>({})

  useEffect(() => {
    fetch(
      `/api/sdk/evaluate?projectId=PROJ_ID&environment=production&userId=${userId}`,
      { headers: { 'x-api-key': process.env.NEXT_PUBLIC_FLAG_API_KEY! } }
    )
      .then(r => r.json())
      .then(data => setFlags(data.flags))
  }, [userId])

  return flags
}

// In your component:
const flags = useFlags(user.id)
if (flags.dark_mode) return <DarkTheme />

Percentage Rollouts

Gradually roll out features to a percentage of your users.

  • Set rollout from 0% to 100% using the slider on the project page
  • Pass a userId to the SDK for deterministic, sticky rollouts
  • The same user always gets the same flag result — no flickering
  • Increasing rollout from 50% to 75% keeps the original 50% cohort in
  • Without a userId, rollout is random per request (not sticky)

Environments

Each project has three environments by default.

developmentFor local development and testing
stagingFor QA and pre-production validation
productionLive traffic — change with care

API Reference

All endpoints require a Bearer JWT token unless noted.

MethodEndpointAuthDescription
POST/api/auth/registerNoneCreate account
POST/api/auth/loginNoneLogin, returns JWT
GET/api/projectsJWTList your projects
POST/api/projectsJWTCreate a project
GET/api/projects/:idJWTProject detail + flags + members
POST/api/projects/:id/flagsJWTCreate a flag
PATCH/api/projects/:id/flags/:id/toggleJWTToggle flag or update rollout %
POST/api/projects/:id/membersJWTInvite a member
DELETE/api/projects/:id/membersJWTRemove a member
GET/api/projects/:id/auditJWTAudit log (last 50)
GET/api/analyticsJWTDashboard analytics
GET/api/sdk/evaluateAPI KeyEvaluate all flags for a project