API reference

Your services read their feature flags from FeatureManager over HTTPS. Version 1 has three read-only calls: every flag of an environment, one flag by key, and a check of the token itself.

Overview

Base URL
https://featuremanager.dev/api/v1
Format
JSON, UTF-8. Times are ISO 8601 in UTC.
Access
Read only. Flags are changed in FeatureManager itself, where the audit log records who did it.
Scope
One token reads one environment of one system.
Versioning
The version is in the path. An incompatible change would be /api/v2, beside v1.

Authentication

Send an API token as a bearer token on every call. A token belongs to one environment of one system: a sit token can never read prod, and a token for one system cannot read another.

Authorization: Bearer fm_…
  • Create a token on the system's page: Edit next to an environment, then API tokens. Any member of the team can create one.
  • The token is shown once, when it is created. FeatureManager keeps only a fingerprint and the first characters, such as fm_7Hq2xa…, so you can tell tokens apart.
  • Every token expires: three months ahead by default, at most twelve. See Token lifecycle.
  • A token is a secret. Call the API from your servers, not from a browser or a mobile app; the API sends no CORS headers. Give front ends their flags through your own backend.

List flags

GET /api/v1/flags

Every feature of the token's system with its value in the token's environment, ordered by key.

Response 200 OK

{
  "system": "Checkout",
  "environment": "prod",
  "updated_at": "2026-11-01T17:06:01Z",
  "flags": [
    {
      "key": "checkout.apple-pay",
      "kind": "boolean",
      "value": false,
      "description": "Apple Pay as a payment method."
    },
    {
      "key": "checkout.gift-cards",
      "kind": "boolean",
      "value": true,
      "description": "Pay all or part with a gift card."
    },
    {
      "key": "checkout.new-flow",
      "kind": "boolean",
      "value": false,
      "description": "The redesigned one-page checkout."
    }
  ]
}

Response headers

Content-Type: application/json; charset=utf-8
ETag: W/"6afdfeda5ace150274d4df92a12d1708"
Last-Modified: Sun, 01 Nov 2026 17:06:01 GMT
Cache-Control: max-age=0, private, must-revalidate

Get one flag

GET /api/v1/flags/{key}

One feature by its key, with the system and environment it was read from. Keys use lowercase letters, digits, . - and _, so they go into the path as they are. A feature that does not exist answers 404.

Response 200 OK

{
  "key": "checkout.new-flow",
  "kind": "boolean",
  "value": false,
  "description": "The redesigned one-page checkout.",
  "system": "Checkout",
  "environment": "prod"
}

It carries an ETag and Last-Modified too. They move whenever the list does, so a change to another feature also makes this answer fresh.

Check a token

GET /api/v1/token

The token you send, described. Call it at start-up to make sure the service got the token for the environment you meant, and log a warning when status says "expires soon". It never returns the secret token or its fingerprint, and it is sent with Cache-Control: no-store. An expired or revoked token answers 401, like on every other call.

Response 200 OK

{
  "name": "checkout-web",
  "prefix": "fm_7Hq2xa",
  "system": "Checkout",
  "environment": "prod",
  "created_at": "2026-11-01T17:06:01Z",
  "expires_at": "2027-02-01T23:59:59Z",
  "status": "active"
}

Fields: name and prefix as shown in FeatureManager, the system and environment it reads, created_at and expires_at in ISO 8601 UTC, and status, "active" or, in the last ten days, "expires soon".

Response fields

FieldTypeMeaning
system string The system's name.
environment string The environment's name, such as dit, sit or prod.
updated_at string List only. The latest change to this system's features or to this environment, ISO 8601 UTC, the same time as Last-Modified. It can move while the flags stay the same, for example when the system's description is edited.
flags array List only. One object per feature, ordered by key.
key string The feature's key, unique within the system.
kind string How to read value. Today always "boolean"; more kinds will come (see Compatibility).
value boolean The value in this environment. A feature never turned on here is false.
description string or null What the feature is for, as written in FeatureManager.

Caching and polling

Every flags answer has an ETag and a Last-Modified header. Send the ETag back as If-None-Match and FeatureManager answers 304 Not Modified with no body until something changes. The ETag and Last-Modified change when a value changes in this environment, when a feature is added, removed or edited, and when the system or environment is renamed. An edit that does not show in the answer, such as the system's description, changes them too. Prefer the ETag over If-Modified-Since: Last-Modified counts whole seconds, so two changes within one second look the same to it.

  • Fetch the list once at start-up, then poll in the background every 30 to 60 seconds, sending the last ETag. A changed flag reaches your service within one interval.
  • Keep the last good answer in memory and answer flag checks from it, never with a call per check.
  • If FeatureManager cannot be reached, answers 5xx or 429, or rejects the token with 401, go on with the cached flags rather than switching everything off. Log a 401 as an error: the token has expired or been revoked.
  • On a 429, wait the seconds in Retry-After before the next poll.
  • Decide a default for keys you do not find. The samples below treat a missing key as off.
  • A 304 still counts towards the rate limit, but costs almost nothing to answer.
  • A 200 is the whole list. Compare it with the cache before you replace it to see what changed: the samples below log one line, such as checkout.new-flow: false -> true.

When to drop the cache

  • Replace it with every 200.
  • Keep it on a 304, a network error, a 5xx, a 429 and a 401. Alert on a 401: no change will reach you until the token is replaced.
  • Drop it only when an answer names another system or environment than the one you have cached: the token now reads somewhere else, and the old flags are not valid there. The samples log a warning and take the new answer.
  • Optionally write the last good answer to disk, so the service can start with real flags while FeatureManager cannot be reached.
  • Alert when no refresh has succeeded for a long time, rather than falling back to defaults.

Errors

Errors from the API are JSON with an error code you can match on and a message for people; some add fields, such as retry_after. A path or method that no endpoint answers under /api, such as GET /api/v1/flag or OPTIONS /api/v1/flags, answers a JSON 404 too, with or without a token.

StatusWhenBody
400 The path or a parameter cannot be read, such as a broken percent-escape like %FF in a key. {"error":"bad_request","message":"The request could not be read: the path or a parameter is not valid."}
401 The token is missing, unknown, expired or revoked. All four answer the same, so the API never tells whether a token exists. Comes with WWW-Authenticate: Bearer realm="featuremanager". {"error":"unauthorized","message":"Missing, unknown, expired or revoked token."}
404 No feature with that key in the token's system. {"error":"not_found","message":"No feature \"checkout.nope\" in Checkout."}
404 No endpoint for that method and path. Needs no token. {"error":"not_found","message":"No such endpoint: GET /api/v1/flag."}
429 Too many calls. Wait the number of seconds in the Retry-After header. {"error":"rate_limited","message":"Too many requests. Try again in 23 seconds.","retry_after":23}

Rate limits

  • 120 calls a minute per token.
  • 300 calls a minute per IP address under /api/, with or without a token, which keeps guessing tokens slow. Instances that share one outgoing address, behind NAT or a cloud gateway, share this limit.
  • These are the only limits on the API: calls under /api/ do not count towards the site's limit for web pages.
  • Over a limit, the answer is 429. Retry-After gives the seconds until that limit's one-minute window ends, so never more than 60.
  • Polling every 30 seconds is 2 calls a minute per instance: up to about 150 instances can share one address, and up to about 60 can share one token. Give each service its own token, and poll less often if you run more.

Token lifecycle

  • Expiry. The creator picks the date: three months ahead unless they choose otherwise, never more than twelve. An expired token answers 401, like a revoked one.
  • Reminder. Ten days before a token expires, its creator and the team's owners get one email naming the token, the system, the environment and the date. It goes out with the daily run, so a token made with less than ten days left is reminded the next morning.
  • Overview. Team owners see every token of the team, with status, expiry and last use, and can create and revoke tokens there.
  • Last used is updated at most once a minute, so a token that is polled shows as alive without a write on every call.
  • Revoking takes effect on the next call.

Rotating a token without downtime

  1. Create a new token for the same environment. Several tokens can be active at once.
  2. Check the new token with GET /api/v1/token: it should name the system and environment you expect. Then deploy your service with it.
  3. When the old token's last used stops moving, revoke it.

Code samples

Each sample reads the token from the FEATUREMANAGER_TOKEN environment variable. Every sample except curl is a small cache you can copy: it keeps the flags from the last good answer in memory, polls every 30 seconds with If-None-Match, and keeps serving the cache on network errors, 5xx, 429 (waiting Retry-After) and 401 (logged as an error). The flag check (isOn, is_on, on?, IsOn) reads only the cache and treats an unknown key as off. The curl lines show the ETag round trip by hand.

curl
curl -H "Authorization: Bearer $FEATUREMANAGER_TOKEN" \
     https://featuremanager.dev/api/v1/flags

# One feature
curl -H "Authorization: Bearer $FEATUREMANAGER_TOKEN" \
     https://featuremanager.dev/api/v1/flags/checkout.new-flow

# Keep the ETag, send it back: 304 and no body while nothing changed
etag=$(curl -s -o /dev/null -D - -H "Authorization: Bearer $FEATUREMANAGER_TOKEN" \
       https://featuremanager.dev/api/v1/flags | awk 'tolower($1) == "etag:" { print $2 }' | tr -d '\r')
curl -i -H "Authorization: Bearer $FEATUREMANAGER_TOKEN" -H "If-None-Match: $etag" \
     https://featuremanager.dev/api/v1/flags

# A 429 carries Retry-After: wait that many seconds before calling again
JavaScript (Node 22+, ES module)
// A cache in your service: isOn() reads memory only, a timer refreshes it.
const URL = "https://featuremanager.dev/api/v1/flags";
let flags = {};        // from the last good answer
let etag = null;
let source = null;     // "system/environment" of the last good answer
let pauseUntil = 0;    // set by a 429's Retry-After

async function refresh() {
  const res = await fetch(URL, {
    headers: {
      Authorization: `Bearer ${process.env.FEATUREMANAGER_TOKEN}`,
      ...(etag && { "If-None-Match": etag }),
    },
    signal: AbortSignal.timeout(5000),
  });
  if (res.status === 304) return;              // nothing changed: keep the cache
  if (res.status === 401) {
    console.error("FeatureManager: token expired or revoked, serving cached flags");
  } else if (res.status === 429) {
    const n = Number(res.headers.get("Retry-After") ?? NaN);
    const secs = Number.isFinite(n) ? n : 60;
    pauseUntil = Date.now() + secs * 1000;
    console.warn(`FeatureManager rate limit, next poll in ${secs} s`);
  } else if (!res.ok) {
    console.warn(`FeatureManager answered ${res.status}, keeping cached flags`);
  } else {
    const body = await res.json();
    const next = Object.fromEntries(body.flags.map((f) => [f.key, f.value]));
    const answered = `${body.system}/${body.environment}`;
    if (source === null) {
      console.info(`FeatureManager: loaded ${body.flags.length} flags from ${answered}`);
    } else if (answered !== source) {
      console.warn(`FeatureManager: token now reads ${answered}, was ${source}; replacing all`);
    } else {
      logChanges(flags, next);
    }
    [flags, etag, source] = [next, res.headers.get("ETag"), answered];
  }
}

// One line per refresh: "checkout.new-flow: false -> true, added x, removed y".
function logChanges(old, next) {
  const has = Object.hasOwn, show = JSON.stringify;
  const changes = Object.keys(next)
    .filter((k) => has(old, k) && show(old[k]) !== show(next[k]))
    .map((k) => `${k}: ${show(old[k])} -> ${show(next[k])}`);
  for (const k of Object.keys(next)) if (!has(old, k)) changes.push(`added ${k}`);
  for (const k of Object.keys(old)) if (!has(next, k)) changes.push(`removed ${k}`);
  if (changes.length) console.info(`FeatureManager: ${changes.join(", ")}`);
}

const poll = () => refresh().catch((e) =>
  console.warn("FeatureManager unreachable, keeping cached flags:", e.message));

await poll();                                  // if it is down, everything starts off
setInterval(() => { if (Date.now() >= pauseUntil) poll(); }, 30_000).unref();

// Cache only, never calls the API. Unknown keys count as off.
export const isOn = (key) => flags[key] === true;

if (isOn("checkout.new-flow")) { /* new checkout */ }
Python 3.11+ (requests)
import json, logging, os, threading, time
import requests

URL = "https://featuremanager.dev/api/v1/flags"
logging.basicConfig(level=logging.INFO)  # or set up logging in your app; changes log at INFO
log = logging.getLogger("featuremanager")
session = requests.Session()
session.headers["Authorization"] = f"Bearer {os.environ['FEATUREMANAGER_TOKEN']}"
# Only the poller writes, and it swaps in a whole new dict in one
# assignment, so readers need no lock.
etag, flags, source, pause_until = None, {}, None, 0.0

def refresh():
    global etag, flags, source, pause_until
    try:
        res = session.get(URL, headers={"If-None-Match": etag} if etag else {}, timeout=5)
        if res.status_code == 304:
            return  # nothing changed: keep the cache
        if res.status_code == 401:
            log.error("FeatureManager token expired or revoked; serving cached flags")
        elif res.status_code == 429:
            wait = res.headers.get("Retry-After", "")
            wait = int(wait) if wait.isdigit() else 60
            pause_until = time.monotonic() + wait
            log.warning("FeatureManager rate limit, next poll in %s s", wait)
        elif res.status_code >= 400:
            log.warning("FeatureManager answered %s, keeping cached flags", res.status_code)
        else:
            answer = res.json()
            new = {f["key"]: f["value"] for f in answer["flags"]}
            answered = f"{answer['system']}/{answer['environment']}"
            if source is None:
                log.info("FeatureManager: loaded %d flags from %s", len(new), answered)
            elif answered != source:
                log.warning("FeatureManager: token now reads %s, was %s; replacing all",
                            answered, source)
            else:
                log_changes(flags, new)
            flags, etag, source = new, res.headers.get("ETag"), answered
    except Exception as e:  # network error or an unexpected body: never kill the poller
        log.warning("FeatureManager poll failed, keeping cached flags: %s", e)

def log_changes(old, new):  # one line: "checkout.new-flow: false -> true, added x"
    show = json.dumps
    changes = [f"{k}: {show(old[k])} -> {show(v)}"
               for k, v in new.items() if k in old and show(old[k]) != show(v)]
    changes += [f"added {k}" for k in new if k not in old]
    changes += [f"removed {k}" for k in old if k not in new]
    if changes:
        log.info("FeatureManager: %s", ", ".join(changes))

def is_on(key):
    return flags.get(key) is True  # cache only; unknown keys count as off

def poll():
    while True:
        time.sleep(30)
        if time.monotonic() >= pause_until:  # a 429's Retry-After
            refresh()

refresh()  # at start-up, before the first is_on
threading.Thread(target=poll, daemon=True).start()

if is_on("checkout.new-flow"):
    ...  # new checkout
Ruby 3.3+ (net/http)
require "net/http"
require "json"

# A cache in your service: on? reads memory only, a thread refreshes it.
# In Rails, use Rails.logger instead of warn.
class FeatureFlags
  URL = URI("https://featuremanager.dev/api/v1/flags")

  def initialize(token) = (@token, @flags, @etag, @pause_until = token, {}, nil, Time.at(0))
  def on?(key) = @flags[key] == true   # cache only; unknown keys count as off
  def start = (refresh; Thread.new { loop { sleep 30; refresh if Time.now >= @pause_until } }; self)

  def refresh
    request = Net::HTTP::Get.new(URL)
    request["Authorization"] = "Bearer #{@token}"
    request["If-None-Match"] = @etag if @etag
    response = Net::HTTP.start(URL.host, URL.port, use_ssl: URL.scheme == "https",
                               open_timeout: 5, read_timeout: 5) { |http| http.request(request) }
    case response
    when Net::HTTPNotModified then nil   # nothing changed: keep the cache
    when Net::HTTPOK
      answer = JSON.parse(response.body)
      flags = answer["flags"].to_h { |f| [ f["key"], f["value"] ] }
      answered = answer.values_at("system", "environment").join("/")
      if @source.nil?
        warn "FeatureManager: loaded #{flags.size} flags from #{answered}"
      elsif answered != @source
        warn "WARNING FeatureManager: token now reads #{answered}, was #{@source}; replacing all"
      else
        log_changes(@flags, flags)
      end
      # One assignment swaps in the new hash, so readers need no Mutex.
      @flags, @etag, @source = flags, response["ETag"], answered
    when Net::HTTPUnauthorized
      warn "ERROR FeatureManager: token expired or revoked; serving cached flags"
    when Net::HTTPTooManyRequests
      wait = Integer(response["Retry-After"].to_s, 10, exception: false) || 60
      @pause_until = Time.now + wait
      warn "FeatureManager rate limit, next poll in #{wait} s"
    else
      warn "FeatureManager answered #{response.code}, keeping cached flags"
    end
  rescue StandardError => e
    warn "FeatureManager unreachable, keeping cached flags: #{e.message}"
  end

  private

  # One line: "checkout.new-flow: false -> true, added x, removed y".
  def log_changes(old, new)
    changed = new.select { |k, v| old.key?(k) && old[k] != v }
    changes = changed.map { |k, v| "#{k}: #{old[k].to_json} -> #{v.to_json}" } +
              (new.keys - old.keys).map { |k| "added #{k}" } +
              (old.keys - new.keys).map { |k| "removed #{k}" }
    warn "FeatureManager: #{changes.join(', ')}" if changes.any?
  end
end

FLAGS = FeatureFlags.new(ENV.fetch("FEATUREMANAGER_TOKEN")).start
FLAGS.on?("checkout.new-flow")
C# (.NET 10)
// One file: dotnet run flags.cs. In a service, call RefreshAsync from a BackgroundService
// on the same PeriodicTimer, and log with ILogger instead of Console.Error.
using System.Text.Json.Nodes;

var token = Environment.GetEnvironmentVariable("FEATUREMANAGER_TOKEN");
var http = new HttpClient { BaseAddress = new Uri("https://featuremanager.dev/"), Timeout = TimeSpan.FromSeconds(5) };
http.DefaultRequestHeaders.Add("Authorization", $"Bearer {token}");
var cache = new FlagCache(http);
await cache.RefreshAsync();   // at start-up, before the first IsOn
if (cache.IsOn("checkout.new-flow")) { /* new checkout */ }

using var timer = new PeriodicTimer(TimeSpan.FromSeconds(30));   // then refresh every 30 s
while (await timer.WaitForNextTickAsync()) await cache.RefreshAsync();

sealed class FlagCache(HttpClient http)
{
    volatile Dictionary<string, string> flags = [];   // key -> value as JSON ("true")
    string? etag, source;   // source: "system/environment" of the last good answer
    DateTime pauseUntil;    // set by a rate limit

    // Cache only, never calls the API. Unknown keys count as off.
    public bool IsOn(string key) => flags.GetValueOrDefault(key) == "true";

    public async Task RefreshAsync()
    {
        if (DateTime.UtcNow < pauseUntil) return;
        try
        {
            var req = new HttpRequestMessage(HttpMethod.Get, "api/v1/flags");
            if (etag is not null) req.Headers.TryAddWithoutValidation("If-None-Match", etag);
            using var res = await http.SendAsync(req);
            var status = (int)res.StatusCode;
            if (status == 304) return;   // nothing changed: keep the cache
            if (status == 200)
            {
                var answer = JsonNode.Parse(await res.Content.ReadAsStringAsync())!;
                var next = answer["flags"]!.AsArray()
                    .ToDictionary(f => (string)f!["key"]!, f => f!["value"]!.ToJsonString());
                var answered = $"{answer["system"]}/{answer["environment"]}";
                if (source is null) Log($"loaded {next.Count} flags from {answered}");
                else if (answered != source)
                    Log($"WARNING token now reads {answered}, was {source}; replacing all");
                else if (Changes(flags, next) is { Length: > 0 } changes) Log(changes);
                (flags, etag, source) = (next, res.Headers.ETag?.ToString(), answered);
            }
            else if (status == 401) Log("ERROR token expired or revoked; serving cached flags");
            else if (status == 429)
            {
                var wait = res.Headers.RetryAfter?.Delta ?? TimeSpan.FromSeconds(60);
                pauseUntil = DateTime.UtcNow + wait;
                Log($"rate limit, next poll in {wait.TotalSeconds} s");
            }
            else Log($"answered {status}, keeping cached flags");
        }
        catch (Exception e) { Log($"poll failed, keeping cached flags: {e.Message}"); }
    }

    // "checkout.new-flow: false -> true, added x, removed y", or "" when nothing changed.
    static string Changes(Dictionary<string, string> old, Dictionary<string, string> next) =>
        string.Join(", ", next.Where(f => old.TryGetValue(f.Key, out var v) && v != f.Value)
            .Select(f => $"{f.Key}: {old[f.Key]} -> {f.Value}")
            .Concat(next.Keys.Except(old.Keys).Select(k => $"added {k}"))
            .Concat(old.Keys.Except(next.Keys).Select(k => $"removed {k}")));

    static void Log(string message) => Console.Error.WriteLine($"FeatureManager: {message}");
}

Compatibility

  • Within v1, fields may be added to answers. Ignore fields you do not know.
  • Today every feature is on/off, with kind "boolean". String and JSON features will arrive in v1 with a new kind and a value of that type. Check kind before you read value, and skip kinds you do not handle.
  • Removing or renaming a field, or changing what an existing kind means, would be v2.

Get a token

Create your team, add a system, and make a token on any of its environments.

Create your team