Evaluation
Evaluate flags with public /v1 routes, server runtime keys, and browser client keys.
Evaluation routes are public API routes for customer applications. Snapshot routes require FeatureGate-issued server runtime keys. POST /v1/evaluate accepts either a server runtime key or a publishable browser client key.
Use this page for integration guidance and exact generated request and response details. The standalone reference pages are still available for deep links: POST /v1/evaluate, GET /v1/snapshot, and GET /v1/snapshot/stream.
Authentication
Send the key as a bearer token. Server runtime keys are scoped to a single environment and carry only the runtime scopes you grant them: runtime:snapshot and/or runtime:evaluate.
Browser client keys can use only client:evaluate. They must be called from an allowed Origin and can evaluate only flags explicitly exposed to clients in that environment.
Use server runtime keys for backend applications and the server TypeScript SDK. Use publishable
client keys only from browser code. Client keys are not accepted by /v1/snapshot or
/v1/snapshot/stream, and they never expose targeting rules or full environment snapshots.
Evaluate
POST /v1/evaluate resolves one or more flags for a given context in a single round trip. Use it from servers when you do not want to hold a local snapshot, or through the browser and React SDKs when you need client-side checks for exposed flags.
curl https://api.featuregate.dev/v1/evaluate \
-H "Authorization: Bearer fg_sk_test_0123456789abcdef0123456789abcdef0123456789abcdef" \
-H "Content-Type: application/json" \
-d '{
"evaluations": [
{ "key": "new-checkout", "defaultValue": false }
],
"context": {
"user": { "id": "user_123" },
"account": { "plan": "pro" }
}
}'Body parameters
Simple flag-key batch. Send either flags or evaluations, not both.
Items: 1-100
Flag-key batch with per-flag fallbacks. Send either evaluations or flags, not both.
Items: 1-100
Flag key to evaluate.
Length: 1-128
Typed fallback returned when the flag is missing or archived.
Targeting context. FeatureGate never stores raw context from evaluation requests.
curl -X POST https://api.featuregate.dev/v1/evaluate \
-H "Authorization: Bearer fg_sk_test_0123456789abcdef0123456789abcdef0123456789abcdef" \
-H "Content-Type: application/json" \
-d '{
"evaluations": [
{
"key": "new-checkout",
"defaultValue": false
}
],
"context": {
"user": {
"id": "user_123"
},
"account": {
"plan": "pro"
}
}
}'Returns
Project bound to the runtime key.
Length: 1+
Environment bound to the runtime key.
{
"evaluation": {
"projectId": "project_example",
"environment": {
"id": "env_example",
"key": "production",
"name": "Production"
},
"results": [
{
"key": "new-checkout",
"type": "boolean",
"value": true,
"reason": "targeting_match"
}
]
}
}Responses
When called with a browser client key, the request must include an Origin that exactly matches the
key's allowed-origin list. Unexposed flags behave like missing flags and return the caller-provided
default.
Snapshot and ETags
Use GET /v1/snapshot for local evaluation. Snapshot responses include an ETag and support If-None-Match, so unchanged snapshots collapse to a cheap 304.
/v1/snapshot/stream is an optional invalidation channel, not the source of truth. The SDK still reconciles against the snapshot endpoint.
This endpoint takes no parameters.
curl -X GET https://api.featuregate.dev/v1/snapshot \
-H "Authorization: Bearer fg_sk_test_0123456789abcdef0123456789abcdef0123456789abcdef"Returns
Opaque snapshot version used to build ETags.
Length: 1+
Project bound to the runtime key.
Length: 1+
Environment bound to the runtime key.
{
"snapshot": {
"version": "snapshot_version_example",
"projectId": "project_example",
"environment": {
"id": "env_example",
"key": "production",
"name": "Production"
},
"flags": []
}
}Responses
This endpoint takes no parameters.
curl -X GET https://api.featuregate.dev/v1/snapshot/stream \
-H "Authorization: Bearer fg_sk_test_0123456789abcdef0123456789abcdef0123456789abcdef"Returns
Stable environment identifier, prefixed with env_.
Length: 1+
URL-safe environment key such as production or staging.
Length: 1+
Human-readable environment name.
Length: 1+
Event generation timestamp.
Project whose snapshot changed.
Length: 1+
Snapshot version after the change.
Length: 1+
{
"projectId": "project_example",
"version": "snapshot_version_example",
"generatedAt": "2026-06-18T00:00:00.000Z",
"environment": {
"id": "env_example",
"key": "production",
"name": "Production"
}
}Responses