API Reference

Base URL: https://flagbit.anethoth.com

Authentication

Two types of keys:

  • API Key (fb_...) — For managing projects and flags. Use in Authorization: Bearer fb_...
  • SDK Key (fbsdk_...) — For evaluating flags from your application. Scoped to a single project.
POST /api/v1/signup

Create a new account. Returns API key and SDK key (shown once).

curl -X POST https://flagbit.anethoth.com/api/v1/signup \
  -H "Content-Type: application/json" \
  -d '{"email": "[email protected]"}'

Projects

GET /api/v1/projects

List all projects. Requires API key.

POST /api/v1/projects

Create a new project. Returns a unique SDK key.

curl -X POST https://flagbit.anethoth.com/api/v1/projects \
  -H "Authorization: Bearer fb_your_api_key" \
  -H "Content-Type: application/json" \
  -d '{"name": "My App"}'

Flags

GET /api/v1/projects/{id}/flags

List all flags in a project.

POST /api/v1/projects/{id}/flags

Create a flag with optional targeting rules.

curl -X POST https://flagbit.anethoth.com/api/v1/projects/1/flags \
  -H "Authorization: Bearer fb_your_api_key" \
  -H "Content-Type: application/json" \
  -d '{
    "key": "new_checkout",
    "name": "New Checkout Flow",
    "enabled": true,
    "rules": [
      {
        "conditions": [
          {"attribute": "country", "operator": "in", "value": ["US", "CA"]},
          {"attribute": "user_id", "operator": "percent", "value": 50}
        ],
        "value": "true"
      }
    ]
  }'

Rule operators:

  • eq — equals
  • neq — not equals
  • contains — string contains
  • in — value in list
  • percent — percentage rollout (0-100)
PUT /api/v1/projects/{id}/flags/{key}

Update a flag (toggle, change rules, etc).

curl -X PUT https://flagbit.anethoth.com/api/v1/projects/1/flags/new_checkout \
  -H "Authorization: Bearer fb_your_api_key" \
  -H "Content-Type: application/json" \
  -d '{"enabled": false}'
DELETE /api/v1/projects/{id}/flags/{key}

Delete a flag permanently.

Evaluate Flags

Use your SDK key (not API key) for evaluation endpoints.

POST /api/v1/evaluate

Evaluate multiple flags at once with user context.

curl -X POST https://flagbit.anethoth.com/api/v1/evaluate \
  -H "Content-Type: application/json" \
  -d '{
    "sdk_key": "fbsdk_your_sdk_key",
    "flags": ["new_checkout", "dark_mode"],
    "context": {
      "user_id": "usr_123",
      "country": "US",
      "plan": "pro"
    }
  }'
GET /api/v1/evaluate/{flag_key}?sdk_key=fbsdk_...

Evaluate a single flag (no context). Useful for simple on/off flags.

POST /api/v1/checkout

Create a Stripe checkout session to upgrade. Requires API key auth.

curl -X POST https://flagbit.anethoth.com/api/v1/checkout \
  -H "Authorization: Bearer fb_your_api_key" \
  -H "Content-Type: application/json" \
  -d '{"plan": "starter"}'

Plans: starter ($9/mo), pro ($29/mo), business ($49/mo)

Error Codes

400Bad request — invalid or missing parameters
401Unauthorized — invalid or missing API/SDK key
403Forbidden — plan limit reached
404Not found — project or flag doesn't exist
409Conflict — resource already exists
429Rate limited — too many requests
503Service unavailable — payment system down