Skip to content

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.

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 single feature flag for a given context. This endpoint is public and does not require authentication.

POST https://api.thebridge.dev/cloud-views/flags/evaluate/APP_ID/FLAG_KEY

Path Parameters

ParameterTypeRequiredDescription
APP_IDstringRequiredYour application ID
FLAG_KEYstringRequiredThe unique key of the flag to evaluate

Body Parameters

ParameterTypeRequiredDescription
userobjectOptionalUser context — id, role, name, email, key
tenantobjectOptionalTenant context — id, plan, name, key
deviceobjectOptionalDevice context — key
customobjectOptionalArbitrary key-value pairs for custom targeting rules
accessTokenstringOptionalA JWT access token. Can be sent instead of the context object

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
POST https://api.thebridge.dev/cloud-views/flags/evaluate/:APP_ID/:FLAG_KEY
Your application ID
The unique key of the flag

Evaluate all flags for a given context in a single request. This endpoint is public and does not require authentication.

POST https://api.thebridge.dev/cloud-views/flags/bulkEvaluate/APP_ID

Path Parameters

ParameterTypeRequiredDescription
APP_IDstringRequiredYour application ID

Body Parameters

ParameterTypeRequiredDescription
userobjectOptionalUser context — id, role, name, email, key
tenantobjectOptionalTenant context — id, plan, name, key
deviceobjectOptionalDevice context — key
customobjectOptionalArbitrary key-value pairs for custom targeting rules
accessTokenstringOptionalA JWT access token. Can be sent instead of the context object

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
POST https://api.thebridge.dev/cloud-views/flags/bulkEvaluate/:APP_ID
Your application ID

List all segments configured for your app. Requires the x-api-key header.

GET https://api.thebridge.dev/admin/flags/segment

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
GET https://api.thebridge.dev/admin/flags/segment
Stored in session memory only. Never persisted.

Create a new segment for targeting. Requires the x-api-key header.

POST https://api.thebridge.dev/admin/flags/segment

Body Parameters

ParameterTypeRequiredDescription
keystringRequiredA unique key for this segment
descriptionstringOptionalOptional description of the segment
targetsobject[]OptionalTargeting rules for this segment

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
POST https://api.thebridge.dev/admin/flags/segment
Stored in session memory only. Never persisted.

Update an existing segment. Requires the x-api-key header.

PUT https://api.thebridge.dev/admin/flags/segment/:SEGMENT_ID

Body Parameters

ParameterTypeRequiredDescription
keystringOptionalA unique key for this segment
descriptionstringOptionalUpdated description
targetsobject[]OptionalUpdated targeting rules

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
PUT https://api.thebridge.dev/admin/flags/segment/:SEGMENT_ID
Stored in session memory only. Never persisted.
The ID of the segment

Delete an existing segment. Requires the x-api-key header.

DELETE https://api.thebridge.dev/admin/flags/segment/:SEGMENT_ID

HTTP 200 — Empty body on success.

DELETE Try it out
DELETE https://api.thebridge.dev/admin/flags/segment/:SEGMENT_ID
Stored in session memory only. Never persisted.
The ID of the segment

List all feature flags configured for your app. Requires the x-api-key header.

GET https://api.thebridge.dev/admin/flags/flags

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
GET https://api.thebridge.dev/admin/flags/flags
Stored in session memory only. Never persisted.

Create a new feature flag. Requires the x-api-key header.

POST https://api.thebridge.dev/admin/flags/flag

Body Parameters

ParameterTypeRequiredDescription
keystringRequiredA unique key for this flag
descriptionstringOptionalOptional description of the flag
defaultValuebooleanRequiredThe value returned when no segment matches
segmentsstring[]OptionalList of segment IDs to associate with this flag
targetValuebooleanRequiredThe value returned when a segment matches
enabledbooleanRequiredWhether the flag is active

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
POST https://api.thebridge.dev/admin/flags/flag
Stored in session memory only. Never persisted.

Update an existing feature flag. Requires the x-api-key header.

PUT https://api.thebridge.dev/admin/flags/segment/:FLAG_ID

Body Parameters

ParameterTypeRequiredDescription
keystringOptionalA unique key for this flag
descriptionstringOptionalUpdated description
defaultValuebooleanOptionalThe value returned when no segment matches
segmentsstring[]OptionalUpdated list of segment IDs
targetValuebooleanOptionalThe value returned when a segment matches
enabledbooleanOptionalWhether the flag is active

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
PUT https://api.thebridge.dev/admin/flags/segment/:FLAG_ID
Stored in session memory only. Never persisted.
The ID of the flag

Delete an existing feature flag. Requires the x-api-key header.

DELETE https://api.thebridge.dev/admin/flags/flag/:FLAG_ID

HTTP 200 — Empty body on success.

DELETE Try it out
DELETE https://api.thebridge.dev/admin/flags/flag/:FLAG_ID
Stored in session memory only. Never persisted.
The ID of the flag