Repository navigation
[Flagship] Add structured context support and evaluation API documentation #34390
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
akshitsinha
merged 4 commits into
cloudflare:production
from
madhugb:mbalakrishna/document-json-context
Oct 19, 2026
+255
−50
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
db56f17
[Flagship] Add structured context support and evaluation API document…
madhugb d113f34
[Flagship] Correct structured context docs and add changelog
irvinebroque d503eb5
[Flagship] Retain userId in structured context examples
madhugb 4c3c9bb
[Flagship] Remove note on control-plane POST traversal limit exemption
madhugb File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
29 changes: 29 additions & 0 deletions
29
src/content/changelog/flagship/2026-10-23-structured-evaluation-context.mdx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,29 @@ | ||
| --- | ||
| title: Target Flagship feature flags with structured evaluation context | ||
| description: Use nested objects, arrays, and null in Flagship evaluation context, with dot-path targeting and array membership operators. | ||
| date: 2026-10-23 | ||
| --- | ||
|
|
||
| import { TypeScriptExample } from "~/components"; | ||
|
|
||
| [Flagship](/flagship/) supports nested objects, arrays, and `null` in evaluation context. Pass user profiles and tag lists directly, then target nested attributes without flattening your application data. | ||
|
|
||
| For example, pass a profile and tags when evaluating a flag through the Workers binding: | ||
|
|
||
| <TypeScriptExample> | ||
|
|
||
| ```ts | ||
| const enabled = await env.FLAGS.getBooleanValue("new-checkout", false, { | ||
| targetingKey: "user-42", | ||
| profile: { plan: "enterprise" }, | ||
| tags: ["beta", "early-access"], | ||
| }); | ||
| ``` | ||
|
|
||
| </TypeScriptExample> | ||
|
|
||
| A targeting rule can combine `profile.plan equals "enterprise"` with `tags has "beta"` to serve the feature to enterprise users in the beta group. Use dot-separated paths for nested attributes and the `has` and `not_has` operators for array membership. Percentage rollouts can also use a nested identifier, such as `profile.id`, for consistent user assignment. | ||
|
|
||
| Structured context works through the Workers binding, the evaluation REST API with a JSON `POST` body, and the TypeScript, Python, and Go OpenFeature SDKs from version `0.6.0`. The SDKs automatically use `POST` when HTTP evaluation requires structured context. | ||
|
|
||
| Refer to [targeting rules](/flagship/targeting/), the [evaluation API](/flagship/reference/evaluation-api/), and [SDK context support](/flagship/sdk/#context-support) for usage and supported values. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,10 +1,10 @@ | ||
| --- | ||
| pcx_content_type: navigation | ||
| title: API reference | ||
| description: API endpoints for managing Flagship apps, flags, and targeting rules. | ||
| description: API endpoints for managing and evaluating Flagship apps, flags, and targeting rules. | ||
| products: | ||
| - flagship | ||
| external_link: /api/resources/flagship/ | ||
| sidebar: | ||
| order: 3 | ||
| order: 4 | ||
| --- |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,51 @@ | ||
| --- | ||
| pcx_content_type: reference | ||
| title: Evaluation API | ||
| description: Evaluate flags with scalar query or structured JSON context. | ||
| sidebar: | ||
| order: 3 | ||
| products: | ||
| - flagship | ||
| --- | ||
|
|
||
| import { APIRequest } from "~/components"; | ||
|
|
||
| Use the evaluation API when you cannot use the [Workers binding](/flagship/binding/). The API accepts query parameters or a JSON request body. | ||
|
|
||
| ## Send scalar query context | ||
|
|
||
| The [`GET` endpoint](/api/resources/flagship/subresources/apps/subresources/evaluate/methods/get/) accepts context attributes as query parameters. Use it for scalar context values. | ||
|
|
||
| Flagship coerces unambiguous number and boolean query values. For example, `42` becomes a number and `true` becomes a boolean. Other values remain strings. | ||
|
|
||
| JSON-looking query values remain strings. A value such as `{"plan":"enterprise"}` does not create a nested object. | ||
|
|
||
| ## Send structured JSON context | ||
|
|
||
| Use `POST` to send nested objects, arrays, or `null`. The following request evaluates `new-checkout` with structured context: | ||
|
|
||
| <APIRequest | ||
| path="/accounts/{account_id}/flagship/apps/{app_id}/evaluate" | ||
| method="POST" | ||
| json={{ | ||
| flagKey: "new-checkout", | ||
| context: { | ||
| targetingKey: "user-42", | ||
| profile: { plan: "enterprise" }, | ||
| tags: ["beta"], | ||
| }, | ||
| }} | ||
| /> | ||
|
|
||
| The `POST` response contains the same fields as `GET`: | ||
|
|
||
| ```json | ||
| { | ||
| "flagKey": "new-checkout", | ||
| "value": true, | ||
| "variant": "on", | ||
| "reason": "TARGETING_MATCH" | ||
| } | ||
| ``` | ||
|
|
||
| Invalid context returns a `400` response. Refer to [Limits](/flagship/reference/limits/) and [evaluation error codes](/flagship/reference/evaluation-reasons/#error-codes) for details. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.