Skip to content
Start here

Evaluate flag

GET/accounts/{account_id}/flagship/apps/{app_id}/evaluate

Evaluates a flag against the provided context. Pass context attributes as query parameters; boolean and numeric strings are coerced automatically. For low-latency in-Worker evaluation, prefer the Flagship binding over this endpoint.

Security
API Token

The preferred authorization scheme for interacting with the Cloudflare API. Create a token.

Example:Authorization: Bearer Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY
API Email + API Key

The previous authorization scheme for interacting with the Cloudflare API, used in conjunction with a Global API key.

Example:X-Auth-Email: user@example.com

The previous authorization scheme for interacting with the Cloudflare API. When possible, use API tokens instead of Global API keys.

Example:X-Auth-Key: 144c9defac04969c7bfad8efaa8ea194
Accepted Permissions (at least one required)
Flagship Evaluate
Path ParametersExpand Collapse
account_id: string

Cloudflare account ID.

app_id: string

App identifier.

Query ParametersExpand Collapse
flagKey: string

The flag key to evaluate.

targetingKey: optional string

Context targeting key (per OpenFeature spec); used for percentage rollout bucketing.

ReturnsExpand Collapse
flagKey: string
reason: "TARGETING_MATCH" or "DEFAULT" or "DISABLED" or "SPLIT"
One of the following:
"TARGETING_MATCH"
"DEFAULT"
"DISABLED"
"SPLIT"
variant: string
value: optional string or number or boolean or 2 more
One of the following:
string
number
boolean
map[unknown]
array of unknown

Evaluate flag

curl https://api.cloudflare.com/client/v4/accounts/$ACCOUNT_ID/flagship/apps/$APP_ID/evaluate \
    -H "Authorization: Bearer $CLOUDFLARE_API_TOKEN"
{
  "flagKey": "flagKey",
  "reason": "TARGETING_MATCH",
  "variant": "variant",
  "value": "string"
}
Returns Examples
{
  "flagKey": "flagKey",
  "reason": "TARGETING_MATCH",
  "variant": "variant",
  "value": "string"
}