Quickstart
This guide takes you from zero to evaluating your first feature flag in your own code. It should take about five minutes.
1. Create a flag
- Open Flags in the sidebar and click New flag.
- Give it a name — for example
New checkout. RestFlags turns this into a key automatically (new-checkout). The key is the immutable identifier you use in code and the API. - Choose a kind. For an on/off switch, pick Boolean.
- (Optional) add a description or tags.
- Click Create.
Your flag now exists in all three environments, switched off.
2. Turn it on
- Click the flag to open its detail page.
- Make sure the environment switcher in the top bar is set to Development.
- Flip the enabled toggle on.
With no targeting rules, an enabled boolean flag serves its true variation to
everyone in that environment.
3. Create an API key
Your application authenticates to RestFlags with an API key.
- Open API keys in the sidebar and click Create new key.
- Name it (e.g.
Local dev), choose the Development environment and the Read only scope. - Click Create. The full token is shown once — copy it now. It looks
like
rf_test_xxxxxxxxxxxx.
4. Evaluate the flag from your code
Send a POST request to /api/v1/flags with the flag key and a user context:
curl https://api.restflags.com/api/v1/flags \
-H "Authorization: Bearer rf_test_xxxxxxxxxxxx" \
-H "Content-Type: application/json" \
-d '{
"flag": "new-checkout",
"environment": "development",
"user": { "id": "user-123" }
}'The response tells you the value and why:
{ "value": true, "variant": "on", "reason": "fallthrough" }Use that value in your application:
const res = await fetch("https://api.restflags.com/api/v1/flags", {
method: "POST",
headers: {
Authorization: `Bearer ${process.env.RESTFLAGS_KEY}`,
"Content-Type": "application/json",
},
body: JSON.stringify({
flag: "new-checkout",
user: { id: currentUser.id },
}),
});
const { value } = await res.json();
if (value) {
renderNewCheckout();
} else {
renderOldCheckout();
}5. Roll it out gradually
Back on the flag's detail page you can now:
- Set a rollout percentage to serve
trueto, say, 10% of users. - Add a targeting rule to serve
trueonly to a specific audience. - Promote the same configuration to Staging and Production.
Next steps
- Learn every flag capability in Feature flags.
- Read the integration guide in API & SDK.
- Browse every endpoint in the v1 API reference.