Skip to content

Getting Started

EdgeFlags is a feature flag and configuration service built on Cloudflare Workers. It delivers sub-millisecond flag evaluation at 300+ edge locations worldwide.

This guide walks you through authenticating, creating a flag, and evaluating it — all from the command line.

Core concepts

Before diving into the API, here’s a quick overview of the three main primitives.

Flags

Feature switches evaluated per-user. Flags support targeting rules (match users by properties or segment membership), percentage rollouts, environment overrides, and scheduling.

Evaluation priority: disabled → schedule → environment override → explicit value → targeting rules → rollout → default.

Configs

Static key-value JSON blobs — think API rate limits, payment settings, or UI defaults. Configs return the same value for every user with no targeting or rollout logic. They support per-environment overrides.

Segments

Reusable user groups defined by conditions, for example email ends_with @company.com AND plan in [pro, enterprise]. Flag targeting rules reference segments so you don’t repeat the same conditions across flags. Segments can also reference other segments and are environment-agnostic.

How they relate

Flags reference segments in their targeting rules. Configs are independent — they have no relationship to flags or segments. Segments can reference other segments recursively.

Authenticate

All API requests require a Bearer token. If you have an EdgeFlags account, generate a token from the admin dashboard. For the examples below, replace YOUR_TOKEN with your actual token.

Terminal window
export EDGEFLAGS_TOKEN="YOUR_TOKEN"

Create a feature flag

Terminal window
curl -X POST https://edgeflags.net/api/v1/flags \
-H "Authorization: Bearer $EDGEFLAGS_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"key": "dark_mode",
"name": "Dark Mode",
"type": "boolean",
"defaultValue": false,
"enabled": true
}'

Evaluate a flag

Pass user context as a query parameter to get a personalized evaluation:

Terminal window
curl https://edgeflags.net/api/v1/flags/dark_mode \
-H "Authorization: Bearer $EDGEFLAGS_TOKEN"

Response:

{
"key": "dark_mode",
"value": false,
"type": "boolean",
"reason": "default"
}

Bulk evaluation

Evaluate multiple flags and configs in a single request:

Terminal window
curl -X POST https://edgeflags.net/api/v1/evaluate \
-H "Authorization: Bearer $EDGEFLAGS_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"flags": ["dark_mode"],
"context": {
"userId": "user_123",
"plan": "premium"
}
}'

Next steps