# Flagship # Apps ## List apps `client.flagship.apps.list(AppListParamsparams, RequestOptionsoptions?): SinglePage` **get** `/accounts/{account_id}/flagship/apps` Lists all apps in the account. Returns identity and audit fields only — flag definitions are not included. ### Parameters - `params: AppListParams` - `account_id: string` Cloudflare account ID. ### Returns - `AppListResponse` - `id: string` - `created_at: string` - `name: string` - `updated_at: string` - `updated_by: string` Email of the actor who last modified the app, or `edge-gateway` for gateway-authenticated changes. ### Example ```node import Cloudflare from 'cloudflare'; const client = new Cloudflare({ apiToken: process.env['CLOUDFLARE_API_TOKEN'], // This is the default and can be omitted }); // Automatically fetches more pages as needed. for await (const appListResponse of client.flagship.apps.list({ account_id: 'account_id' })) { console.log(appListResponse.id); } ``` #### Response ```json { "errors": [ { "message": "message" } ], "messages": [ { "message": "message" } ], "result": [ { "id": "id", "created_at": "created_at", "name": "name", "updated_at": "updated_at", "updated_by": "updated_by" } ], "success": true } ``` ## Get app `client.flagship.apps.get(stringappId, AppGetParamsparams, RequestOptionsoptions?): AppGetResponse` **get** `/accounts/{account_id}/flagship/apps/{app_id}` Returns an app's name and audit fields. Flag definitions are not included. ### Parameters - `appId: string` App identifier. - `params: AppGetParams` - `account_id: string` Cloudflare account ID. ### Returns - `AppGetResponse` - `id: string` - `created_at: string` - `name: string` - `updated_at: string` - `updated_by: string` Email of the actor who last modified the app, or `edge-gateway` for gateway-authenticated changes. ### Example ```node import Cloudflare from 'cloudflare'; const client = new Cloudflare({ apiToken: process.env['CLOUDFLARE_API_TOKEN'], // This is the default and can be omitted }); const app = await client.flagship.apps.get('app_id', { account_id: 'account_id' }); console.log(app.id); ``` #### Response ```json { "errors": [ { "message": "message" } ], "messages": [ { "message": "message" } ], "result": { "id": "id", "created_at": "created_at", "name": "name", "updated_at": "updated_at", "updated_by": "updated_by" }, "success": true } ``` ## Create app `client.flagship.apps.create(AppCreateParamsparams, RequestOptionsoptions?): AppCreateResponse` **post** `/accounts/{account_id}/flagship/apps` Creates an app. The returned `id` is used in all subsequent flag, changelog, and evaluation requests. ### Parameters - `params: AppCreateParams` - `account_id: string` Path param: Cloudflare account ID. - `name: string` Body param ### Returns - `AppCreateResponse` - `id: string` - `created_at: string` - `name: string` - `updated_at: string` - `updated_by: string` Email of the actor who last modified the app, or `edge-gateway` for gateway-authenticated changes. ### Example ```node import Cloudflare from 'cloudflare'; const client = new Cloudflare({ apiToken: process.env['CLOUDFLARE_API_TOKEN'], // This is the default and can be omitted }); const app = await client.flagship.apps.create({ account_id: 'account_id', name: 'x' }); console.log(app.id); ``` #### Response ```json { "errors": [ { "message": "message" } ], "messages": [ { "message": "message" } ], "result": { "id": "id", "created_at": "created_at", "name": "name", "updated_at": "updated_at", "updated_by": "updated_by" }, "success": true } ``` ## Update app `client.flagship.apps.update(stringappId, AppUpdateParamsparams, RequestOptionsoptions?): AppUpdateResponse` **put** `/accounts/{account_id}/flagship/apps/{app_id}` Updates an app. Only `name` is mutable. ### Parameters - `appId: string` App identifier. - `params: AppUpdateParams` - `account_id: string` Path param: Cloudflare account ID. - `name?: string` Body param ### Returns - `AppUpdateResponse` - `id: string` - `created_at: string` - `name: string` - `updated_at: string` - `updated_by: string` Email of the actor who last modified the app, or `edge-gateway` for gateway-authenticated changes. ### Example ```node import Cloudflare from 'cloudflare'; const client = new Cloudflare({ apiToken: process.env['CLOUDFLARE_API_TOKEN'], // This is the default and can be omitted }); const app = await client.flagship.apps.update('app_id', { account_id: 'account_id' }); console.log(app.id); ``` #### Response ```json { "errors": [ { "message": "message" } ], "messages": [ { "message": "message" } ], "result": { "id": "id", "created_at": "created_at", "name": "name", "updated_at": "updated_at", "updated_by": "updated_by" }, "success": true } ``` ## Delete app `client.flagship.apps.delete(stringappId, AppDeleteParamsparams, RequestOptionsoptions?): AppDeleteResponse` **delete** `/accounts/{account_id}/flagship/apps/{app_id}` Deletes an app and all its flags and changelog history. Returns 409 if any Worker still references this app via a Flagship binding. ### Parameters - `appId: string` App identifier. - `params: AppDeleteParams` - `account_id: string` Cloudflare account ID. ### Returns - `AppDeleteResponse` - `id: string` ### Example ```node import Cloudflare from 'cloudflare'; const client = new Cloudflare({ apiToken: process.env['CLOUDFLARE_API_TOKEN'], // This is the default and can be omitted }); const app = await client.flagship.apps.delete('app_id', { account_id: 'account_id' }); console.log(app.id); ``` #### Response ```json { "errors": [ { "message": "message" } ], "messages": [ { "message": "message" } ], "result": { "id": "id" }, "success": true } ``` ## Domain Types ### App List Response - `AppListResponse` - `id: string` - `created_at: string` - `name: string` - `updated_at: string` - `updated_by: string` Email of the actor who last modified the app, or `edge-gateway` for gateway-authenticated changes. ### App Get Response - `AppGetResponse` - `id: string` - `created_at: string` - `name: string` - `updated_at: string` - `updated_by: string` Email of the actor who last modified the app, or `edge-gateway` for gateway-authenticated changes. ### App Create Response - `AppCreateResponse` - `id: string` - `created_at: string` - `name: string` - `updated_at: string` - `updated_by: string` Email of the actor who last modified the app, or `edge-gateway` for gateway-authenticated changes. ### App Update Response - `AppUpdateResponse` - `id: string` - `created_at: string` - `name: string` - `updated_at: string` - `updated_by: string` Email of the actor who last modified the app, or `edge-gateway` for gateway-authenticated changes. ### App Delete Response - `AppDeleteResponse` - `id: string` # Flags ## List flags `client.flagship.apps.flags.list(stringappId, FlagListParamsparams, RequestOptionsoptions?): CursorPaginationAfter` **get** `/accounts/{account_id}/flagship/apps/{app_id}/flags` Lists an app's flags ordered by key. Pass `cursor` from `result_info` to page forward; a null cursor indicates the last page. ### Parameters - `appId: string` App identifier. - `params: FlagListParams` - `account_id: string` Path param: Cloudflare account ID. - `cursor?: string` Query param: Pagination cursor from a previous response. - `limit?: string` Query param: Max items to return (1–200). ### Returns - `FlagListResponse` - `default_variation: string` Variation served when no rule matches or the flag is disabled. Must be a key in `variations`. - `enabled: boolean` When false, the flag bypasses all rules and always serves `default_variation`. - `key: string` Unique identifier for the flag within an app. Used in all evaluation and SDK calls. - `rules: Array` Targeting rules evaluated in ascending `priority`; the first matching rule wins. An empty array means the flag always serves `default_variation`. - `conditions: Array` Conditions the context must satisfy for this rule to match. An empty array matches all contexts. - `UnionMember0` - `attribute: string` - `operator: "equals" | "not_equals" | "greater_than" | 8 more` - `"equals"` - `"not_equals"` - `"greater_than"` - `"less_than"` - `"greater_than_or_equals"` - `"less_than_or_equals"` - `"contains"` - `"starts_with"` - `"ends_with"` - `"in"` - `"not_in"` - `value: unknown` Value to compare against the context attribute. Must be an array for `in` and `not_in`; numeric and ISO-8601 datetime strings are accepted by the ordering operators. - `UnionMember1` - `clauses: Array` - `UnionMember0` - `attribute: string` - `operator: "equals" | "not_equals" | "greater_than" | 8 more` - `"equals"` - `"not_equals"` - `"greater_than"` - `"less_than"` - `"greater_than_or_equals"` - `"less_than_or_equals"` - `"contains"` - `"starts_with"` - `"ends_with"` - `"in"` - `"not_in"` - `value: unknown` Value to compare against the context attribute. Must be an array for `in` and `not_in`; numeric and ISO-8601 datetime strings are accepted by the ordering operators. - `UnionMember1` - `clauses: Array` - `UnionMember0` - `attribute: string` - `operator: "equals" | "not_equals" | "greater_than" | 8 more` - `"equals"` - `"not_equals"` - `"greater_than"` - `"less_than"` - `"greater_than_or_equals"` - `"less_than_or_equals"` - `"contains"` - `"starts_with"` - `"ends_with"` - `"in"` - `"not_in"` - `value: unknown` Value to compare against the context attribute. Must be an array for `in` and `not_in`; numeric and ISO-8601 datetime strings are accepted by the ordering operators. - `UnionMember1` - `clauses: Array` - `UnionMember0` - `attribute: string` - `operator: "equals" | "not_equals" | "greater_than" | 8 more` - `"equals"` - `"not_equals"` - `"greater_than"` - `"less_than"` - `"greater_than_or_equals"` - `"less_than_or_equals"` - `"contains"` - `"starts_with"` - `"ends_with"` - `"in"` - `"not_in"` - `value: unknown` Value to compare against the context attribute. Must be an array for `in` and `not_in`; numeric and ISO-8601 datetime strings are accepted by the ordering operators. - `UnionMember1` - `clauses: Array` - `UnionMember0` - `attribute: string` - `operator: "equals" | "not_equals" | "greater_than" | 8 more` - `"equals"` - `"not_equals"` - `"greater_than"` - `"less_than"` - `"greater_than_or_equals"` - `"less_than_or_equals"` - `"contains"` - `"starts_with"` - `"ends_with"` - `"in"` - `"not_in"` - `value: unknown` Value to compare against the context attribute. Must be an array for `in` and `not_in`; numeric and ISO-8601 datetime strings are accepted by the ordering operators. - `UnionMember1` - `clauses: Array` - `UnionMember0` - `attribute: string` - `operator: "equals" | "not_equals" | "greater_than" | 8 more` - `"equals"` - `"not_equals"` - `"greater_than"` - `"less_than"` - `"greater_than_or_equals"` - `"less_than_or_equals"` - `"contains"` - `"starts_with"` - `"ends_with"` - `"in"` - `"not_in"` - `value: unknown` Value to compare against the context attribute. Must be an array for `in` and `not_in`; numeric and ISO-8601 datetime strings are accepted by the ordering operators. - `UnionMember1` - `clauses: Array` - `string | null` - `number` - `boolean` - `Record` - `Array` - `logical_operator: "AND" | "OR"` - `"AND"` - `"OR"` - `logical_operator: "AND" | "OR"` - `"AND"` - `"OR"` - `logical_operator: "AND" | "OR"` - `"AND"` - `"OR"` - `logical_operator: "AND" | "OR"` - `"AND"` - `"OR"` - `logical_operator: "AND" | "OR"` - `"AND"` - `"OR"` - `logical_operator: "AND" | "OR"` - `"AND"` - `"OR"` - `priority: number` Evaluation order; lower numbers are evaluated first. Must be unique across the flag's rules. - `serve_variation: string` Variation served when this rule matches. Must be a key in `variations`. - `rollout?: Rollout` - `percentage: number` Percentage of matching traffic (0–100) served this variation. For multi-way splits, use cumulative upper bounds across rules (e.g. 30, 70, 100). - `attribute?: string` Context attribute used for sticky bucketing. Defaults to `targetingKey`. If absent at evaluation time, bucketing is random per request. - `variations: Record` Map of variation name to value. All values must be the same type (boolean, string, number, or JSON object/array). Each serialized value must be 10KB or smaller. - `string | null` - `number` - `boolean` - `Record` - `Array` - `description?: string | null` - `type?: "boolean" | "string" | "number" | "json"` Value type of the flag's variations. Inferred from the variation values on write, so it may be omitted in requests. - `"boolean"` - `"string"` - `"number"` - `"json"` - `updated_at?: string` - `updated_by?: string` ### Example ```node import Cloudflare from 'cloudflare'; const client = new Cloudflare({ apiToken: process.env['CLOUDFLARE_API_TOKEN'], // This is the default and can be omitted }); // Automatically fetches more pages as needed. for await (const flagListResponse of client.flagship.apps.flags.list('app_id', { account_id: 'account_id', })) { console.log(flagListResponse.default_variation); } ``` #### Response ```json { "errors": [ { "message": "message" } ], "messages": [ { "message": "message" } ], "result": [ { "default_variation": "x", "enabled": true, "key": "x", "rules": [ { "conditions": [ { "attribute": "x", "operator": "equals", "value": {} } ], "priority": 1, "serve_variation": "x", "rollout": { "percentage": 0, "attribute": "x" } } ], "variations": { "foo": "string" }, "description": "description", "type": "boolean", "updated_at": "updated_at", "updated_by": "updated_by" } ], "result_info": { "count": 0, "cursor": "cursor" }, "success": true } ``` ## Get flag `client.flagship.apps.flags.get(stringappId, stringflagKey, FlagGetParamsparams, RequestOptionsoptions?): FlagGetResponse` **get** `/accounts/{account_id}/flagship/apps/{app_id}/flags/{flag_key}` Returns the full flag definition including rules, variations, and audit fields. ### Parameters - `appId: string` App identifier. - `flagKey: string` Flag key (slug). - `params: FlagGetParams` - `account_id: string` Cloudflare account ID. ### Returns - `FlagGetResponse` - `default_variation: string` Variation served when no rule matches or the flag is disabled. Must be a key in `variations`. - `enabled: boolean` When false, the flag bypasses all rules and always serves `default_variation`. - `key: string` Unique identifier for the flag within an app. Used in all evaluation and SDK calls. - `rules: Array` Targeting rules evaluated in ascending `priority`; the first matching rule wins. An empty array means the flag always serves `default_variation`. - `conditions: Array` Conditions the context must satisfy for this rule to match. An empty array matches all contexts. - `UnionMember0` - `attribute: string` - `operator: "equals" | "not_equals" | "greater_than" | 8 more` - `"equals"` - `"not_equals"` - `"greater_than"` - `"less_than"` - `"greater_than_or_equals"` - `"less_than_or_equals"` - `"contains"` - `"starts_with"` - `"ends_with"` - `"in"` - `"not_in"` - `value: unknown` Value to compare against the context attribute. Must be an array for `in` and `not_in`; numeric and ISO-8601 datetime strings are accepted by the ordering operators. - `UnionMember1` - `clauses: Array` - `UnionMember0` - `attribute: string` - `operator: "equals" | "not_equals" | "greater_than" | 8 more` - `"equals"` - `"not_equals"` - `"greater_than"` - `"less_than"` - `"greater_than_or_equals"` - `"less_than_or_equals"` - `"contains"` - `"starts_with"` - `"ends_with"` - `"in"` - `"not_in"` - `value: unknown` Value to compare against the context attribute. Must be an array for `in` and `not_in`; numeric and ISO-8601 datetime strings are accepted by the ordering operators. - `UnionMember1` - `clauses: Array` - `UnionMember0` - `attribute: string` - `operator: "equals" | "not_equals" | "greater_than" | 8 more` - `"equals"` - `"not_equals"` - `"greater_than"` - `"less_than"` - `"greater_than_or_equals"` - `"less_than_or_equals"` - `"contains"` - `"starts_with"` - `"ends_with"` - `"in"` - `"not_in"` - `value: unknown` Value to compare against the context attribute. Must be an array for `in` and `not_in`; numeric and ISO-8601 datetime strings are accepted by the ordering operators. - `UnionMember1` - `clauses: Array` - `UnionMember0` - `attribute: string` - `operator: "equals" | "not_equals" | "greater_than" | 8 more` - `"equals"` - `"not_equals"` - `"greater_than"` - `"less_than"` - `"greater_than_or_equals"` - `"less_than_or_equals"` - `"contains"` - `"starts_with"` - `"ends_with"` - `"in"` - `"not_in"` - `value: unknown` Value to compare against the context attribute. Must be an array for `in` and `not_in`; numeric and ISO-8601 datetime strings are accepted by the ordering operators. - `UnionMember1` - `clauses: Array` - `UnionMember0` - `attribute: string` - `operator: "equals" | "not_equals" | "greater_than" | 8 more` - `"equals"` - `"not_equals"` - `"greater_than"` - `"less_than"` - `"greater_than_or_equals"` - `"less_than_or_equals"` - `"contains"` - `"starts_with"` - `"ends_with"` - `"in"` - `"not_in"` - `value: unknown` Value to compare against the context attribute. Must be an array for `in` and `not_in`; numeric and ISO-8601 datetime strings are accepted by the ordering operators. - `UnionMember1` - `clauses: Array` - `UnionMember0` - `attribute: string` - `operator: "equals" | "not_equals" | "greater_than" | 8 more` - `"equals"` - `"not_equals"` - `"greater_than"` - `"less_than"` - `"greater_than_or_equals"` - `"less_than_or_equals"` - `"contains"` - `"starts_with"` - `"ends_with"` - `"in"` - `"not_in"` - `value: unknown` Value to compare against the context attribute. Must be an array for `in` and `not_in`; numeric and ISO-8601 datetime strings are accepted by the ordering operators. - `UnionMember1` - `clauses: Array` - `string | null` - `number` - `boolean` - `Record` - `Array` - `logical_operator: "AND" | "OR"` - `"AND"` - `"OR"` - `logical_operator: "AND" | "OR"` - `"AND"` - `"OR"` - `logical_operator: "AND" | "OR"` - `"AND"` - `"OR"` - `logical_operator: "AND" | "OR"` - `"AND"` - `"OR"` - `logical_operator: "AND" | "OR"` - `"AND"` - `"OR"` - `logical_operator: "AND" | "OR"` - `"AND"` - `"OR"` - `priority: number` Evaluation order; lower numbers are evaluated first. Must be unique across the flag's rules. - `serve_variation: string` Variation served when this rule matches. Must be a key in `variations`. - `rollout?: Rollout` - `percentage: number` Percentage of matching traffic (0–100) served this variation. For multi-way splits, use cumulative upper bounds across rules (e.g. 30, 70, 100). - `attribute?: string` Context attribute used for sticky bucketing. Defaults to `targetingKey`. If absent at evaluation time, bucketing is random per request. - `variations: Record` Map of variation name to value. All values must be the same type (boolean, string, number, or JSON object/array). Each serialized value must be 10KB or smaller. - `string | null` - `number` - `boolean` - `Record` - `Array` - `description?: string | null` - `type?: "boolean" | "string" | "number" | "json"` Value type of the flag's variations. Inferred from the variation values on write, so it may be omitted in requests. - `"boolean"` - `"string"` - `"number"` - `"json"` - `updated_at?: string` - `updated_by?: string` ### Example ```node import Cloudflare from 'cloudflare'; const client = new Cloudflare({ apiToken: process.env['CLOUDFLARE_API_TOKEN'], // This is the default and can be omitted }); const flag = await client.flagship.apps.flags.get('app_id', 'flag_key', { account_id: 'account_id', }); console.log(flag.default_variation); ``` #### Response ```json { "errors": [ { "message": "message" } ], "messages": [ { "message": "message" } ], "result": { "default_variation": "x", "enabled": true, "key": "x", "rules": [ { "conditions": [ { "attribute": "x", "operator": "equals", "value": {} } ], "priority": 1, "serve_variation": "x", "rollout": { "percentage": 0, "attribute": "x" } } ], "variations": { "foo": "string" }, "description": "description", "type": "boolean", "updated_at": "updated_at", "updated_by": "updated_by" }, "success": true } ``` ## Create flag `client.flagship.apps.flags.create(stringappId, FlagCreateParamsparams, RequestOptionsoptions?): FlagCreateResponse` **post** `/accounts/{account_id}/flagship/apps/{app_id}/flags` Creates a flag. Returns 409 if the key already exists. `type` is inferred from variation values and may be omitted. ### Parameters - `appId: string` App identifier. - `params: FlagCreateParams` - `account_id: string` Path param: Cloudflare account ID. - `default_variation: string` Body param: Variation served when no rule matches or the flag is disabled. Must be a key in `variations`. - `enabled: boolean` Body param: When false, the flag bypasses all rules and always serves `default_variation`. - `key: string` Body param: Unique identifier for the flag within an app. Used in all evaluation and SDK calls. - `rules: Array` Body param: Targeting rules evaluated in ascending `priority`; the first matching rule wins. An empty array means the flag always serves `default_variation`. - `conditions: Array` Conditions the context must satisfy for this rule to match. An empty array matches all contexts. - `UnionMember0` - `attribute: string` - `operator: "equals" | "not_equals" | "greater_than" | 8 more` - `"equals"` - `"not_equals"` - `"greater_than"` - `"less_than"` - `"greater_than_or_equals"` - `"less_than_or_equals"` - `"contains"` - `"starts_with"` - `"ends_with"` - `"in"` - `"not_in"` - `value: unknown` Value to compare against the context attribute. Must be an array for `in` and `not_in`; numeric and ISO-8601 datetime strings are accepted by the ordering operators. - `UnionMember1` - `clauses: Array` - `UnionMember0` - `attribute: string` - `operator: "equals" | "not_equals" | "greater_than" | 8 more` - `"equals"` - `"not_equals"` - `"greater_than"` - `"less_than"` - `"greater_than_or_equals"` - `"less_than_or_equals"` - `"contains"` - `"starts_with"` - `"ends_with"` - `"in"` - `"not_in"` - `value: unknown` Value to compare against the context attribute. Must be an array for `in` and `not_in`; numeric and ISO-8601 datetime strings are accepted by the ordering operators. - `UnionMember1` - `clauses: Array` - `UnionMember0` - `attribute: string` - `operator: "equals" | "not_equals" | "greater_than" | 8 more` - `"equals"` - `"not_equals"` - `"greater_than"` - `"less_than"` - `"greater_than_or_equals"` - `"less_than_or_equals"` - `"contains"` - `"starts_with"` - `"ends_with"` - `"in"` - `"not_in"` - `value: unknown` Value to compare against the context attribute. Must be an array for `in` and `not_in`; numeric and ISO-8601 datetime strings are accepted by the ordering operators. - `UnionMember1` - `clauses: Array` - `UnionMember0` - `attribute: string` - `operator: "equals" | "not_equals" | "greater_than" | 8 more` - `"equals"` - `"not_equals"` - `"greater_than"` - `"less_than"` - `"greater_than_or_equals"` - `"less_than_or_equals"` - `"contains"` - `"starts_with"` - `"ends_with"` - `"in"` - `"not_in"` - `value: unknown` Value to compare against the context attribute. Must be an array for `in` and `not_in`; numeric and ISO-8601 datetime strings are accepted by the ordering operators. - `UnionMember1` - `clauses: Array` - `UnionMember0` - `attribute: string` - `operator: "equals" | "not_equals" | "greater_than" | 8 more` - `"equals"` - `"not_equals"` - `"greater_than"` - `"less_than"` - `"greater_than_or_equals"` - `"less_than_or_equals"` - `"contains"` - `"starts_with"` - `"ends_with"` - `"in"` - `"not_in"` - `value: unknown` Value to compare against the context attribute. Must be an array for `in` and `not_in`; numeric and ISO-8601 datetime strings are accepted by the ordering operators. - `UnionMember1` - `clauses: Array` - `UnionMember0` - `attribute: string` - `operator: "equals" | "not_equals" | "greater_than" | 8 more` - `"equals"` - `"not_equals"` - `"greater_than"` - `"less_than"` - `"greater_than_or_equals"` - `"less_than_or_equals"` - `"contains"` - `"starts_with"` - `"ends_with"` - `"in"` - `"not_in"` - `value: unknown` Value to compare against the context attribute. Must be an array for `in` and `not_in`; numeric and ISO-8601 datetime strings are accepted by the ordering operators. - `UnionMember1` - `clauses: Array` - `string | null` - `number` - `boolean` - `Record` - `Array` - `logical_operator: "AND" | "OR"` - `"AND"` - `"OR"` - `logical_operator: "AND" | "OR"` - `"AND"` - `"OR"` - `logical_operator: "AND" | "OR"` - `"AND"` - `"OR"` - `logical_operator: "AND" | "OR"` - `"AND"` - `"OR"` - `logical_operator: "AND" | "OR"` - `"AND"` - `"OR"` - `logical_operator: "AND" | "OR"` - `"AND"` - `"OR"` - `priority: number` Evaluation order; lower numbers are evaluated first. Must be unique across the flag's rules. - `serve_variation: string` Variation served when this rule matches. Must be a key in `variations`. - `rollout?: Rollout` - `percentage: number` Percentage of matching traffic (0–100) served this variation. For multi-way splits, use cumulative upper bounds across rules (e.g. 30, 70, 100). - `attribute?: string` Context attribute used for sticky bucketing. Defaults to `targetingKey`. If absent at evaluation time, bucketing is random per request. - `variations: Record` Body param: Map of variation name to value. All values must be the same type (boolean, string, number, or JSON object/array). Each serialized value must be 10KB or smaller. - `string | null` - `number` - `boolean` - `Record` - `Array` - `description?: string | null` Body param - `type?: "boolean" | "string" | "number" | "json"` Body param: Value type of the flag's variations. Inferred from the variation values on write, so it may be omitted in requests. - `"boolean"` - `"string"` - `"number"` - `"json"` ### Returns - `FlagCreateResponse` - `default_variation: string` Variation served when no rule matches or the flag is disabled. Must be a key in `variations`. - `enabled: boolean` When false, the flag bypasses all rules and always serves `default_variation`. - `key: string` Unique identifier for the flag within an app. Used in all evaluation and SDK calls. - `rules: Array` Targeting rules evaluated in ascending `priority`; the first matching rule wins. An empty array means the flag always serves `default_variation`. - `conditions: Array` Conditions the context must satisfy for this rule to match. An empty array matches all contexts. - `UnionMember0` - `attribute: string` - `operator: "equals" | "not_equals" | "greater_than" | 8 more` - `"equals"` - `"not_equals"` - `"greater_than"` - `"less_than"` - `"greater_than_or_equals"` - `"less_than_or_equals"` - `"contains"` - `"starts_with"` - `"ends_with"` - `"in"` - `"not_in"` - `value: unknown` Value to compare against the context attribute. Must be an array for `in` and `not_in`; numeric and ISO-8601 datetime strings are accepted by the ordering operators. - `UnionMember1` - `clauses: Array` - `UnionMember0` - `attribute: string` - `operator: "equals" | "not_equals" | "greater_than" | 8 more` - `"equals"` - `"not_equals"` - `"greater_than"` - `"less_than"` - `"greater_than_or_equals"` - `"less_than_or_equals"` - `"contains"` - `"starts_with"` - `"ends_with"` - `"in"` - `"not_in"` - `value: unknown` Value to compare against the context attribute. Must be an array for `in` and `not_in`; numeric and ISO-8601 datetime strings are accepted by the ordering operators. - `UnionMember1` - `clauses: Array` - `UnionMember0` - `attribute: string` - `operator: "equals" | "not_equals" | "greater_than" | 8 more` - `"equals"` - `"not_equals"` - `"greater_than"` - `"less_than"` - `"greater_than_or_equals"` - `"less_than_or_equals"` - `"contains"` - `"starts_with"` - `"ends_with"` - `"in"` - `"not_in"` - `value: unknown` Value to compare against the context attribute. Must be an array for `in` and `not_in`; numeric and ISO-8601 datetime strings are accepted by the ordering operators. - `UnionMember1` - `clauses: Array` - `UnionMember0` - `attribute: string` - `operator: "equals" | "not_equals" | "greater_than" | 8 more` - `"equals"` - `"not_equals"` - `"greater_than"` - `"less_than"` - `"greater_than_or_equals"` - `"less_than_or_equals"` - `"contains"` - `"starts_with"` - `"ends_with"` - `"in"` - `"not_in"` - `value: unknown` Value to compare against the context attribute. Must be an array for `in` and `not_in`; numeric and ISO-8601 datetime strings are accepted by the ordering operators. - `UnionMember1` - `clauses: Array` - `UnionMember0` - `attribute: string` - `operator: "equals" | "not_equals" | "greater_than" | 8 more` - `"equals"` - `"not_equals"` - `"greater_than"` - `"less_than"` - `"greater_than_or_equals"` - `"less_than_or_equals"` - `"contains"` - `"starts_with"` - `"ends_with"` - `"in"` - `"not_in"` - `value: unknown` Value to compare against the context attribute. Must be an array for `in` and `not_in`; numeric and ISO-8601 datetime strings are accepted by the ordering operators. - `UnionMember1` - `clauses: Array` - `UnionMember0` - `attribute: string` - `operator: "equals" | "not_equals" | "greater_than" | 8 more` - `"equals"` - `"not_equals"` - `"greater_than"` - `"less_than"` - `"greater_than_or_equals"` - `"less_than_or_equals"` - `"contains"` - `"starts_with"` - `"ends_with"` - `"in"` - `"not_in"` - `value: unknown` Value to compare against the context attribute. Must be an array for `in` and `not_in`; numeric and ISO-8601 datetime strings are accepted by the ordering operators. - `UnionMember1` - `clauses: Array` - `string | null` - `number` - `boolean` - `Record` - `Array` - `logical_operator: "AND" | "OR"` - `"AND"` - `"OR"` - `logical_operator: "AND" | "OR"` - `"AND"` - `"OR"` - `logical_operator: "AND" | "OR"` - `"AND"` - `"OR"` - `logical_operator: "AND" | "OR"` - `"AND"` - `"OR"` - `logical_operator: "AND" | "OR"` - `"AND"` - `"OR"` - `logical_operator: "AND" | "OR"` - `"AND"` - `"OR"` - `priority: number` Evaluation order; lower numbers are evaluated first. Must be unique across the flag's rules. - `serve_variation: string` Variation served when this rule matches. Must be a key in `variations`. - `rollout?: Rollout` - `percentage: number` Percentage of matching traffic (0–100) served this variation. For multi-way splits, use cumulative upper bounds across rules (e.g. 30, 70, 100). - `attribute?: string` Context attribute used for sticky bucketing. Defaults to `targetingKey`. If absent at evaluation time, bucketing is random per request. - `variations: Record` Map of variation name to value. All values must be the same type (boolean, string, number, or JSON object/array). Each serialized value must be 10KB or smaller. - `string | null` - `number` - `boolean` - `Record` - `Array` - `description?: string | null` - `type?: "boolean" | "string" | "number" | "json"` Value type of the flag's variations. Inferred from the variation values on write, so it may be omitted in requests. - `"boolean"` - `"string"` - `"number"` - `"json"` - `updated_at?: string` - `updated_by?: string` ### Example ```node import Cloudflare from 'cloudflare'; const client = new Cloudflare({ apiToken: process.env['CLOUDFLARE_API_TOKEN'], // This is the default and can be omitted }); const flag = await client.flagship.apps.flags.create('app_id', { account_id: 'account_id', default_variation: 'x', enabled: true, key: 'x', rules: [ { conditions: [ { attribute: 'x', operator: 'equals', value: {}, }, ], priority: 1, serve_variation: 'x', }, ], variations: { foo: 'string' }, }); console.log(flag.default_variation); ``` #### Response ```json { "errors": [ { "message": "message" } ], "messages": [ { "message": "message" } ], "result": { "default_variation": "x", "enabled": true, "key": "x", "rules": [ { "conditions": [ { "attribute": "x", "operator": "equals", "value": {} } ], "priority": 1, "serve_variation": "x", "rollout": { "percentage": 0, "attribute": "x" } } ], "variations": { "foo": "string" }, "description": "description", "type": "boolean", "updated_at": "updated_at", "updated_by": "updated_by" }, "success": true } ``` ## Update flag `client.flagship.apps.flags.update(stringappId, stringflagKey, FlagUpdateParamsparams, RequestOptionsoptions?): FlagUpdateResponse` **put** `/accounts/{account_id}/flagship/apps/{app_id}/flags/{flag_key}` Replaces the entire flag definition. Omitted fields are dropped, not preserved — read before writing. Each update appends a changelog entry. ### Parameters - `appId: string` App identifier. - `flagKey: string` Flag key (slug). - `params: FlagUpdateParams` - `account_id: string` Path param: Cloudflare account ID. - `default_variation: string` Body param: Variation served when no rule matches or the flag is disabled. Must be a key in `variations`. - `enabled: boolean` Body param: When false, the flag bypasses all rules and always serves `default_variation`. - `key: string` Body param: Unique identifier for the flag within an app. Used in all evaluation and SDK calls. - `rules: Array` Body param: Targeting rules evaluated in ascending `priority`; the first matching rule wins. An empty array means the flag always serves `default_variation`. - `conditions: Array` Conditions the context must satisfy for this rule to match. An empty array matches all contexts. - `UnionMember0` - `attribute: string` - `operator: "equals" | "not_equals" | "greater_than" | 8 more` - `"equals"` - `"not_equals"` - `"greater_than"` - `"less_than"` - `"greater_than_or_equals"` - `"less_than_or_equals"` - `"contains"` - `"starts_with"` - `"ends_with"` - `"in"` - `"not_in"` - `value: unknown` Value to compare against the context attribute. Must be an array for `in` and `not_in`; numeric and ISO-8601 datetime strings are accepted by the ordering operators. - `UnionMember1` - `clauses: Array` - `UnionMember0` - `attribute: string` - `operator: "equals" | "not_equals" | "greater_than" | 8 more` - `"equals"` - `"not_equals"` - `"greater_than"` - `"less_than"` - `"greater_than_or_equals"` - `"less_than_or_equals"` - `"contains"` - `"starts_with"` - `"ends_with"` - `"in"` - `"not_in"` - `value: unknown` Value to compare against the context attribute. Must be an array for `in` and `not_in`; numeric and ISO-8601 datetime strings are accepted by the ordering operators. - `UnionMember1` - `clauses: Array` - `UnionMember0` - `attribute: string` - `operator: "equals" | "not_equals" | "greater_than" | 8 more` - `"equals"` - `"not_equals"` - `"greater_than"` - `"less_than"` - `"greater_than_or_equals"` - `"less_than_or_equals"` - `"contains"` - `"starts_with"` - `"ends_with"` - `"in"` - `"not_in"` - `value: unknown` Value to compare against the context attribute. Must be an array for `in` and `not_in`; numeric and ISO-8601 datetime strings are accepted by the ordering operators. - `UnionMember1` - `clauses: Array` - `UnionMember0` - `attribute: string` - `operator: "equals" | "not_equals" | "greater_than" | 8 more` - `"equals"` - `"not_equals"` - `"greater_than"` - `"less_than"` - `"greater_than_or_equals"` - `"less_than_or_equals"` - `"contains"` - `"starts_with"` - `"ends_with"` - `"in"` - `"not_in"` - `value: unknown` Value to compare against the context attribute. Must be an array for `in` and `not_in`; numeric and ISO-8601 datetime strings are accepted by the ordering operators. - `UnionMember1` - `clauses: Array` - `UnionMember0` - `attribute: string` - `operator: "equals" | "not_equals" | "greater_than" | 8 more` - `"equals"` - `"not_equals"` - `"greater_than"` - `"less_than"` - `"greater_than_or_equals"` - `"less_than_or_equals"` - `"contains"` - `"starts_with"` - `"ends_with"` - `"in"` - `"not_in"` - `value: unknown` Value to compare against the context attribute. Must be an array for `in` and `not_in`; numeric and ISO-8601 datetime strings are accepted by the ordering operators. - `UnionMember1` - `clauses: Array` - `UnionMember0` - `attribute: string` - `operator: "equals" | "not_equals" | "greater_than" | 8 more` - `"equals"` - `"not_equals"` - `"greater_than"` - `"less_than"` - `"greater_than_or_equals"` - `"less_than_or_equals"` - `"contains"` - `"starts_with"` - `"ends_with"` - `"in"` - `"not_in"` - `value: unknown` Value to compare against the context attribute. Must be an array for `in` and `not_in`; numeric and ISO-8601 datetime strings are accepted by the ordering operators. - `UnionMember1` - `clauses: Array` - `string | null` - `number` - `boolean` - `Record` - `Array` - `logical_operator: "AND" | "OR"` - `"AND"` - `"OR"` - `logical_operator: "AND" | "OR"` - `"AND"` - `"OR"` - `logical_operator: "AND" | "OR"` - `"AND"` - `"OR"` - `logical_operator: "AND" | "OR"` - `"AND"` - `"OR"` - `logical_operator: "AND" | "OR"` - `"AND"` - `"OR"` - `logical_operator: "AND" | "OR"` - `"AND"` - `"OR"` - `priority: number` Evaluation order; lower numbers are evaluated first. Must be unique across the flag's rules. - `serve_variation: string` Variation served when this rule matches. Must be a key in `variations`. - `rollout?: Rollout` - `percentage: number` Percentage of matching traffic (0–100) served this variation. For multi-way splits, use cumulative upper bounds across rules (e.g. 30, 70, 100). - `attribute?: string` Context attribute used for sticky bucketing. Defaults to `targetingKey`. If absent at evaluation time, bucketing is random per request. - `variations: Record` Body param: Map of variation name to value. All values must be the same type (boolean, string, number, or JSON object/array). Each serialized value must be 10KB or smaller. - `string | null` - `number` - `boolean` - `Record` - `Array` - `description?: string | null` Body param - `type?: "boolean" | "string" | "number" | "json"` Body param: Value type of the flag's variations. Inferred from the variation values on write, so it may be omitted in requests. - `"boolean"` - `"string"` - `"number"` - `"json"` ### Returns - `FlagUpdateResponse` - `default_variation: string` Variation served when no rule matches or the flag is disabled. Must be a key in `variations`. - `enabled: boolean` When false, the flag bypasses all rules and always serves `default_variation`. - `key: string` Unique identifier for the flag within an app. Used in all evaluation and SDK calls. - `rules: Array` Targeting rules evaluated in ascending `priority`; the first matching rule wins. An empty array means the flag always serves `default_variation`. - `conditions: Array` Conditions the context must satisfy for this rule to match. An empty array matches all contexts. - `UnionMember0` - `attribute: string` - `operator: "equals" | "not_equals" | "greater_than" | 8 more` - `"equals"` - `"not_equals"` - `"greater_than"` - `"less_than"` - `"greater_than_or_equals"` - `"less_than_or_equals"` - `"contains"` - `"starts_with"` - `"ends_with"` - `"in"` - `"not_in"` - `value: unknown` Value to compare against the context attribute. Must be an array for `in` and `not_in`; numeric and ISO-8601 datetime strings are accepted by the ordering operators. - `UnionMember1` - `clauses: Array` - `UnionMember0` - `attribute: string` - `operator: "equals" | "not_equals" | "greater_than" | 8 more` - `"equals"` - `"not_equals"` - `"greater_than"` - `"less_than"` - `"greater_than_or_equals"` - `"less_than_or_equals"` - `"contains"` - `"starts_with"` - `"ends_with"` - `"in"` - `"not_in"` - `value: unknown` Value to compare against the context attribute. Must be an array for `in` and `not_in`; numeric and ISO-8601 datetime strings are accepted by the ordering operators. - `UnionMember1` - `clauses: Array` - `UnionMember0` - `attribute: string` - `operator: "equals" | "not_equals" | "greater_than" | 8 more` - `"equals"` - `"not_equals"` - `"greater_than"` - `"less_than"` - `"greater_than_or_equals"` - `"less_than_or_equals"` - `"contains"` - `"starts_with"` - `"ends_with"` - `"in"` - `"not_in"` - `value: unknown` Value to compare against the context attribute. Must be an array for `in` and `not_in`; numeric and ISO-8601 datetime strings are accepted by the ordering operators. - `UnionMember1` - `clauses: Array` - `UnionMember0` - `attribute: string` - `operator: "equals" | "not_equals" | "greater_than" | 8 more` - `"equals"` - `"not_equals"` - `"greater_than"` - `"less_than"` - `"greater_than_or_equals"` - `"less_than_or_equals"` - `"contains"` - `"starts_with"` - `"ends_with"` - `"in"` - `"not_in"` - `value: unknown` Value to compare against the context attribute. Must be an array for `in` and `not_in`; numeric and ISO-8601 datetime strings are accepted by the ordering operators. - `UnionMember1` - `clauses: Array` - `UnionMember0` - `attribute: string` - `operator: "equals" | "not_equals" | "greater_than" | 8 more` - `"equals"` - `"not_equals"` - `"greater_than"` - `"less_than"` - `"greater_than_or_equals"` - `"less_than_or_equals"` - `"contains"` - `"starts_with"` - `"ends_with"` - `"in"` - `"not_in"` - `value: unknown` Value to compare against the context attribute. Must be an array for `in` and `not_in`; numeric and ISO-8601 datetime strings are accepted by the ordering operators. - `UnionMember1` - `clauses: Array` - `UnionMember0` - `attribute: string` - `operator: "equals" | "not_equals" | "greater_than" | 8 more` - `"equals"` - `"not_equals"` - `"greater_than"` - `"less_than"` - `"greater_than_or_equals"` - `"less_than_or_equals"` - `"contains"` - `"starts_with"` - `"ends_with"` - `"in"` - `"not_in"` - `value: unknown` Value to compare against the context attribute. Must be an array for `in` and `not_in`; numeric and ISO-8601 datetime strings are accepted by the ordering operators. - `UnionMember1` - `clauses: Array` - `string | null` - `number` - `boolean` - `Record` - `Array` - `logical_operator: "AND" | "OR"` - `"AND"` - `"OR"` - `logical_operator: "AND" | "OR"` - `"AND"` - `"OR"` - `logical_operator: "AND" | "OR"` - `"AND"` - `"OR"` - `logical_operator: "AND" | "OR"` - `"AND"` - `"OR"` - `logical_operator: "AND" | "OR"` - `"AND"` - `"OR"` - `logical_operator: "AND" | "OR"` - `"AND"` - `"OR"` - `priority: number` Evaluation order; lower numbers are evaluated first. Must be unique across the flag's rules. - `serve_variation: string` Variation served when this rule matches. Must be a key in `variations`. - `rollout?: Rollout` - `percentage: number` Percentage of matching traffic (0–100) served this variation. For multi-way splits, use cumulative upper bounds across rules (e.g. 30, 70, 100). - `attribute?: string` Context attribute used for sticky bucketing. Defaults to `targetingKey`. If absent at evaluation time, bucketing is random per request. - `variations: Record` Map of variation name to value. All values must be the same type (boolean, string, number, or JSON object/array). Each serialized value must be 10KB or smaller. - `string | null` - `number` - `boolean` - `Record` - `Array` - `description?: string | null` - `type?: "boolean" | "string" | "number" | "json"` Value type of the flag's variations. Inferred from the variation values on write, so it may be omitted in requests. - `"boolean"` - `"string"` - `"number"` - `"json"` - `updated_at?: string` - `updated_by?: string` ### Example ```node import Cloudflare from 'cloudflare'; const client = new Cloudflare({ apiToken: process.env['CLOUDFLARE_API_TOKEN'], // This is the default and can be omitted }); const flag = await client.flagship.apps.flags.update('app_id', 'flag_key', { account_id: 'account_id', default_variation: 'x', enabled: true, key: 'x', rules: [ { conditions: [ { attribute: 'x', operator: 'equals', value: {}, }, ], priority: 1, serve_variation: 'x', }, ], variations: { foo: 'string' }, }); console.log(flag.default_variation); ``` #### Response ```json { "errors": [ { "message": "message" } ], "messages": [ { "message": "message" } ], "result": { "default_variation": "x", "enabled": true, "key": "x", "rules": [ { "conditions": [ { "attribute": "x", "operator": "equals", "value": {} } ], "priority": 1, "serve_variation": "x", "rollout": { "percentage": 0, "attribute": "x" } } ], "variations": { "foo": "string" }, "description": "description", "type": "boolean", "updated_at": "updated_at", "updated_by": "updated_by" }, "success": true } ``` ## Delete flag `client.flagship.apps.flags.delete(stringappId, stringflagKey, FlagDeleteParamsparams, RequestOptionsoptions?): FlagDeleteResponse` **delete** `/accounts/{account_id}/flagship/apps/{app_id}/flags/{flag_key}` Permanently deletes a flag. Subsequent evaluations fall back to the caller-supplied default. Cannot be undone. ### Parameters - `appId: string` App identifier. - `flagKey: string` Flag key (slug). - `params: FlagDeleteParams` - `account_id: string` Cloudflare account ID. ### Returns - `FlagDeleteResponse` - `key: string` ### Example ```node import Cloudflare from 'cloudflare'; const client = new Cloudflare({ apiToken: process.env['CLOUDFLARE_API_TOKEN'], // This is the default and can be omitted }); const flag = await client.flagship.apps.flags.delete('app_id', 'flag_key', { account_id: 'account_id', }); console.log(flag.key); ``` #### Response ```json { "errors": [ { "message": "message" } ], "messages": [ { "message": "message" } ], "result": { "key": "key" }, "success": true } ``` ## Domain Types ### Flag List Response - `FlagListResponse` - `default_variation: string` Variation served when no rule matches or the flag is disabled. Must be a key in `variations`. - `enabled: boolean` When false, the flag bypasses all rules and always serves `default_variation`. - `key: string` Unique identifier for the flag within an app. Used in all evaluation and SDK calls. - `rules: Array` Targeting rules evaluated in ascending `priority`; the first matching rule wins. An empty array means the flag always serves `default_variation`. - `conditions: Array` Conditions the context must satisfy for this rule to match. An empty array matches all contexts. - `UnionMember0` - `attribute: string` - `operator: "equals" | "not_equals" | "greater_than" | 8 more` - `"equals"` - `"not_equals"` - `"greater_than"` - `"less_than"` - `"greater_than_or_equals"` - `"less_than_or_equals"` - `"contains"` - `"starts_with"` - `"ends_with"` - `"in"` - `"not_in"` - `value: unknown` Value to compare against the context attribute. Must be an array for `in` and `not_in`; numeric and ISO-8601 datetime strings are accepted by the ordering operators. - `UnionMember1` - `clauses: Array` - `UnionMember0` - `attribute: string` - `operator: "equals" | "not_equals" | "greater_than" | 8 more` - `"equals"` - `"not_equals"` - `"greater_than"` - `"less_than"` - `"greater_than_or_equals"` - `"less_than_or_equals"` - `"contains"` - `"starts_with"` - `"ends_with"` - `"in"` - `"not_in"` - `value: unknown` Value to compare against the context attribute. Must be an array for `in` and `not_in`; numeric and ISO-8601 datetime strings are accepted by the ordering operators. - `UnionMember1` - `clauses: Array` - `UnionMember0` - `attribute: string` - `operator: "equals" | "not_equals" | "greater_than" | 8 more` - `"equals"` - `"not_equals"` - `"greater_than"` - `"less_than"` - `"greater_than_or_equals"` - `"less_than_or_equals"` - `"contains"` - `"starts_with"` - `"ends_with"` - `"in"` - `"not_in"` - `value: unknown` Value to compare against the context attribute. Must be an array for `in` and `not_in`; numeric and ISO-8601 datetime strings are accepted by the ordering operators. - `UnionMember1` - `clauses: Array` - `UnionMember0` - `attribute: string` - `operator: "equals" | "not_equals" | "greater_than" | 8 more` - `"equals"` - `"not_equals"` - `"greater_than"` - `"less_than"` - `"greater_than_or_equals"` - `"less_than_or_equals"` - `"contains"` - `"starts_with"` - `"ends_with"` - `"in"` - `"not_in"` - `value: unknown` Value to compare against the context attribute. Must be an array for `in` and `not_in`; numeric and ISO-8601 datetime strings are accepted by the ordering operators. - `UnionMember1` - `clauses: Array` - `UnionMember0` - `attribute: string` - `operator: "equals" | "not_equals" | "greater_than" | 8 more` - `"equals"` - `"not_equals"` - `"greater_than"` - `"less_than"` - `"greater_than_or_equals"` - `"less_than_or_equals"` - `"contains"` - `"starts_with"` - `"ends_with"` - `"in"` - `"not_in"` - `value: unknown` Value to compare against the context attribute. Must be an array for `in` and `not_in`; numeric and ISO-8601 datetime strings are accepted by the ordering operators. - `UnionMember1` - `clauses: Array` - `UnionMember0` - `attribute: string` - `operator: "equals" | "not_equals" | "greater_than" | 8 more` - `"equals"` - `"not_equals"` - `"greater_than"` - `"less_than"` - `"greater_than_or_equals"` - `"less_than_or_equals"` - `"contains"` - `"starts_with"` - `"ends_with"` - `"in"` - `"not_in"` - `value: unknown` Value to compare against the context attribute. Must be an array for `in` and `not_in`; numeric and ISO-8601 datetime strings are accepted by the ordering operators. - `UnionMember1` - `clauses: Array` - `string | null` - `number` - `boolean` - `Record` - `Array` - `logical_operator: "AND" | "OR"` - `"AND"` - `"OR"` - `logical_operator: "AND" | "OR"` - `"AND"` - `"OR"` - `logical_operator: "AND" | "OR"` - `"AND"` - `"OR"` - `logical_operator: "AND" | "OR"` - `"AND"` - `"OR"` - `logical_operator: "AND" | "OR"` - `"AND"` - `"OR"` - `logical_operator: "AND" | "OR"` - `"AND"` - `"OR"` - `priority: number` Evaluation order; lower numbers are evaluated first. Must be unique across the flag's rules. - `serve_variation: string` Variation served when this rule matches. Must be a key in `variations`. - `rollout?: Rollout` - `percentage: number` Percentage of matching traffic (0–100) served this variation. For multi-way splits, use cumulative upper bounds across rules (e.g. 30, 70, 100). - `attribute?: string` Context attribute used for sticky bucketing. Defaults to `targetingKey`. If absent at evaluation time, bucketing is random per request. - `variations: Record` Map of variation name to value. All values must be the same type (boolean, string, number, or JSON object/array). Each serialized value must be 10KB or smaller. - `string | null` - `number` - `boolean` - `Record` - `Array` - `description?: string | null` - `type?: "boolean" | "string" | "number" | "json"` Value type of the flag's variations. Inferred from the variation values on write, so it may be omitted in requests. - `"boolean"` - `"string"` - `"number"` - `"json"` - `updated_at?: string` - `updated_by?: string` ### Flag Get Response - `FlagGetResponse` - `default_variation: string` Variation served when no rule matches or the flag is disabled. Must be a key in `variations`. - `enabled: boolean` When false, the flag bypasses all rules and always serves `default_variation`. - `key: string` Unique identifier for the flag within an app. Used in all evaluation and SDK calls. - `rules: Array` Targeting rules evaluated in ascending `priority`; the first matching rule wins. An empty array means the flag always serves `default_variation`. - `conditions: Array` Conditions the context must satisfy for this rule to match. An empty array matches all contexts. - `UnionMember0` - `attribute: string` - `operator: "equals" | "not_equals" | "greater_than" | 8 more` - `"equals"` - `"not_equals"` - `"greater_than"` - `"less_than"` - `"greater_than_or_equals"` - `"less_than_or_equals"` - `"contains"` - `"starts_with"` - `"ends_with"` - `"in"` - `"not_in"` - `value: unknown` Value to compare against the context attribute. Must be an array for `in` and `not_in`; numeric and ISO-8601 datetime strings are accepted by the ordering operators. - `UnionMember1` - `clauses: Array` - `UnionMember0` - `attribute: string` - `operator: "equals" | "not_equals" | "greater_than" | 8 more` - `"equals"` - `"not_equals"` - `"greater_than"` - `"less_than"` - `"greater_than_or_equals"` - `"less_than_or_equals"` - `"contains"` - `"starts_with"` - `"ends_with"` - `"in"` - `"not_in"` - `value: unknown` Value to compare against the context attribute. Must be an array for `in` and `not_in`; numeric and ISO-8601 datetime strings are accepted by the ordering operators. - `UnionMember1` - `clauses: Array` - `UnionMember0` - `attribute: string` - `operator: "equals" | "not_equals" | "greater_than" | 8 more` - `"equals"` - `"not_equals"` - `"greater_than"` - `"less_than"` - `"greater_than_or_equals"` - `"less_than_or_equals"` - `"contains"` - `"starts_with"` - `"ends_with"` - `"in"` - `"not_in"` - `value: unknown` Value to compare against the context attribute. Must be an array for `in` and `not_in`; numeric and ISO-8601 datetime strings are accepted by the ordering operators. - `UnionMember1` - `clauses: Array` - `UnionMember0` - `attribute: string` - `operator: "equals" | "not_equals" | "greater_than" | 8 more` - `"equals"` - `"not_equals"` - `"greater_than"` - `"less_than"` - `"greater_than_or_equals"` - `"less_than_or_equals"` - `"contains"` - `"starts_with"` - `"ends_with"` - `"in"` - `"not_in"` - `value: unknown` Value to compare against the context attribute. Must be an array for `in` and `not_in`; numeric and ISO-8601 datetime strings are accepted by the ordering operators. - `UnionMember1` - `clauses: Array` - `UnionMember0` - `attribute: string` - `operator: "equals" | "not_equals" | "greater_than" | 8 more` - `"equals"` - `"not_equals"` - `"greater_than"` - `"less_than"` - `"greater_than_or_equals"` - `"less_than_or_equals"` - `"contains"` - `"starts_with"` - `"ends_with"` - `"in"` - `"not_in"` - `value: unknown` Value to compare against the context attribute. Must be an array for `in` and `not_in`; numeric and ISO-8601 datetime strings are accepted by the ordering operators. - `UnionMember1` - `clauses: Array` - `UnionMember0` - `attribute: string` - `operator: "equals" | "not_equals" | "greater_than" | 8 more` - `"equals"` - `"not_equals"` - `"greater_than"` - `"less_than"` - `"greater_than_or_equals"` - `"less_than_or_equals"` - `"contains"` - `"starts_with"` - `"ends_with"` - `"in"` - `"not_in"` - `value: unknown` Value to compare against the context attribute. Must be an array for `in` and `not_in`; numeric and ISO-8601 datetime strings are accepted by the ordering operators. - `UnionMember1` - `clauses: Array` - `string | null` - `number` - `boolean` - `Record` - `Array` - `logical_operator: "AND" | "OR"` - `"AND"` - `"OR"` - `logical_operator: "AND" | "OR"` - `"AND"` - `"OR"` - `logical_operator: "AND" | "OR"` - `"AND"` - `"OR"` - `logical_operator: "AND" | "OR"` - `"AND"` - `"OR"` - `logical_operator: "AND" | "OR"` - `"AND"` - `"OR"` - `logical_operator: "AND" | "OR"` - `"AND"` - `"OR"` - `priority: number` Evaluation order; lower numbers are evaluated first. Must be unique across the flag's rules. - `serve_variation: string` Variation served when this rule matches. Must be a key in `variations`. - `rollout?: Rollout` - `percentage: number` Percentage of matching traffic (0–100) served this variation. For multi-way splits, use cumulative upper bounds across rules (e.g. 30, 70, 100). - `attribute?: string` Context attribute used for sticky bucketing. Defaults to `targetingKey`. If absent at evaluation time, bucketing is random per request. - `variations: Record` Map of variation name to value. All values must be the same type (boolean, string, number, or JSON object/array). Each serialized value must be 10KB or smaller. - `string | null` - `number` - `boolean` - `Record` - `Array` - `description?: string | null` - `type?: "boolean" | "string" | "number" | "json"` Value type of the flag's variations. Inferred from the variation values on write, so it may be omitted in requests. - `"boolean"` - `"string"` - `"number"` - `"json"` - `updated_at?: string` - `updated_by?: string` ### Flag Create Response - `FlagCreateResponse` - `default_variation: string` Variation served when no rule matches or the flag is disabled. Must be a key in `variations`. - `enabled: boolean` When false, the flag bypasses all rules and always serves `default_variation`. - `key: string` Unique identifier for the flag within an app. Used in all evaluation and SDK calls. - `rules: Array` Targeting rules evaluated in ascending `priority`; the first matching rule wins. An empty array means the flag always serves `default_variation`. - `conditions: Array` Conditions the context must satisfy for this rule to match. An empty array matches all contexts. - `UnionMember0` - `attribute: string` - `operator: "equals" | "not_equals" | "greater_than" | 8 more` - `"equals"` - `"not_equals"` - `"greater_than"` - `"less_than"` - `"greater_than_or_equals"` - `"less_than_or_equals"` - `"contains"` - `"starts_with"` - `"ends_with"` - `"in"` - `"not_in"` - `value: unknown` Value to compare against the context attribute. Must be an array for `in` and `not_in`; numeric and ISO-8601 datetime strings are accepted by the ordering operators. - `UnionMember1` - `clauses: Array` - `UnionMember0` - `attribute: string` - `operator: "equals" | "not_equals" | "greater_than" | 8 more` - `"equals"` - `"not_equals"` - `"greater_than"` - `"less_than"` - `"greater_than_or_equals"` - `"less_than_or_equals"` - `"contains"` - `"starts_with"` - `"ends_with"` - `"in"` - `"not_in"` - `value: unknown` Value to compare against the context attribute. Must be an array for `in` and `not_in`; numeric and ISO-8601 datetime strings are accepted by the ordering operators. - `UnionMember1` - `clauses: Array` - `UnionMember0` - `attribute: string` - `operator: "equals" | "not_equals" | "greater_than" | 8 more` - `"equals"` - `"not_equals"` - `"greater_than"` - `"less_than"` - `"greater_than_or_equals"` - `"less_than_or_equals"` - `"contains"` - `"starts_with"` - `"ends_with"` - `"in"` - `"not_in"` - `value: unknown` Value to compare against the context attribute. Must be an array for `in` and `not_in`; numeric and ISO-8601 datetime strings are accepted by the ordering operators. - `UnionMember1` - `clauses: Array` - `UnionMember0` - `attribute: string` - `operator: "equals" | "not_equals" | "greater_than" | 8 more` - `"equals"` - `"not_equals"` - `"greater_than"` - `"less_than"` - `"greater_than_or_equals"` - `"less_than_or_equals"` - `"contains"` - `"starts_with"` - `"ends_with"` - `"in"` - `"not_in"` - `value: unknown` Value to compare against the context attribute. Must be an array for `in` and `not_in`; numeric and ISO-8601 datetime strings are accepted by the ordering operators. - `UnionMember1` - `clauses: Array` - `UnionMember0` - `attribute: string` - `operator: "equals" | "not_equals" | "greater_than" | 8 more` - `"equals"` - `"not_equals"` - `"greater_than"` - `"less_than"` - `"greater_than_or_equals"` - `"less_than_or_equals"` - `"contains"` - `"starts_with"` - `"ends_with"` - `"in"` - `"not_in"` - `value: unknown` Value to compare against the context attribute. Must be an array for `in` and `not_in`; numeric and ISO-8601 datetime strings are accepted by the ordering operators. - `UnionMember1` - `clauses: Array` - `UnionMember0` - `attribute: string` - `operator: "equals" | "not_equals" | "greater_than" | 8 more` - `"equals"` - `"not_equals"` - `"greater_than"` - `"less_than"` - `"greater_than_or_equals"` - `"less_than_or_equals"` - `"contains"` - `"starts_with"` - `"ends_with"` - `"in"` - `"not_in"` - `value: unknown` Value to compare against the context attribute. Must be an array for `in` and `not_in`; numeric and ISO-8601 datetime strings are accepted by the ordering operators. - `UnionMember1` - `clauses: Array` - `string | null` - `number` - `boolean` - `Record` - `Array` - `logical_operator: "AND" | "OR"` - `"AND"` - `"OR"` - `logical_operator: "AND" | "OR"` - `"AND"` - `"OR"` - `logical_operator: "AND" | "OR"` - `"AND"` - `"OR"` - `logical_operator: "AND" | "OR"` - `"AND"` - `"OR"` - `logical_operator: "AND" | "OR"` - `"AND"` - `"OR"` - `logical_operator: "AND" | "OR"` - `"AND"` - `"OR"` - `priority: number` Evaluation order; lower numbers are evaluated first. Must be unique across the flag's rules. - `serve_variation: string` Variation served when this rule matches. Must be a key in `variations`. - `rollout?: Rollout` - `percentage: number` Percentage of matching traffic (0–100) served this variation. For multi-way splits, use cumulative upper bounds across rules (e.g. 30, 70, 100). - `attribute?: string` Context attribute used for sticky bucketing. Defaults to `targetingKey`. If absent at evaluation time, bucketing is random per request. - `variations: Record` Map of variation name to value. All values must be the same type (boolean, string, number, or JSON object/array). Each serialized value must be 10KB or smaller. - `string | null` - `number` - `boolean` - `Record` - `Array` - `description?: string | null` - `type?: "boolean" | "string" | "number" | "json"` Value type of the flag's variations. Inferred from the variation values on write, so it may be omitted in requests. - `"boolean"` - `"string"` - `"number"` - `"json"` - `updated_at?: string` - `updated_by?: string` ### Flag Update Response - `FlagUpdateResponse` - `default_variation: string` Variation served when no rule matches or the flag is disabled. Must be a key in `variations`. - `enabled: boolean` When false, the flag bypasses all rules and always serves `default_variation`. - `key: string` Unique identifier for the flag within an app. Used in all evaluation and SDK calls. - `rules: Array` Targeting rules evaluated in ascending `priority`; the first matching rule wins. An empty array means the flag always serves `default_variation`. - `conditions: Array` Conditions the context must satisfy for this rule to match. An empty array matches all contexts. - `UnionMember0` - `attribute: string` - `operator: "equals" | "not_equals" | "greater_than" | 8 more` - `"equals"` - `"not_equals"` - `"greater_than"` - `"less_than"` - `"greater_than_or_equals"` - `"less_than_or_equals"` - `"contains"` - `"starts_with"` - `"ends_with"` - `"in"` - `"not_in"` - `value: unknown` Value to compare against the context attribute. Must be an array for `in` and `not_in`; numeric and ISO-8601 datetime strings are accepted by the ordering operators. - `UnionMember1` - `clauses: Array` - `UnionMember0` - `attribute: string` - `operator: "equals" | "not_equals" | "greater_than" | 8 more` - `"equals"` - `"not_equals"` - `"greater_than"` - `"less_than"` - `"greater_than_or_equals"` - `"less_than_or_equals"` - `"contains"` - `"starts_with"` - `"ends_with"` - `"in"` - `"not_in"` - `value: unknown` Value to compare against the context attribute. Must be an array for `in` and `not_in`; numeric and ISO-8601 datetime strings are accepted by the ordering operators. - `UnionMember1` - `clauses: Array` - `UnionMember0` - `attribute: string` - `operator: "equals" | "not_equals" | "greater_than" | 8 more` - `"equals"` - `"not_equals"` - `"greater_than"` - `"less_than"` - `"greater_than_or_equals"` - `"less_than_or_equals"` - `"contains"` - `"starts_with"` - `"ends_with"` - `"in"` - `"not_in"` - `value: unknown` Value to compare against the context attribute. Must be an array for `in` and `not_in`; numeric and ISO-8601 datetime strings are accepted by the ordering operators. - `UnionMember1` - `clauses: Array` - `UnionMember0` - `attribute: string` - `operator: "equals" | "not_equals" | "greater_than" | 8 more` - `"equals"` - `"not_equals"` - `"greater_than"` - `"less_than"` - `"greater_than_or_equals"` - `"less_than_or_equals"` - `"contains"` - `"starts_with"` - `"ends_with"` - `"in"` - `"not_in"` - `value: unknown` Value to compare against the context attribute. Must be an array for `in` and `not_in`; numeric and ISO-8601 datetime strings are accepted by the ordering operators. - `UnionMember1` - `clauses: Array` - `UnionMember0` - `attribute: string` - `operator: "equals" | "not_equals" | "greater_than" | 8 more` - `"equals"` - `"not_equals"` - `"greater_than"` - `"less_than"` - `"greater_than_or_equals"` - `"less_than_or_equals"` - `"contains"` - `"starts_with"` - `"ends_with"` - `"in"` - `"not_in"` - `value: unknown` Value to compare against the context attribute. Must be an array for `in` and `not_in`; numeric and ISO-8601 datetime strings are accepted by the ordering operators. - `UnionMember1` - `clauses: Array` - `UnionMember0` - `attribute: string` - `operator: "equals" | "not_equals" | "greater_than" | 8 more` - `"equals"` - `"not_equals"` - `"greater_than"` - `"less_than"` - `"greater_than_or_equals"` - `"less_than_or_equals"` - `"contains"` - `"starts_with"` - `"ends_with"` - `"in"` - `"not_in"` - `value: unknown` Value to compare against the context attribute. Must be an array for `in` and `not_in`; numeric and ISO-8601 datetime strings are accepted by the ordering operators. - `UnionMember1` - `clauses: Array` - `string | null` - `number` - `boolean` - `Record` - `Array` - `logical_operator: "AND" | "OR"` - `"AND"` - `"OR"` - `logical_operator: "AND" | "OR"` - `"AND"` - `"OR"` - `logical_operator: "AND" | "OR"` - `"AND"` - `"OR"` - `logical_operator: "AND" | "OR"` - `"AND"` - `"OR"` - `logical_operator: "AND" | "OR"` - `"AND"` - `"OR"` - `logical_operator: "AND" | "OR"` - `"AND"` - `"OR"` - `priority: number` Evaluation order; lower numbers are evaluated first. Must be unique across the flag's rules. - `serve_variation: string` Variation served when this rule matches. Must be a key in `variations`. - `rollout?: Rollout` - `percentage: number` Percentage of matching traffic (0–100) served this variation. For multi-way splits, use cumulative upper bounds across rules (e.g. 30, 70, 100). - `attribute?: string` Context attribute used for sticky bucketing. Defaults to `targetingKey`. If absent at evaluation time, bucketing is random per request. - `variations: Record` Map of variation name to value. All values must be the same type (boolean, string, number, or JSON object/array). Each serialized value must be 10KB or smaller. - `string | null` - `number` - `boolean` - `Record` - `Array` - `description?: string | null` - `type?: "boolean" | "string" | "number" | "json"` Value type of the flag's variations. Inferred from the variation values on write, so it may be omitted in requests. - `"boolean"` - `"string"` - `"number"` - `"json"` - `updated_at?: string` - `updated_by?: string` ### Flag Delete Response - `FlagDeleteResponse` - `key: string` # Changelog ## Get flag changelog `client.flagship.apps.flags.changelog.list(stringappId, stringflagKey, ChangelogListParamsparams, RequestOptionsoptions?): CursorPaginationAfter` **get** `/accounts/{account_id}/flagship/apps/{app_id}/flags/{flag_key}/changelog` Returns the audit history for a flag, newest first. Each entry includes the event type and full flag state after the change; `update` entries include a field-level diff. Capped at 200 entries per flag. ### Parameters - `appId: string` App identifier. - `flagKey: string` Flag key (slug). - `params: ChangelogListParams` - `account_id: string` Path param: Cloudflare account ID. - `cursor?: string` Query param: Pagination cursor from a previous response. - `limit?: string` Query param: Max items to return (1–200). ### Returns - `ChangelogListResponse = UnionMember0 | UnionMember1 | UnionMember2` - `UnionMember0` - `after: After` - `default_variation: string` Variation served when no rule matches or the flag is disabled. Must be a key in `variations`. - `enabled: boolean` When false, the flag bypasses all rules and always serves `default_variation`. - `key: string` Unique identifier for the flag within an app. Used in all evaluation and SDK calls. - `rules: Array` Targeting rules evaluated in ascending `priority`; the first matching rule wins. An empty array means the flag always serves `default_variation`. - `conditions: Array` Conditions the context must satisfy for this rule to match. An empty array matches all contexts. - `UnionMember0` - `attribute: string` - `operator: "equals" | "not_equals" | "greater_than" | 8 more` - `"equals"` - `"not_equals"` - `"greater_than"` - `"less_than"` - `"greater_than_or_equals"` - `"less_than_or_equals"` - `"contains"` - `"starts_with"` - `"ends_with"` - `"in"` - `"not_in"` - `value: unknown` Value to compare against the context attribute. Must be an array for `in` and `not_in`; numeric and ISO-8601 datetime strings are accepted by the ordering operators. - `UnionMember1` - `clauses: Array` - `UnionMember0` - `attribute: string` - `operator: "equals" | "not_equals" | "greater_than" | 8 more` - `"equals"` - `"not_equals"` - `"greater_than"` - `"less_than"` - `"greater_than_or_equals"` - `"less_than_or_equals"` - `"contains"` - `"starts_with"` - `"ends_with"` - `"in"` - `"not_in"` - `value: unknown` Value to compare against the context attribute. Must be an array for `in` and `not_in`; numeric and ISO-8601 datetime strings are accepted by the ordering operators. - `UnionMember1` - `clauses: Array` - `UnionMember0` - `attribute: string` - `operator: "equals" | "not_equals" | "greater_than" | 8 more` - `"equals"` - `"not_equals"` - `"greater_than"` - `"less_than"` - `"greater_than_or_equals"` - `"less_than_or_equals"` - `"contains"` - `"starts_with"` - `"ends_with"` - `"in"` - `"not_in"` - `value: unknown` Value to compare against the context attribute. Must be an array for `in` and `not_in`; numeric and ISO-8601 datetime strings are accepted by the ordering operators. - `UnionMember1` - `clauses: Array` - `UnionMember0` - `attribute: string` - `operator: "equals" | "not_equals" | "greater_than" | 8 more` - `"equals"` - `"not_equals"` - `"greater_than"` - `"less_than"` - `"greater_than_or_equals"` - `"less_than_or_equals"` - `"contains"` - `"starts_with"` - `"ends_with"` - `"in"` - `"not_in"` - `value: unknown` Value to compare against the context attribute. Must be an array for `in` and `not_in`; numeric and ISO-8601 datetime strings are accepted by the ordering operators. - `UnionMember1` - `clauses: Array` - `UnionMember0` - `attribute: string` - `operator: "equals" | "not_equals" | "greater_than" | 8 more` - `"equals"` - `"not_equals"` - `"greater_than"` - `"less_than"` - `"greater_than_or_equals"` - `"less_than_or_equals"` - `"contains"` - `"starts_with"` - `"ends_with"` - `"in"` - `"not_in"` - `value: unknown` Value to compare against the context attribute. Must be an array for `in` and `not_in`; numeric and ISO-8601 datetime strings are accepted by the ordering operators. - `UnionMember1` - `clauses: Array` - `UnionMember0` - `attribute: string` - `operator: "equals" | "not_equals" | "greater_than" | 8 more` - `"equals"` - `"not_equals"` - `"greater_than"` - `"less_than"` - `"greater_than_or_equals"` - `"less_than_or_equals"` - `"contains"` - `"starts_with"` - `"ends_with"` - `"in"` - `"not_in"` - `value: unknown` Value to compare against the context attribute. Must be an array for `in` and `not_in`; numeric and ISO-8601 datetime strings are accepted by the ordering operators. - `UnionMember1` - `clauses: Array` - `string | null` - `number` - `boolean` - `Record` - `Array` - `logical_operator: "AND" | "OR"` - `"AND"` - `"OR"` - `logical_operator: "AND" | "OR"` - `"AND"` - `"OR"` - `logical_operator: "AND" | "OR"` - `"AND"` - `"OR"` - `logical_operator: "AND" | "OR"` - `"AND"` - `"OR"` - `logical_operator: "AND" | "OR"` - `"AND"` - `"OR"` - `logical_operator: "AND" | "OR"` - `"AND"` - `"OR"` - `priority: number` Evaluation order; lower numbers are evaluated first. Must be unique across the flag's rules. - `serve_variation: string` Variation served when this rule matches. Must be a key in `variations`. - `rollout?: Rollout` - `percentage: number` Percentage of matching traffic (0–100) served this variation. For multi-way splits, use cumulative upper bounds across rules (e.g. 30, 70, 100). - `attribute?: string` Context attribute used for sticky bucketing. Defaults to `targetingKey`. If absent at evaluation time, bucketing is random per request. - `variations: Record` Map of variation name to value. All values must be the same type (boolean, string, number, or JSON object/array). Each serialized value must be 10KB or smaller. - `string | null` - `number` - `boolean` - `Record` - `Array` - `description?: string | null` - `type?: "boolean" | "string" | "number" | "json"` Value type of the flag's variations. Inferred from the variation values on write, so it may be omitted in requests. - `"boolean"` - `"string"` - `"number"` - `"json"` - `updated_at?: string` - `updated_by?: string` - `event: "create"` - `"create"` - `flag_key: string` - `UnionMember1` - `after: After` - `default_variation: string` Variation served when no rule matches or the flag is disabled. Must be a key in `variations`. - `enabled: boolean` When false, the flag bypasses all rules and always serves `default_variation`. - `key: string` Unique identifier for the flag within an app. Used in all evaluation and SDK calls. - `rules: Array` Targeting rules evaluated in ascending `priority`; the first matching rule wins. An empty array means the flag always serves `default_variation`. - `conditions: Array` Conditions the context must satisfy for this rule to match. An empty array matches all contexts. - `UnionMember0` - `attribute: string` - `operator: "equals" | "not_equals" | "greater_than" | 8 more` - `"equals"` - `"not_equals"` - `"greater_than"` - `"less_than"` - `"greater_than_or_equals"` - `"less_than_or_equals"` - `"contains"` - `"starts_with"` - `"ends_with"` - `"in"` - `"not_in"` - `value: unknown` Value to compare against the context attribute. Must be an array for `in` and `not_in`; numeric and ISO-8601 datetime strings are accepted by the ordering operators. - `UnionMember1` - `clauses: Array` - `UnionMember0` - `attribute: string` - `operator: "equals" | "not_equals" | "greater_than" | 8 more` - `"equals"` - `"not_equals"` - `"greater_than"` - `"less_than"` - `"greater_than_or_equals"` - `"less_than_or_equals"` - `"contains"` - `"starts_with"` - `"ends_with"` - `"in"` - `"not_in"` - `value: unknown` Value to compare against the context attribute. Must be an array for `in` and `not_in`; numeric and ISO-8601 datetime strings are accepted by the ordering operators. - `UnionMember1` - `clauses: Array` - `UnionMember0` - `attribute: string` - `operator: "equals" | "not_equals" | "greater_than" | 8 more` - `"equals"` - `"not_equals"` - `"greater_than"` - `"less_than"` - `"greater_than_or_equals"` - `"less_than_or_equals"` - `"contains"` - `"starts_with"` - `"ends_with"` - `"in"` - `"not_in"` - `value: unknown` Value to compare against the context attribute. Must be an array for `in` and `not_in`; numeric and ISO-8601 datetime strings are accepted by the ordering operators. - `UnionMember1` - `clauses: Array` - `UnionMember0` - `attribute: string` - `operator: "equals" | "not_equals" | "greater_than" | 8 more` - `"equals"` - `"not_equals"` - `"greater_than"` - `"less_than"` - `"greater_than_or_equals"` - `"less_than_or_equals"` - `"contains"` - `"starts_with"` - `"ends_with"` - `"in"` - `"not_in"` - `value: unknown` Value to compare against the context attribute. Must be an array for `in` and `not_in`; numeric and ISO-8601 datetime strings are accepted by the ordering operators. - `UnionMember1` - `clauses: Array` - `UnionMember0` - `attribute: string` - `operator: "equals" | "not_equals" | "greater_than" | 8 more` - `"equals"` - `"not_equals"` - `"greater_than"` - `"less_than"` - `"greater_than_or_equals"` - `"less_than_or_equals"` - `"contains"` - `"starts_with"` - `"ends_with"` - `"in"` - `"not_in"` - `value: unknown` Value to compare against the context attribute. Must be an array for `in` and `not_in`; numeric and ISO-8601 datetime strings are accepted by the ordering operators. - `UnionMember1` - `clauses: Array` - `UnionMember0` - `attribute: string` - `operator: "equals" | "not_equals" | "greater_than" | 8 more` - `"equals"` - `"not_equals"` - `"greater_than"` - `"less_than"` - `"greater_than_or_equals"` - `"less_than_or_equals"` - `"contains"` - `"starts_with"` - `"ends_with"` - `"in"` - `"not_in"` - `value: unknown` Value to compare against the context attribute. Must be an array for `in` and `not_in`; numeric and ISO-8601 datetime strings are accepted by the ordering operators. - `UnionMember1` - `clauses: Array` - `string | null` - `number` - `boolean` - `Record` - `Array` - `logical_operator: "AND" | "OR"` - `"AND"` - `"OR"` - `logical_operator: "AND" | "OR"` - `"AND"` - `"OR"` - `logical_operator: "AND" | "OR"` - `"AND"` - `"OR"` - `logical_operator: "AND" | "OR"` - `"AND"` - `"OR"` - `logical_operator: "AND" | "OR"` - `"AND"` - `"OR"` - `logical_operator: "AND" | "OR"` - `"AND"` - `"OR"` - `priority: number` Evaluation order; lower numbers are evaluated first. Must be unique across the flag's rules. - `serve_variation: string` Variation served when this rule matches. Must be a key in `variations`. - `rollout?: Rollout` - `percentage: number` Percentage of matching traffic (0–100) served this variation. For multi-way splits, use cumulative upper bounds across rules (e.g. 30, 70, 100). - `attribute?: string` Context attribute used for sticky bucketing. Defaults to `targetingKey`. If absent at evaluation time, bucketing is random per request. - `variations: Record` Map of variation name to value. All values must be the same type (boolean, string, number, or JSON object/array). Each serialized value must be 10KB or smaller. - `string | null` - `number` - `boolean` - `Record` - `Array` - `description?: string | null` - `type?: "boolean" | "string" | "number" | "json"` Value type of the flag's variations. Inferred from the variation values on write, so it may be omitted in requests. - `"boolean"` - `"string"` - `"number"` - `"json"` - `updated_at?: string` - `updated_by?: string` - `event: "delete"` - `"delete"` - `flag_key: string` - `UnionMember2` - `after: After` - `default_variation: string` Variation served when no rule matches or the flag is disabled. Must be a key in `variations`. - `enabled: boolean` When false, the flag bypasses all rules and always serves `default_variation`. - `key: string` Unique identifier for the flag within an app. Used in all evaluation and SDK calls. - `rules: Array` Targeting rules evaluated in ascending `priority`; the first matching rule wins. An empty array means the flag always serves `default_variation`. - `conditions: Array` Conditions the context must satisfy for this rule to match. An empty array matches all contexts. - `UnionMember0` - `attribute: string` - `operator: "equals" | "not_equals" | "greater_than" | 8 more` - `"equals"` - `"not_equals"` - `"greater_than"` - `"less_than"` - `"greater_than_or_equals"` - `"less_than_or_equals"` - `"contains"` - `"starts_with"` - `"ends_with"` - `"in"` - `"not_in"` - `value: unknown` Value to compare against the context attribute. Must be an array for `in` and `not_in`; numeric and ISO-8601 datetime strings are accepted by the ordering operators. - `UnionMember1` - `clauses: Array` - `UnionMember0` - `attribute: string` - `operator: "equals" | "not_equals" | "greater_than" | 8 more` - `"equals"` - `"not_equals"` - `"greater_than"` - `"less_than"` - `"greater_than_or_equals"` - `"less_than_or_equals"` - `"contains"` - `"starts_with"` - `"ends_with"` - `"in"` - `"not_in"` - `value: unknown` Value to compare against the context attribute. Must be an array for `in` and `not_in`; numeric and ISO-8601 datetime strings are accepted by the ordering operators. - `UnionMember1` - `clauses: Array` - `UnionMember0` - `attribute: string` - `operator: "equals" | "not_equals" | "greater_than" | 8 more` - `"equals"` - `"not_equals"` - `"greater_than"` - `"less_than"` - `"greater_than_or_equals"` - `"less_than_or_equals"` - `"contains"` - `"starts_with"` - `"ends_with"` - `"in"` - `"not_in"` - `value: unknown` Value to compare against the context attribute. Must be an array for `in` and `not_in`; numeric and ISO-8601 datetime strings are accepted by the ordering operators. - `UnionMember1` - `clauses: Array` - `UnionMember0` - `attribute: string` - `operator: "equals" | "not_equals" | "greater_than" | 8 more` - `"equals"` - `"not_equals"` - `"greater_than"` - `"less_than"` - `"greater_than_or_equals"` - `"less_than_or_equals"` - `"contains"` - `"starts_with"` - `"ends_with"` - `"in"` - `"not_in"` - `value: unknown` Value to compare against the context attribute. Must be an array for `in` and `not_in`; numeric and ISO-8601 datetime strings are accepted by the ordering operators. - `UnionMember1` - `clauses: Array` - `UnionMember0` - `attribute: string` - `operator: "equals" | "not_equals" | "greater_than" | 8 more` - `"equals"` - `"not_equals"` - `"greater_than"` - `"less_than"` - `"greater_than_or_equals"` - `"less_than_or_equals"` - `"contains"` - `"starts_with"` - `"ends_with"` - `"in"` - `"not_in"` - `value: unknown` Value to compare against the context attribute. Must be an array for `in` and `not_in`; numeric and ISO-8601 datetime strings are accepted by the ordering operators. - `UnionMember1` - `clauses: Array` - `UnionMember0` - `attribute: string` - `operator: "equals" | "not_equals" | "greater_than" | 8 more` - `"equals"` - `"not_equals"` - `"greater_than"` - `"less_than"` - `"greater_than_or_equals"` - `"less_than_or_equals"` - `"contains"` - `"starts_with"` - `"ends_with"` - `"in"` - `"not_in"` - `value: unknown` Value to compare against the context attribute. Must be an array for `in` and `not_in`; numeric and ISO-8601 datetime strings are accepted by the ordering operators. - `UnionMember1` - `clauses: Array` - `string | null` - `number` - `boolean` - `Record` - `Array` - `logical_operator: "AND" | "OR"` - `"AND"` - `"OR"` - `logical_operator: "AND" | "OR"` - `"AND"` - `"OR"` - `logical_operator: "AND" | "OR"` - `"AND"` - `"OR"` - `logical_operator: "AND" | "OR"` - `"AND"` - `"OR"` - `logical_operator: "AND" | "OR"` - `"AND"` - `"OR"` - `logical_operator: "AND" | "OR"` - `"AND"` - `"OR"` - `priority: number` Evaluation order; lower numbers are evaluated first. Must be unique across the flag's rules. - `serve_variation: string` Variation served when this rule matches. Must be a key in `variations`. - `rollout?: Rollout` - `percentage: number` Percentage of matching traffic (0–100) served this variation. For multi-way splits, use cumulative upper bounds across rules (e.g. 30, 70, 100). - `attribute?: string` Context attribute used for sticky bucketing. Defaults to `targetingKey`. If absent at evaluation time, bucketing is random per request. - `variations: Record` Map of variation name to value. All values must be the same type (boolean, string, number, or JSON object/array). Each serialized value must be 10KB or smaller. - `string | null` - `number` - `boolean` - `Record` - `Array` - `description?: string | null` - `type?: "boolean" | "string" | "number" | "json"` Value type of the flag's variations. Inferred from the variation values on write, so it may be omitted in requests. - `"boolean"` - `"string"` - `"number"` - `"json"` - `updated_at?: string` - `updated_by?: string` - `diff: Record` - `from?: string | null | number | boolean | 2 more` - `string | null` - `number` - `boolean` - `Record` - `Array` - `to?: string | null | number | boolean | 2 more` - `string | null` - `number` - `boolean` - `Record` - `Array` - `event: "update"` - `"update"` - `flag_key: string` ### Example ```node import Cloudflare from 'cloudflare'; const client = new Cloudflare({ apiToken: process.env['CLOUDFLARE_API_TOKEN'], // This is the default and can be omitted }); // Automatically fetches more pages as needed. for await (const changelogListResponse of client.flagship.apps.flags.changelog.list( 'app_id', 'flag_key', { account_id: 'account_id' }, )) { console.log(changelogListResponse); } ``` #### Response ```json { "errors": [ { "message": "message" } ], "messages": [ { "message": "message" } ], "result": [ { "after": { "default_variation": "x", "enabled": true, "key": "x", "rules": [ { "conditions": [ { "attribute": "x", "operator": "equals", "value": {} } ], "priority": 1, "serve_variation": "x", "rollout": { "percentage": 0, "attribute": "x" } } ], "variations": { "foo": "string" }, "description": "description", "type": "boolean", "updated_at": "updated_at", "updated_by": "updated_by" }, "event": "create", "flag_key": "flag_key" } ], "result_info": { "count": 0, "cursor": "cursor" }, "success": true } ``` ## Domain Types ### Changelog List Response - `ChangelogListResponse = UnionMember0 | UnionMember1 | UnionMember2` - `UnionMember0` - `after: After` - `default_variation: string` Variation served when no rule matches or the flag is disabled. Must be a key in `variations`. - `enabled: boolean` When false, the flag bypasses all rules and always serves `default_variation`. - `key: string` Unique identifier for the flag within an app. Used in all evaluation and SDK calls. - `rules: Array` Targeting rules evaluated in ascending `priority`; the first matching rule wins. An empty array means the flag always serves `default_variation`. - `conditions: Array` Conditions the context must satisfy for this rule to match. An empty array matches all contexts. - `UnionMember0` - `attribute: string` - `operator: "equals" | "not_equals" | "greater_than" | 8 more` - `"equals"` - `"not_equals"` - `"greater_than"` - `"less_than"` - `"greater_than_or_equals"` - `"less_than_or_equals"` - `"contains"` - `"starts_with"` - `"ends_with"` - `"in"` - `"not_in"` - `value: unknown` Value to compare against the context attribute. Must be an array for `in` and `not_in`; numeric and ISO-8601 datetime strings are accepted by the ordering operators. - `UnionMember1` - `clauses: Array` - `UnionMember0` - `attribute: string` - `operator: "equals" | "not_equals" | "greater_than" | 8 more` - `"equals"` - `"not_equals"` - `"greater_than"` - `"less_than"` - `"greater_than_or_equals"` - `"less_than_or_equals"` - `"contains"` - `"starts_with"` - `"ends_with"` - `"in"` - `"not_in"` - `value: unknown` Value to compare against the context attribute. Must be an array for `in` and `not_in`; numeric and ISO-8601 datetime strings are accepted by the ordering operators. - `UnionMember1` - `clauses: Array` - `UnionMember0` - `attribute: string` - `operator: "equals" | "not_equals" | "greater_than" | 8 more` - `"equals"` - `"not_equals"` - `"greater_than"` - `"less_than"` - `"greater_than_or_equals"` - `"less_than_or_equals"` - `"contains"` - `"starts_with"` - `"ends_with"` - `"in"` - `"not_in"` - `value: unknown` Value to compare against the context attribute. Must be an array for `in` and `not_in`; numeric and ISO-8601 datetime strings are accepted by the ordering operators. - `UnionMember1` - `clauses: Array` - `UnionMember0` - `attribute: string` - `operator: "equals" | "not_equals" | "greater_than" | 8 more` - `"equals"` - `"not_equals"` - `"greater_than"` - `"less_than"` - `"greater_than_or_equals"` - `"less_than_or_equals"` - `"contains"` - `"starts_with"` - `"ends_with"` - `"in"` - `"not_in"` - `value: unknown` Value to compare against the context attribute. Must be an array for `in` and `not_in`; numeric and ISO-8601 datetime strings are accepted by the ordering operators. - `UnionMember1` - `clauses: Array` - `UnionMember0` - `attribute: string` - `operator: "equals" | "not_equals" | "greater_than" | 8 more` - `"equals"` - `"not_equals"` - `"greater_than"` - `"less_than"` - `"greater_than_or_equals"` - `"less_than_or_equals"` - `"contains"` - `"starts_with"` - `"ends_with"` - `"in"` - `"not_in"` - `value: unknown` Value to compare against the context attribute. Must be an array for `in` and `not_in`; numeric and ISO-8601 datetime strings are accepted by the ordering operators. - `UnionMember1` - `clauses: Array` - `UnionMember0` - `attribute: string` - `operator: "equals" | "not_equals" | "greater_than" | 8 more` - `"equals"` - `"not_equals"` - `"greater_than"` - `"less_than"` - `"greater_than_or_equals"` - `"less_than_or_equals"` - `"contains"` - `"starts_with"` - `"ends_with"` - `"in"` - `"not_in"` - `value: unknown` Value to compare against the context attribute. Must be an array for `in` and `not_in`; numeric and ISO-8601 datetime strings are accepted by the ordering operators. - `UnionMember1` - `clauses: Array` - `string | null` - `number` - `boolean` - `Record` - `Array` - `logical_operator: "AND" | "OR"` - `"AND"` - `"OR"` - `logical_operator: "AND" | "OR"` - `"AND"` - `"OR"` - `logical_operator: "AND" | "OR"` - `"AND"` - `"OR"` - `logical_operator: "AND" | "OR"` - `"AND"` - `"OR"` - `logical_operator: "AND" | "OR"` - `"AND"` - `"OR"` - `logical_operator: "AND" | "OR"` - `"AND"` - `"OR"` - `priority: number` Evaluation order; lower numbers are evaluated first. Must be unique across the flag's rules. - `serve_variation: string` Variation served when this rule matches. Must be a key in `variations`. - `rollout?: Rollout` - `percentage: number` Percentage of matching traffic (0–100) served this variation. For multi-way splits, use cumulative upper bounds across rules (e.g. 30, 70, 100). - `attribute?: string` Context attribute used for sticky bucketing. Defaults to `targetingKey`. If absent at evaluation time, bucketing is random per request. - `variations: Record` Map of variation name to value. All values must be the same type (boolean, string, number, or JSON object/array). Each serialized value must be 10KB or smaller. - `string | null` - `number` - `boolean` - `Record` - `Array` - `description?: string | null` - `type?: "boolean" | "string" | "number" | "json"` Value type of the flag's variations. Inferred from the variation values on write, so it may be omitted in requests. - `"boolean"` - `"string"` - `"number"` - `"json"` - `updated_at?: string` - `updated_by?: string` - `event: "create"` - `"create"` - `flag_key: string` - `UnionMember1` - `after: After` - `default_variation: string` Variation served when no rule matches or the flag is disabled. Must be a key in `variations`. - `enabled: boolean` When false, the flag bypasses all rules and always serves `default_variation`. - `key: string` Unique identifier for the flag within an app. Used in all evaluation and SDK calls. - `rules: Array` Targeting rules evaluated in ascending `priority`; the first matching rule wins. An empty array means the flag always serves `default_variation`. - `conditions: Array` Conditions the context must satisfy for this rule to match. An empty array matches all contexts. - `UnionMember0` - `attribute: string` - `operator: "equals" | "not_equals" | "greater_than" | 8 more` - `"equals"` - `"not_equals"` - `"greater_than"` - `"less_than"` - `"greater_than_or_equals"` - `"less_than_or_equals"` - `"contains"` - `"starts_with"` - `"ends_with"` - `"in"` - `"not_in"` - `value: unknown` Value to compare against the context attribute. Must be an array for `in` and `not_in`; numeric and ISO-8601 datetime strings are accepted by the ordering operators. - `UnionMember1` - `clauses: Array` - `UnionMember0` - `attribute: string` - `operator: "equals" | "not_equals" | "greater_than" | 8 more` - `"equals"` - `"not_equals"` - `"greater_than"` - `"less_than"` - `"greater_than_or_equals"` - `"less_than_or_equals"` - `"contains"` - `"starts_with"` - `"ends_with"` - `"in"` - `"not_in"` - `value: unknown` Value to compare against the context attribute. Must be an array for `in` and `not_in`; numeric and ISO-8601 datetime strings are accepted by the ordering operators. - `UnionMember1` - `clauses: Array` - `UnionMember0` - `attribute: string` - `operator: "equals" | "not_equals" | "greater_than" | 8 more` - `"equals"` - `"not_equals"` - `"greater_than"` - `"less_than"` - `"greater_than_or_equals"` - `"less_than_or_equals"` - `"contains"` - `"starts_with"` - `"ends_with"` - `"in"` - `"not_in"` - `value: unknown` Value to compare against the context attribute. Must be an array for `in` and `not_in`; numeric and ISO-8601 datetime strings are accepted by the ordering operators. - `UnionMember1` - `clauses: Array` - `UnionMember0` - `attribute: string` - `operator: "equals" | "not_equals" | "greater_than" | 8 more` - `"equals"` - `"not_equals"` - `"greater_than"` - `"less_than"` - `"greater_than_or_equals"` - `"less_than_or_equals"` - `"contains"` - `"starts_with"` - `"ends_with"` - `"in"` - `"not_in"` - `value: unknown` Value to compare against the context attribute. Must be an array for `in` and `not_in`; numeric and ISO-8601 datetime strings are accepted by the ordering operators. - `UnionMember1` - `clauses: Array` - `UnionMember0` - `attribute: string` - `operator: "equals" | "not_equals" | "greater_than" | 8 more` - `"equals"` - `"not_equals"` - `"greater_than"` - `"less_than"` - `"greater_than_or_equals"` - `"less_than_or_equals"` - `"contains"` - `"starts_with"` - `"ends_with"` - `"in"` - `"not_in"` - `value: unknown` Value to compare against the context attribute. Must be an array for `in` and `not_in`; numeric and ISO-8601 datetime strings are accepted by the ordering operators. - `UnionMember1` - `clauses: Array` - `UnionMember0` - `attribute: string` - `operator: "equals" | "not_equals" | "greater_than" | 8 more` - `"equals"` - `"not_equals"` - `"greater_than"` - `"less_than"` - `"greater_than_or_equals"` - `"less_than_or_equals"` - `"contains"` - `"starts_with"` - `"ends_with"` - `"in"` - `"not_in"` - `value: unknown` Value to compare against the context attribute. Must be an array for `in` and `not_in`; numeric and ISO-8601 datetime strings are accepted by the ordering operators. - `UnionMember1` - `clauses: Array` - `string | null` - `number` - `boolean` - `Record` - `Array` - `logical_operator: "AND" | "OR"` - `"AND"` - `"OR"` - `logical_operator: "AND" | "OR"` - `"AND"` - `"OR"` - `logical_operator: "AND" | "OR"` - `"AND"` - `"OR"` - `logical_operator: "AND" | "OR"` - `"AND"` - `"OR"` - `logical_operator: "AND" | "OR"` - `"AND"` - `"OR"` - `logical_operator: "AND" | "OR"` - `"AND"` - `"OR"` - `priority: number` Evaluation order; lower numbers are evaluated first. Must be unique across the flag's rules. - `serve_variation: string` Variation served when this rule matches. Must be a key in `variations`. - `rollout?: Rollout` - `percentage: number` Percentage of matching traffic (0–100) served this variation. For multi-way splits, use cumulative upper bounds across rules (e.g. 30, 70, 100). - `attribute?: string` Context attribute used for sticky bucketing. Defaults to `targetingKey`. If absent at evaluation time, bucketing is random per request. - `variations: Record` Map of variation name to value. All values must be the same type (boolean, string, number, or JSON object/array). Each serialized value must be 10KB or smaller. - `string | null` - `number` - `boolean` - `Record` - `Array` - `description?: string | null` - `type?: "boolean" | "string" | "number" | "json"` Value type of the flag's variations. Inferred from the variation values on write, so it may be omitted in requests. - `"boolean"` - `"string"` - `"number"` - `"json"` - `updated_at?: string` - `updated_by?: string` - `event: "delete"` - `"delete"` - `flag_key: string` - `UnionMember2` - `after: After` - `default_variation: string` Variation served when no rule matches or the flag is disabled. Must be a key in `variations`. - `enabled: boolean` When false, the flag bypasses all rules and always serves `default_variation`. - `key: string` Unique identifier for the flag within an app. Used in all evaluation and SDK calls. - `rules: Array` Targeting rules evaluated in ascending `priority`; the first matching rule wins. An empty array means the flag always serves `default_variation`. - `conditions: Array` Conditions the context must satisfy for this rule to match. An empty array matches all contexts. - `UnionMember0` - `attribute: string` - `operator: "equals" | "not_equals" | "greater_than" | 8 more` - `"equals"` - `"not_equals"` - `"greater_than"` - `"less_than"` - `"greater_than_or_equals"` - `"less_than_or_equals"` - `"contains"` - `"starts_with"` - `"ends_with"` - `"in"` - `"not_in"` - `value: unknown` Value to compare against the context attribute. Must be an array for `in` and `not_in`; numeric and ISO-8601 datetime strings are accepted by the ordering operators. - `UnionMember1` - `clauses: Array` - `UnionMember0` - `attribute: string` - `operator: "equals" | "not_equals" | "greater_than" | 8 more` - `"equals"` - `"not_equals"` - `"greater_than"` - `"less_than"` - `"greater_than_or_equals"` - `"less_than_or_equals"` - `"contains"` - `"starts_with"` - `"ends_with"` - `"in"` - `"not_in"` - `value: unknown` Value to compare against the context attribute. Must be an array for `in` and `not_in`; numeric and ISO-8601 datetime strings are accepted by the ordering operators. - `UnionMember1` - `clauses: Array` - `UnionMember0` - `attribute: string` - `operator: "equals" | "not_equals" | "greater_than" | 8 more` - `"equals"` - `"not_equals"` - `"greater_than"` - `"less_than"` - `"greater_than_or_equals"` - `"less_than_or_equals"` - `"contains"` - `"starts_with"` - `"ends_with"` - `"in"` - `"not_in"` - `value: unknown` Value to compare against the context attribute. Must be an array for `in` and `not_in`; numeric and ISO-8601 datetime strings are accepted by the ordering operators. - `UnionMember1` - `clauses: Array` - `UnionMember0` - `attribute: string` - `operator: "equals" | "not_equals" | "greater_than" | 8 more` - `"equals"` - `"not_equals"` - `"greater_than"` - `"less_than"` - `"greater_than_or_equals"` - `"less_than_or_equals"` - `"contains"` - `"starts_with"` - `"ends_with"` - `"in"` - `"not_in"` - `value: unknown` Value to compare against the context attribute. Must be an array for `in` and `not_in`; numeric and ISO-8601 datetime strings are accepted by the ordering operators. - `UnionMember1` - `clauses: Array` - `UnionMember0` - `attribute: string` - `operator: "equals" | "not_equals" | "greater_than" | 8 more` - `"equals"` - `"not_equals"` - `"greater_than"` - `"less_than"` - `"greater_than_or_equals"` - `"less_than_or_equals"` - `"contains"` - `"starts_with"` - `"ends_with"` - `"in"` - `"not_in"` - `value: unknown` Value to compare against the context attribute. Must be an array for `in` and `not_in`; numeric and ISO-8601 datetime strings are accepted by the ordering operators. - `UnionMember1` - `clauses: Array` - `UnionMember0` - `attribute: string` - `operator: "equals" | "not_equals" | "greater_than" | 8 more` - `"equals"` - `"not_equals"` - `"greater_than"` - `"less_than"` - `"greater_than_or_equals"` - `"less_than_or_equals"` - `"contains"` - `"starts_with"` - `"ends_with"` - `"in"` - `"not_in"` - `value: unknown` Value to compare against the context attribute. Must be an array for `in` and `not_in`; numeric and ISO-8601 datetime strings are accepted by the ordering operators. - `UnionMember1` - `clauses: Array` - `string | null` - `number` - `boolean` - `Record` - `Array` - `logical_operator: "AND" | "OR"` - `"AND"` - `"OR"` - `logical_operator: "AND" | "OR"` - `"AND"` - `"OR"` - `logical_operator: "AND" | "OR"` - `"AND"` - `"OR"` - `logical_operator: "AND" | "OR"` - `"AND"` - `"OR"` - `logical_operator: "AND" | "OR"` - `"AND"` - `"OR"` - `logical_operator: "AND" | "OR"` - `"AND"` - `"OR"` - `priority: number` Evaluation order; lower numbers are evaluated first. Must be unique across the flag's rules. - `serve_variation: string` Variation served when this rule matches. Must be a key in `variations`. - `rollout?: Rollout` - `percentage: number` Percentage of matching traffic (0–100) served this variation. For multi-way splits, use cumulative upper bounds across rules (e.g. 30, 70, 100). - `attribute?: string` Context attribute used for sticky bucketing. Defaults to `targetingKey`. If absent at evaluation time, bucketing is random per request. - `variations: Record` Map of variation name to value. All values must be the same type (boolean, string, number, or JSON object/array). Each serialized value must be 10KB or smaller. - `string | null` - `number` - `boolean` - `Record` - `Array` - `description?: string | null` - `type?: "boolean" | "string" | "number" | "json"` Value type of the flag's variations. Inferred from the variation values on write, so it may be omitted in requests. - `"boolean"` - `"string"` - `"number"` - `"json"` - `updated_at?: string` - `updated_by?: string` - `diff: Record` - `from?: string | null | number | boolean | 2 more` - `string | null` - `number` - `boolean` - `Record` - `Array` - `to?: string | null | number | boolean | 2 more` - `string | null` - `number` - `boolean` - `Record` - `Array` - `event: "update"` - `"update"` - `flag_key: string` # Evaluate ## Evaluate flag `client.flagship.apps.evaluate.get(stringappId, EvaluateGetParamsparams, RequestOptionsoptions?): EvaluateGetResponse` **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. ### Parameters - `appId: string` App identifier. - `params: EvaluateGetParams` - `account_id: string` Path param: Cloudflare account ID. - `flagKey: string` Query param: The flag key to evaluate. - `targetingKey?: string` Query param: Context targeting key (per OpenFeature spec); used for percentage rollout bucketing. ### Returns - `EvaluateGetResponse` - `flagKey: string` - `reason: "TARGETING_MATCH" | "DEFAULT" | "DISABLED" | "SPLIT"` - `"TARGETING_MATCH"` - `"DEFAULT"` - `"DISABLED"` - `"SPLIT"` - `variant: string` - `value?: string | null | number | boolean | 2 more` - `string | null` - `number` - `boolean` - `Record` - `Array` ### Example ```node import Cloudflare from 'cloudflare'; const client = new Cloudflare({ apiToken: process.env['CLOUDFLARE_API_TOKEN'], // This is the default and can be omitted }); const evaluate = await client.flagship.apps.evaluate.get('app_id', { account_id: 'account_id', flagKey: 'flagKey', }); console.log(evaluate.flagKey); ``` #### Response ```json { "flagKey": "flagKey", "reason": "TARGETING_MATCH", "variant": "variant", "value": "string" } ``` ## Domain Types ### Evaluate Get Response - `EvaluateGetResponse` - `flagKey: string` - `reason: "TARGETING_MATCH" | "DEFAULT" | "DISABLED" | "SPLIT"` - `"TARGETING_MATCH"` - `"DEFAULT"` - `"DISABLED"` - `"SPLIT"` - `variant: string` - `value?: string | null | number | boolean | 2 more` - `string | null` - `number` - `boolean` - `Record` - `Array`