Feature Flags
Feature flags let you control the rollout of features in your application without deploying new code. You can target specific users, tenants, devices, or custom properties using segments and evaluation context.
Evaluation endpoints are public and require no authentication — they can be called directly from client-side code. Management endpoints (flags and segments) require your x-api-key header.
Evaluation Context
Section titled “Evaluation Context”All evaluation endpoints accept either a structured context object or a raw accessToken (JWT) in the request body. The context object has the following shape:
{ "user": { "id": "63d2ab029e23f80afb0daf97", "role": "ADMIN", "name": "John Doe", "email": "john@doe.com", "key": "custom" }, "tenant": { "id": "63d2ab029e23f80afb0daf90", "plan": "PREMIUM", "name": "My Workspace", "key": "custom" }, "device": { "key": "iphone" }, "custom": { "property1": "value1" }}All context fields are optional — include only what is relevant for your flag rules.
Evaluate a Flag
Section titled “Evaluate a Flag”Evaluate a single feature flag for a given context. This endpoint is public and does not require authentication.
HTTP Request
Section titled “HTTP Request”POST https://api.thebridge.dev/cloud-views/flags/evaluate/APP_ID/FLAG_KEY
Path Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
APP_ID | string | Required | Your application ID |
FLAG_KEY | string | Required | The unique key of the flag to evaluate |
Body Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
user | object | Optional | User context — id, role, name, email, key |
tenant | object | Optional | Tenant context — id, plan, name, key |
device | object | Optional | Device context — key |
custom | object | Optional | Arbitrary key-value pairs for custom targeting rules |
accessToken | string | Optional | A JWT access token. Can be sent instead of the context object |
Response HTTP 200
Section titled “Response HTTP 200”HTTP 200 — Returns an object with enabled (boolean).
Request example
curl --request POST 'https://api.thebridge.dev/cloud-views/flags/evaluate/APP_ID/FLAG_KEY' \
--header 'Content-Type: application/json' \
--data-raw '{
"user": { "id": "63d2ab029e23f80afb0daf97", "role": "ADMIN" },
"tenant": { "id": "63d2ab029e23f80afb0daf90", "plan": "PREMIUM" },
"device": { "key": "iphone" }
}'Response example:
{ "enabled": true}POST Try it out
https://api.thebridge.dev/cloud-views/flags/evaluate/:APP_ID/:FLAG_KEYEvaluate Flags in Bulk
Section titled “Evaluate Flags in Bulk”Evaluate all flags for a given context in a single request. This endpoint is public and does not require authentication.
HTTP Request
Section titled “HTTP Request”POST https://api.thebridge.dev/cloud-views/flags/bulkEvaluate/APP_ID
Path Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
APP_ID | string | Required | Your application ID |
Body Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
user | object | Optional | User context — id, role, name, email, key |
tenant | object | Optional | Tenant context — id, plan, name, key |
device | object | Optional | Device context — key |
custom | object | Optional | Arbitrary key-value pairs for custom targeting rules |
accessToken | string | Optional | A JWT access token. Can be sent instead of the context object |
Response HTTP 200
Section titled “Response HTTP 200”HTTP 200 — Returns an object with flags array (flag key + evaluation).
Request example
curl --request POST 'https://api.thebridge.dev/cloud-views/flags/bulkEvaluate/APP_ID' \
--header 'Content-Type: application/json' \
--data-raw '{
"user": { "id": "63d2ab029e23f80afb0daf97", "role": "ADMIN" },
"tenant": { "id": "63d2ab029e23f80afb0daf90", "plan": "PREMIUM" },
"device": { "key": "iphone" }
}'Response example:
{ "flags": [ { "flag": "iphone-feature", "evaluation": { "enabled": true } } ]}POST Try it out
https://api.thebridge.dev/cloud-views/flags/bulkEvaluate/:APP_IDList Segments
Section titled “List Segments”List all segments configured for your app. Requires the x-api-key header.
HTTP Request
Section titled “HTTP Request”GET https://api.thebridge.dev/admin/flags/segment
Response HTTP 200
Section titled “Response HTTP 200”HTTP 200 — Returns an array of segment objects.
Request example
curl --request GET 'https://api.thebridge.dev/admin/flags/segment' \
--header 'x-api-key: YOUR_APP_API_KEY'Response example:
[ { "id": "650cd8510ccba777cc9623e0", "key": "premium-users", "description": "Users on the premium plan", "targets": [] }]GET Try it out
https://api.thebridge.dev/admin/flags/segmentCreate a Segment
Section titled “Create a Segment”Create a new segment for targeting. Requires the x-api-key header.
HTTP Request
Section titled “HTTP Request”POST https://api.thebridge.dev/admin/flags/segment
Body Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
key | string | Required | A unique key for this segment |
description | string | Optional | Optional description of the segment |
targets | object[] | Optional | Targeting rules for this segment |
Response HTTP 200
Section titled “Response HTTP 200”HTTP 200 — Returns the created segment object.
Request example
curl --request POST 'https://api.thebridge.dev/admin/flags/segment' \
--header 'x-api-key: YOUR_APP_API_KEY' \
--header 'Content-Type: application/json' \
--data-raw '{
"key": "premium-users",
"description": "Users on the premium plan",
"targets": []
}'Response example:
{ "id": "650cd8510ccba777cc9623e0", "key": "premium-users", "description": "Users on the premium plan", "targets": []}POST Try it out
https://api.thebridge.dev/admin/flags/segmentUpdate a Segment
Section titled “Update a Segment”Update an existing segment. Requires the x-api-key header.
HTTP Request
Section titled “HTTP Request”PUT https://api.thebridge.dev/admin/flags/segment/:SEGMENT_ID
Body Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
key | string | Optional | A unique key for this segment |
description | string | Optional | Updated description |
targets | object[] | Optional | Updated targeting rules |
Response HTTP 200
Section titled “Response HTTP 200”HTTP 200 — Returns the updated segment.
Request example
curl --request PUT 'https://api.thebridge.dev/admin/flags/segment/SEGMENT_ID' \
--header 'x-api-key: YOUR_APP_API_KEY' \
--header 'Content-Type: application/json' \
--data-raw '{
"description": "Updated segment description"
}'PUT Try it out
https://api.thebridge.dev/admin/flags/segment/:SEGMENT_IDDelete a Segment
Section titled “Delete a Segment”Delete an existing segment. Requires the x-api-key header.
HTTP Request
Section titled “HTTP Request”DELETE https://api.thebridge.dev/admin/flags/segment/:SEGMENT_ID
Response HTTP 200
Section titled “Response HTTP 200”HTTP 200 — Empty body on success.
DELETE Try it out
https://api.thebridge.dev/admin/flags/segment/:SEGMENT_IDList Flags
Section titled “List Flags”List all feature flags configured for your app. Requires the x-api-key header.
HTTP Request
Section titled “HTTP Request”GET https://api.thebridge.dev/admin/flags/flags
Response HTTP 200
Section titled “Response HTTP 200”HTTP 200 — Returns an array of flag objects.
Request example
curl --request GET 'https://api.thebridge.dev/admin/flags/flags' \
--header 'x-api-key: YOUR_APP_API_KEY'Response example:
[ { "id": "650cd8510ccba777cc9623f0", "key": "iphone-feature", "description": "Feature available only on iPhones", "defaultValue": false, "segments": [], "targetValue": true, "enabled": true }]GET Try it out
https://api.thebridge.dev/admin/flags/flagsCreate a Flag
Section titled “Create a Flag”Create a new feature flag. Requires the x-api-key header.
HTTP Request
Section titled “HTTP Request”POST https://api.thebridge.dev/admin/flags/flag
Body Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
key | string | Required | A unique key for this flag |
description | string | Optional | Optional description of the flag |
defaultValue | boolean | Required | The value returned when no segment matches |
segments | string[] | Optional | List of segment IDs to associate with this flag |
targetValue | boolean | Required | The value returned when a segment matches |
enabled | boolean | Required | Whether the flag is active |
Response HTTP 200
Section titled “Response HTTP 200”HTTP 200 — Returns the created flag object.
Request example
curl --request POST 'https://api.thebridge.dev/admin/flags/flag' \
--header 'x-api-key: YOUR_APP_API_KEY' \
--header 'Content-Type: application/json' \
--data-raw '{
"key": "iphone-feature",
"description": "Feature available only on iPhones",
"defaultValue": false,
"segments": [],
"targetValue": true,
"enabled": true
}'Response example:
{ "id": "650cd8510ccba777cc9623f0", "key": "iphone-feature", "description": "Feature available only on iPhones", "defaultValue": false, "segments": [], "targetValue": true, "enabled": true}POST Try it out
https://api.thebridge.dev/admin/flags/flagUpdate a Flag
Section titled “Update a Flag”Update an existing feature flag. Requires the x-api-key header.
HTTP Request
Section titled “HTTP Request”PUT https://api.thebridge.dev/admin/flags/segment/:FLAG_ID
Body Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
key | string | Optional | A unique key for this flag |
description | string | Optional | Updated description |
defaultValue | boolean | Optional | The value returned when no segment matches |
segments | string[] | Optional | Updated list of segment IDs |
targetValue | boolean | Optional | The value returned when a segment matches |
enabled | boolean | Optional | Whether the flag is active |
Response HTTP 200
Section titled “Response HTTP 200”HTTP 200 — Returns the updated flag.
Request example
curl --request PUT 'https://api.thebridge.dev/admin/flags/segment/FLAG_ID' \
--header 'x-api-key: YOUR_APP_API_KEY' \
--header 'Content-Type: application/json' \
--data-raw '{
"description": "Updated flag description",
"enabled": false
}'PUT Try it out
https://api.thebridge.dev/admin/flags/segment/:FLAG_IDDelete a Flag
Section titled “Delete a Flag”Delete an existing feature flag. Requires the x-api-key header.
HTTP Request
Section titled “HTTP Request”DELETE https://api.thebridge.dev/admin/flags/flag/:FLAG_ID
Response HTTP 200
Section titled “Response HTTP 200”HTTP 200 — Empty body on success.
DELETE Try it out
https://api.thebridge.dev/admin/flags/flag/:FLAG_ID