---
description: Ship features safely with Flagship, Cloudflare's feature flag service for controlling feature visibility without redeploying code.
title: Cloudflare Flagship
image: https://developers.cloudflare.com/og-docs.png
---

[Skip to content](#main-content)

> Documentation Index  
> Fetch the complete documentation index at: https://developers.cloudflare.com/flagship/llms.txt  
> Use this file to discover all available pages before exploring further.

# Cloudflare Flagship

Last updated Jun 30, 2026|Copy as Markdown|[View as Markdown](https://developers.cloudflare.com/flagship/index.md)|[Agent setup](https://developers.cloudflare.com/agent-setup/)

Ship features safely with feature flags.

Flagship is Cloudflare's feature flag service. It lets you control feature visibility in your applications without redeploying code. Define flags with targeting rules and percentage-based rollouts, then evaluate them directly inside your Workers through a [native binding](https://developers.cloudflare.com/flagship/binding/) or from server and browser applications with [OpenFeature SDKs](https://developers.cloudflare.com/flagship/sdk/).

[OpenFeature ↗](https://openfeature.dev/) is the CNCF open standard for feature flag management. Flagship ships official SDKs for TypeScript (Workers, Node.js, and browsers), Python, and Go. You can swap providers without changing evaluation code.

Check out the [Get started guide](https://developers.cloudflare.com/flagship/get-started/) to create your first feature flag.

## Features

[Worker binding](https://developers.cloudflare.com/flagship/binding/)

Evaluate flags with a native Workers binding. Type-safe methods with automatic fallback to defaults.

Binding reference

[OpenFeature SDK](https://developers.cloudflare.com/flagship/sdk/)

Use the official OpenFeature SDKs to evaluate flags from Workers, Node.js, browsers, Python, and Go server applications. Switch from another flag provider by changing one line of configuration.

View SDK docs

[Targeting rules](https://developers.cloudflare.com/flagship/targeting/)

Serve different flag values based on user attributes. Rules support 11 comparison operators, logical AND/OR grouping, and sequential evaluation.

Learn about targeting

[Percentage rollouts](https://developers.cloudflare.com/flagship/targeting/percentage-rollouts/)

Gradually release features to a percentage of users. Consistent hashing ensures the same user always receives the same flag value.

Learn about rollouts

[Multi-type variants](https://developers.cloudflare.com/flagship/concepts/)

Flag variants can be booleans, strings, numbers, or structured JSON values. Use JSON variants to deliver entire configuration blocks as a single flag.

Use Multi-type variants

[Flag management](https://developers.cloudflare.com/flagship/get-started/)

Create, update, and delete flags through the Cloudflare dashboard. Organize flags into apps that map to your projects or services.

Use Flag management

---

## Related products

[Workers](https://developers.cloudflare.com/workers/)

Build serverless applications on Cloudflare's global network. Flagship integrates natively with Workers through a binding.

[KV](https://developers.cloudflare.com/kv/)

Store key-value data across Cloudflare's global network. Flagship uses this infrastructure to deliver flag configurations.

## More resources

### [Developer Discord](https://discord.cloudflare.com)

Connect with the Workers community on Discord to ask questions, show what you are building, and discuss the platform with other developers.

### [@CloudflareDev](https://x.com/cloudflaredev)

Follow @CloudflareDev on Twitter to learn about product announcements and what is new in Cloudflare Workers.

Was this helpful?

YesNo

## On this page

[![](https://developers.cloudflare.com/_astro/logo.te5VL_aD.svg)Docs](https://developers.cloudflare.com/)

```json
{"@context":"https://schema.org","@type":"WebPage","@id":"https://developers.cloudflare.com/flagship/#page","headline":"Overview · Cloudflare Flagship docs","description":"Ship features safely with Flagship, Cloudflare's feature flag service for controlling feature visibility without redeploying code.","url":"https://developers.cloudflare.com/flagship/","inLanguage":"en","image":"https://developers.cloudflare.com/og-docs.png","dateModified":"2026-06-30","publisher":{"@type":"Organization","name":"Cloudflare","description":"One platform for your apps, agents, and workforce. Build, secure, and scale without managing infrastructure","url":"https://www.cloudflare.com/","sameAs":["https://github.com/cloudflare","https://www.linkedin.com/company/cloudflare","https://x.com/cloudflare"],"logo":{"@type":"ImageObject","url":"https://developers.cloudflare.com/logo.svg"},"address":{"@type":"PostalAddress","streetAddress":"101 Townsend St","addressLocality":"San Francisco","addressRegion":"CA","postalCode":"94107","addressCountry":"US"},"contactPoint":[{"@type":"ContactPoint","contactType":"Customer Support","url":"https://support.cloudflare.com/","availableLanguage":["English"]},{"@type":"ContactPoint","contactType":"Sales","url":"https://www.cloudflare.com/contact/","availableLanguage":["English"]}]},"isPartOf":{"@type":"WebSite","@id":"https://developers.cloudflare.com/#website","name":"Cloudflare Docs","url":"https://developers.cloudflare.com/"}}
```

---

---
description: Create your first Flagship feature flag and evaluate it inside a Cloudflare Worker using the binding API.
title: Get started
image: https://developers.cloudflare.com/og-docs.png
---

[Skip to content](#main-content)

> Documentation Index  
> Fetch the complete documentation index at: https://developers.cloudflare.com/flagship/llms.txt  
> Use this file to discover all available pages before exploring further.

# Get started

Last updated Aug 26, 2026|Copy as Markdown|[View as Markdown](https://developers.cloudflare.com/flagship/get-started/index.md)|[Agent setup](https://developers.cloudflare.com/agent-setup/)

In this guide, you will create a feature flag in Flagship and evaluate it inside a Cloudflare Worker.

## Create an app and a flag

In this example, you will create a boolean flag called `new-checkout` that controls whether users see a new checkout experience.

1. Log in to the [Cloudflare dashboard ↗](https://dash.cloudflare.com/) and select your account.
2. Go to **Compute** \> **Flagship**.
3. Select **Create app**. Give the app a name that matches your project or service (for example, `checkout-service`).
4. Inside the app, select **Create flag**.
5. Create a boolean flag with the key `new-checkout`. Optionally, add [targeting rules](https://developers.cloudflare.com/flagship/targeting/) to control who sees the flag.
6. Turn on the flag and select **Save**.

## Add the Flagship binding to your Worker

Add the Flagship binding in your Wrangler configuration file so your Worker can evaluate flags through a binding.

```jsonc
{
	"flagship": [
		{
			"binding": "FLAGS",
			"app_id": "<APP_ID>",
		},
	],
}
```

```toml
[[flagship]]
binding = "FLAGS"
app_id = "<APP_ID>"
```

Replace `<APP_ID>` with the app ID shown in the [Cloudflare dashboard ↗](https://dash.cloudflare.com/?to=/:account/flagship). The `binding` field sets the name you use to access Flagship in your Worker code. In this example, the binding is available as `env.FLAGS`.

After updating the Wrangler configuration, run `npx wrangler types` to generate TypeScript types for the binding.

## Evaluate the flag in your Worker

Use the `env.FLAGS` binding to evaluate the flag. The binding provides type-safe methods that return the flag value and fall back to the default you provide if evaluation fails.

```js
export default {
	async fetch(request, env) {
		const url = new URL(request.url);
		const userId = url.searchParams.get("userId") ?? "anonymous";

		const showNewCheckout = await env.FLAGS.getBooleanValue(
			"new-checkout",
			false,
			{ userId },
		);

		if (showNewCheckout) {
			return new Response("Welcome to the new checkout experience!");
		}

		return new Response("Standard checkout.");
	},
};
```

```ts
export default {
	async fetch(request: Request, env: Env): Promise<Response> {
		const url = new URL(request.url);
		const userId = url.searchParams.get("userId") ?? "anonymous";

		const showNewCheckout = await env.FLAGS.getBooleanValue(
			"new-checkout",
			false,
			{ userId },
		);

		if (showNewCheckout) {
			return new Response("Welcome to the new checkout experience!");
		}

		return new Response("Standard checkout.");
	},
};
```

The third argument to `getBooleanValue` is the [evaluation context](https://developers.cloudflare.com/flagship/concepts/#evaluation-context). Flagship uses the context attributes to match targeting rules. In this example, the `userId` attribute is passed so that percentage rollouts and user-specific targeting work correctly.

## Deploy and test

Deploy your Worker:

```sh
npx wrangler deploy
```

Test flag evaluation by sending a request:

```sh
curl "https://<YOUR_WORKER>.<YOUR_SUBDOMAIN>.workers.dev/?userId=user-42"
```

Change the flag value or targeting rules in the dashboard and observe the updated response. Flag changes propagate globally within seconds.

## (Optional) Use the OpenFeature SDK

If you prefer the [OpenFeature ↗](https://openfeature.dev/) standard interface, or if you are running outside of a Cloudflare Worker, you can use the [@cloudflare/flagship ↗](https://www.npmjs.com/package/@cloudflare/flagship) SDK instead of the binding.

Install the SDK:

npmyarnpnpmbun

```
npm i @cloudflare/flagship @openfeature/server-sdk
```

```
yarn add @cloudflare/flagship @openfeature/server-sdk
```

```
pnpm add @cloudflare/flagship @openfeature/server-sdk
```

```
bun add @cloudflare/flagship @openfeature/server-sdk
```

Evaluate flags using the OpenFeature client:

Pass the Flagship binding directly to the provider. This avoids additional HTTP overhead and is the recommended approach inside a Worker. The binding handles authentication automatically.

```js
import { OpenFeature } from "@openfeature/server-sdk";
import { FlagshipServerProvider } from "@cloudflare/flagship/server";

export default {
	async fetch(request, env) {
		await OpenFeature.setProviderAndWait(
			new FlagshipServerProvider({ binding: env.FLAGS }),
		);

		const client = OpenFeature.getClient();

		const showNewCheckout = await client.getBooleanValue(
			"new-checkout",
			false,
			{ targetingKey: "user-42" },
		);

		return new Response(
			showNewCheckout ? "New checkout!" : "Standard checkout.",
		);
	},
};
```

```ts
import { OpenFeature } from "@openfeature/server-sdk";
import { FlagshipServerProvider } from "@cloudflare/flagship/server";

export default {
	async fetch(request: Request, env: Env): Promise<Response> {
		await OpenFeature.setProviderAndWait(
			new FlagshipServerProvider({ binding: env.FLAGS }),
		);

		const client = OpenFeature.getClient();

		const showNewCheckout = await client.getBooleanValue(
			"new-checkout",
			false,
			{ targetingKey: "user-42" },
		);

		return new Response(
			showNewCheckout ? "New checkout!" : "Standard checkout.",
		);
	},
};
```

Use an app ID, account ID, and an API token when running outside of a Worker (for example, in Node.js). Generate an [API token](https://developers.cloudflare.com/flagship/api-tokens/) from your Cloudflare account with Flagship Evaluate or Flagship App Evaluate permission.

```js
import { OpenFeature } from "@openfeature/server-sdk";
import { FlagshipServerProvider } from "@cloudflare/flagship/server";

await OpenFeature.setProviderAndWait(
	new FlagshipServerProvider({
		appId: "<APP_ID>",
		accountId: "<ACCOUNT_ID>",
		authToken: "<API_TOKEN>",
	}),
);

const client = OpenFeature.getClient();

const showNewCheckout = await client.getBooleanValue("new-checkout", false, {
	targetingKey: "user-42",
});
```

```ts
import { OpenFeature } from "@openfeature/server-sdk";
import { FlagshipServerProvider } from "@cloudflare/flagship/server";

await OpenFeature.setProviderAndWait(
	new FlagshipServerProvider({
		appId: "<APP_ID>",
		accountId: "<ACCOUNT_ID>",
		authToken: "<API_TOKEN>",
	}),
);

const client = OpenFeature.getClient();

const showNewCheckout = await client.getBooleanValue("new-checkout", false, {
	targetingKey: "user-42",
});
```

Refer to the [SDK documentation](https://developers.cloudflare.com/flagship/sdk/) for detailed setup instructions.

## Next steps

* Manage flags from the command line with the [wrangler flagship commands](https://developers.cloudflare.com/flagship/reference/wrangler-commands/).
* Learn about [targeting rules](https://developers.cloudflare.com/flagship/targeting/) to serve different values based on user attributes.
* Explore the full [binding API reference](https://developers.cloudflare.com/flagship/binding/) for all evaluation methods.
* Read about [percentage rollouts](https://developers.cloudflare.com/flagship/targeting/percentage-rollouts/) for gradual feature releases.
* Create an [API token](https://developers.cloudflare.com/flagship/api-tokens/) to evaluate flags from a server-side environment.
* Refer to the [Flagship API reference](https://developers.cloudflare.com/flagship/reference/api-reference/) to manage Flagship programmatically.

Was this helpful?

YesNo

## On this page

[![](https://developers.cloudflare.com/_astro/logo.te5VL_aD.svg)Docs](https://developers.cloudflare.com/)

```json
{"@context":"https://schema.org","@type":"TechArticle","@id":"https://developers.cloudflare.com/flagship/get-started/#page","headline":"Get started · Cloudflare Flagship docs","description":"Create your first Flagship feature flag and evaluate it inside a Cloudflare Worker using the binding API.","url":"https://developers.cloudflare.com/flagship/get-started/","inLanguage":"en","image":"https://developers.cloudflare.com/og-docs.png","dateModified":"2026-08-26","publisher":{"@type":"Organization","name":"Cloudflare","description":"One platform for your apps, agents, and workforce. Build, secure, and scale without managing infrastructure","url":"https://www.cloudflare.com/","sameAs":["https://github.com/cloudflare","https://www.linkedin.com/company/cloudflare","https://x.com/cloudflare"],"logo":{"@type":"ImageObject","url":"https://developers.cloudflare.com/logo.svg"},"address":{"@type":"PostalAddress","streetAddress":"101 Townsend St","addressLocality":"San Francisco","addressRegion":"CA","postalCode":"94107","addressCountry":"US"},"contactPoint":[{"@type":"ContactPoint","contactType":"Customer Support","url":"https://support.cloudflare.com/","availableLanguage":["English"]},{"@type":"ContactPoint","contactType":"Sales","url":"https://www.cloudflare.com/contact/","availableLanguage":["English"]}]},"isPartOf":{"@type":"WebSite","@id":"https://developers.cloudflare.com/#website","name":"Cloudflare Docs","url":"https://developers.cloudflare.com/"}}
```

---

---
description: Understand Flagship core concepts including apps, flags, variants, targeting rules, evaluation context, and flag propagation.
title: Concepts
image: https://developers.cloudflare.com/og-docs.png
---

[Skip to content](#main-content)

> Documentation Index  
> Fetch the complete documentation index at: https://developers.cloudflare.com/flagship/llms.txt  
> Use this file to discover all available pages before exploring further.

# Concepts

Last updated Jun 24, 2026|Copy as Markdown|[View as Markdown](https://developers.cloudflare.com/flagship/concepts/index.md)|[Agent setup](https://developers.cloudflare.com/agent-setup/)

Flagship organizes feature flags into apps. You define flags with variants and targeting rules, then evaluate them within Cloudflare's global network.

## Overview

Flagship feature flags go through three stages from creation to evaluation:

1. **Configure** — Create flags and targeting rules in the [Cloudflare dashboard ↗](https://dash.cloudflare.com/) or through the [API](https://developers.cloudflare.com/api/resources/flagship).
2. **Propagate** — Flagship automatically distributes your flag configuration across Cloudflare's global network within seconds.
3. **Evaluate** — Your Worker (or SDK) evaluates flags locally using the propagated configuration. There is no round-trip to a central server.

Flag changes take effect globally within seconds of saving. You do not need to redeploy your Worker or restart your application. If the dashboard is temporarily unavailable, flag evaluation continues to work using the last propagated configuration.

## Apps

An app is the top-level organizational unit in Flagship. It groups related flags together.

An app typically maps to a single project, service, or product surface. Each Cloudflare account can have multiple apps. For example, you might create one app for your marketing site and another for your API backend.

## Flags

A flag is a named feature toggle. Each flag has a key, a set of [variants](#variants), [targeting rules](#targeting-rules), and an enabled/disabled state.

Flag keys must be unique within an app. Keys can contain letters, numbers, hyphens, and underscores.

When a flag is disabled, it always returns the default variant regardless of any targeting rules. Choose a default variant that is safe for your application if Flagship cannot evaluate the flag.

## Variants

Variants are the possible values a flag can return. Each flag must have at least one variant, and one variant is designated as the default.

Flagship supports four variant types:

| Type    | Example                                                               |
| ------- | --------------------------------------------------------------------- |
| Boolean | on: true, off: false                                                  |
| String  | v1: "old-checkout", v2: "new-checkout"                                |
| Number  | low: 100, high: 1000                                                  |
| JSON    | premium: { "tier": "premium", "features": \["analytics", "export"\] } |

Use boolean flags for simple on/off toggles. Use string, number, or JSON flags when you need to deliver configuration values or structured data. JSON variants can contain objects or arrays.

## Targeting rules

Targeting rules control which variant a flag returns for a given request. Rules are evaluated in sequential order, and the first matching rule wins. If no rule matches, the default variant is returned.

Each rule contains:

* **Conditions** that compare an attribute from the [evaluation context](#evaluation-context) against a value using an operator.
* An optional **percentage rollout** that splits traffic across variants.
* A **variant** to serve when the rule matches.

Conditions within a rule can be grouped with `AND`/`OR` operators.

Refer to [Targeting rules](https://developers.cloudflare.com/flagship/targeting/) and [Operators](https://developers.cloudflare.com/flagship/targeting/operators/) for the full list of operators and configuration options.

## Evaluation context

The evaluation context is a set of key-value attributes that describe the current user or request (for example, `userId`, `country`, `plan`).

You pass the context as the third argument to evaluation methods on the binding:

```ts
const value = await env.FLAGS.getBooleanValue("new-checkout", false, {
	userId: "user-42",
	country: "US",
});
```

When using the [OpenFeature SDK](https://developers.cloudflare.com/flagship/sdk/), you pass context through the OpenFeature evaluation context object.

Flagship uses context attributes to match targeting rules and to determine percentage rollout bucketing. A consistent context (for example, the same `userId`) produces the same rollout result on every evaluation.

Avoid sending sensitive data in evaluation context. Only include attributes needed by targeting rules or rollout bucketing.

## Flag propagation

After you change a flag, it can take up to 30 seconds for the updated value to reflect globally. During this propagation window, some evaluations may still return the previous flag value.

Was this helpful?

YesNo

## On this page

[![](https://developers.cloudflare.com/_astro/logo.te5VL_aD.svg)Docs](https://developers.cloudflare.com/)

```json
{"@context":"https://schema.org","@type":"TechArticle","@id":"https://developers.cloudflare.com/flagship/concepts/#page","headline":"Concepts · Cloudflare Flagship docs","description":"Understand Flagship core concepts including apps, flags, variants, targeting rules, evaluation context, and flag propagation.","url":"https://developers.cloudflare.com/flagship/concepts/","inLanguage":"en","image":"https://developers.cloudflare.com/og-docs.png","dateModified":"2026-06-24","publisher":{"@type":"Organization","name":"Cloudflare","description":"One platform for your apps, agents, and workforce. Build, secure, and scale without managing infrastructure","url":"https://www.cloudflare.com/","sameAs":["https://github.com/cloudflare","https://www.linkedin.com/company/cloudflare","https://x.com/cloudflare"],"logo":{"@type":"ImageObject","url":"https://developers.cloudflare.com/logo.svg"},"address":{"@type":"PostalAddress","streetAddress":"101 Townsend St","addressLocality":"San Francisco","addressRegion":"CA","postalCode":"94107","addressCountry":"US"},"contactPoint":[{"@type":"ContactPoint","contactType":"Customer Support","url":"https://support.cloudflare.com/","availableLanguage":["English"]},{"@type":"ContactPoint","contactType":"Sales","url":"https://www.cloudflare.com/contact/","availableLanguage":["English"]}]},"isPartOf":{"@type":"WebSite","@id":"https://developers.cloudflare.com/#website","name":"Cloudflare Docs","url":"https://developers.cloudflare.com/"}}
```

---

---
description: Create account-wide or app-scoped API tokens for Flagship. App-scoped tokens can access only the Flagship apps you select.
title: API tokens
image: https://developers.cloudflare.com/og-docs.png
---

[Skip to content](#main-content)

> Documentation Index  
> Fetch the complete documentation index at: https://developers.cloudflare.com/flagship/llms.txt  
> Use this file to discover all available pages before exploring further.

# API tokens

Last updated Aug 26, 2026|Copy as Markdown|[View as Markdown](https://developers.cloudflare.com/flagship/api-tokens/index.md)|[Agent setup](https://developers.cloudflare.com/agent-setup/)

Flagship supports two kinds of API tokens. Both use the same [Create API token](https://developers.cloudflare.com/fundamentals/api/get-started/create-token/) flow. The difference is the resource the permission policy applies to.

| Token type   | Resource                    | What it can access                |
| ------------ | --------------------------- | --------------------------------- |
| Account-wide | **Entire Account**          | Every Flagship app in the account |
| App-scoped   | **Specified Flagship apps** | Only the Flagship apps you select |

Use an account-wide token when a trusted server-side workflow needs access to every Flagship app. Use an app-scoped token when that workflow should only touch the apps you select — for example, CI or a backend service for one product.

Both token types support **Read**, **Write**, and **Evaluate**. The names change with the resource:

| Access                  | Account-wide          | App-scoped                |
| ----------------------- | --------------------- | ------------------------- |
| Evaluate flags          | **Flagship Evaluate** | **Flagship App Evaluate** |
| Read flag configuration | **Flagship Read**     | **Flagship App Read**     |
| Manage flags            | **Flagship Write**    | **Flagship App Write**    |

You must [create a Flagship app](https://developers.cloudflare.com/flagship/get-started/#create-an-app-and-a-flag) before you can create an app-scoped token. The dashboard can only list apps that already exist.

## Create an account-wide token

[Create an account-wide Flagship token ↗](https://dash.cloudflare.com/?to=/:account/api-tokens) to open the Account API tokens page. Then create a custom token and leave the resource set to **Entire Account**.

To create the token yourself:

1. In the Cloudflare dashboard, go to the **Account API tokens** page.  
[Go to **Account API tokens** ↗](https://dash.cloudflare.com/?to=/:account/api-tokens)  
You can also create a user token from [My Profile ↗](https://dash.cloudflare.com/profile/api-tokens) \> **API Tokens**.
2. Select **Create Token**.
3. Select **Create Custom Token** \> **Get started**.
4. Enter a token name.
5. Under **Permission policies**, leave the resource dropdown set to **Entire Account**.
6. Search for Flagship and select **Flagship Evaluate**, **Flagship Read**, or **Flagship Write**.
7. (Optional) Restrict the token with [IP address filtering or a TTL](https://developers.cloudflare.com/fundamentals/api/how-to/restrict-tokens/).
8. Select **Review token** \> **Create Token**.
9. Copy the token secret and store it securely.

Warning

The token secret is **only shown once**. Do not store the secret in plaintext where others can access it. Anyone with this token can perform the authorized actions against the resources that the token has access to.

## Create an app-scoped token

[Create an app-scoped Flagship token ↗](https://dash.cloudflare.com/?to=/:account/api-tokens&permissionGroupKeys=%5B%7B%22key%22:%22flagship%5Fapp%22,%22type%22:%22evaluate%22%7D%5D&scope=specified%5Fflagship%5Fapp) to open the token form with **Specified Flagship apps** and **Flagship App Evaluate** already selected. Then choose the app and create the token.

To create the token yourself:

1. In the Cloudflare dashboard, go to the **Account API tokens** page.  
[Go to **Account API tokens** ↗](https://dash.cloudflare.com/?to=/:account/api-tokens)  
You can also create a user token from [My Profile ↗](https://dash.cloudflare.com/profile/api-tokens) \> **API Tokens**.
2. Select **Create Token**.
3. Select **Create Custom Token** \> **Get started**.
4. Enter a token name that describes where you will use it, such as `checkout-service-ci`.
5. Under **Permission policies**, open the resource dropdown (it defaults to **Entire Account**) and select **Specified Flagship apps**.
6. In **Select Flagship apps**, choose the app or apps this token should access.
7. Under **Developer Platform**, select a **Flagship App** permission:

| Use case                                      | Permission                |
| --------------------------------------------- | ------------------------- |
| Evaluate flags in the selected apps           | **Flagship App Evaluate** |
| Read flag configuration for the selected apps | **Flagship App Read**     |
| Manage flags in the selected apps             | **Flagship App Write**    |
8. (Optional) Restrict the token with [IP address filtering or a TTL](https://developers.cloudflare.com/fundamentals/api/how-to/restrict-tokens/).
9. Select **Review token** \> **Create Token**.
10. Copy the token secret and store it securely.

Warning

The token secret is **only shown once**. Do not store the secret in plaintext where others can access it. Anyone with this token can perform the authorized actions against the resources that the token has access to.

## Use the token

Pass the token to an OpenFeature SDK as `authToken` (TypeScript) or the equivalent option in [Python](https://developers.cloudflare.com/flagship/sdk/python/) and [Go](https://developers.cloudflare.com/flagship/sdk/go/).

```ts
import { OpenFeature } from "@openfeature/server-sdk";
import { FlagshipServerProvider } from "@cloudflare/flagship/server";

await OpenFeature.setProviderAndWait(
	new FlagshipServerProvider({
		appId: "<APP_ID>",
		accountId: "<ACCOUNT_ID>",
		authToken: "<APP_SCOPED_API_TOKEN>",
	}),
);
```

Replace `<APP_ID>` and `<ACCOUNT_ID>` with the app and account the token is scoped to. An app-scoped token is rejected if you evaluate a different app.

Inside a Cloudflare Worker, prefer the [binding](https://developers.cloudflare.com/flagship/binding/). The binding authenticates automatically and does not need an API token.

## Next steps

* Set up the [TypeScript Server SDK](https://developers.cloudflare.com/flagship/sdk/server-provider/) outside of Workers.
* Restrict token use with [IP filtering or a TTL](https://developers.cloudflare.com/fundamentals/api/how-to/restrict-tokens/).

Was this helpful?

YesNo

## On this page

[![](https://developers.cloudflare.com/_astro/logo.te5VL_aD.svg)Docs](https://developers.cloudflare.com/)

```json
{"@context":"https://schema.org","@type":"TechArticle","@id":"https://developers.cloudflare.com/flagship/api-tokens/#page","headline":"API tokens · Cloudflare Flagship docs","description":"Create account-wide or app-scoped API tokens for Flagship. App-scoped tokens can access only the Flagship apps you select.","url":"https://developers.cloudflare.com/flagship/api-tokens/","inLanguage":"en","image":"https://developers.cloudflare.com/og-docs.png","dateModified":"2026-08-26","publisher":{"@type":"Organization","name":"Cloudflare","description":"One platform for your apps, agents, and workforce. Build, secure, and scale without managing infrastructure","url":"https://www.cloudflare.com/","sameAs":["https://github.com/cloudflare","https://www.linkedin.com/company/cloudflare","https://x.com/cloudflare"],"logo":{"@type":"ImageObject","url":"https://developers.cloudflare.com/logo.svg"},"address":{"@type":"PostalAddress","streetAddress":"101 Townsend St","addressLocality":"San Francisco","addressRegion":"CA","postalCode":"94107","addressCountry":"US"},"contactPoint":[{"@type":"ContactPoint","contactType":"Customer Support","url":"https://support.cloudflare.com/","availableLanguage":["English"]},{"@type":"ContactPoint","contactType":"Sales","url":"https://www.cloudflare.com/contact/","availableLanguage":["English"]}]},"isPartOf":{"@type":"WebSite","@id":"https://developers.cloudflare.com/#website","name":"Cloudflare Docs","url":"https://developers.cloudflare.com/"}}
```

---

---
description: Add and configure a Flagship binding in your Wrangler configuration file to evaluate feature flags in a Worker.
title: Configuration
image: https://developers.cloudflare.com/og-docs.png
---

[Skip to content](#main-content)

> Documentation Index  
> Fetch the complete documentation index at: https://developers.cloudflare.com/flagship/llms.txt  
> Use this file to discover all available pages before exploring further.

# Configuration

Last updated Jun 24, 2026|Copy as Markdown|[View as Markdown](https://developers.cloudflare.com/flagship/configuration/index.md)|[Agent setup](https://developers.cloudflare.com/agent-setup/)

To use Flagship in a Cloudflare Worker, add a Flagship binding to your Wrangler configuration file. The binding gives your Worker access to `env.FLAGS`, which provides methods to evaluate feature flags.

## Add the binding

Add the `flagship` block to your Wrangler configuration file with a binding name and your app ID.

```jsonc
{
	"flagship": [
		{
			"binding": "FLAGS",
			"app_id": "<APP_ID>",
		},
	],
}
```

```toml
[[flagship]]
binding = "FLAGS"
app_id = "<APP_ID>"
```

Replace `<APP_ID>` with the app ID from your Flagship app. If you have not created an app yet, refer to the [Get started guide](https://developers.cloudflare.com/flagship/get-started/#create-an-app-and-a-flag). The `binding` field sets the name you use to access Flagship in your Worker code (for example, `env.FLAGS`).

## Bind to multiple apps

A single Worker can bind to multiple Flagship apps. Use the array form to define more than one binding:

```jsonc
{
	"flagship": [
		{
			"binding": "FLAGS",
			"app_id": "<APP_ID_1>",
		},
		{
			"binding": "EXPERIMENT_FLAGS",
			"app_id": "<APP_ID_2>",
		},
	],
}
```

```toml
[[flagship]]
binding = "FLAGS"
app_id = "<APP_ID_1>"

[[flagship]]
binding = "EXPERIMENT_FLAGS"
app_id = "<APP_ID_2>"
```

Each binding is available as a separate property on the `env` object (for example, `env.FLAGS` and `env.EXPERIMENT_FLAGS`).

## Generate types

After adding the binding, run `npx wrangler types` to generate TypeScript types. This creates the `Env` interface with each binding typed as `Flagship`.

```ts
interface Env {
	FLAGS: Flagship;
	EXPERIMENT_FLAGS: Flagship;
}
```

## Use the binding

Call evaluation methods on `env.FLAGS` to resolve flag values at runtime. Each method accepts a flag key, a default value, and an optional evaluation context.

```js
export default {
	async fetch(request, env) {
		const isEnabled = await env.FLAGS.getBooleanValue("my-feature", false, {
			userId: "user-42",
		});

		return new Response(isEnabled ? "Feature is on" : "Feature is off");
	},
};
```

```ts
export default {
	async fetch(request: Request, env: Env): Promise<Response> {
		const isEnabled = await env.FLAGS.getBooleanValue("my-feature", false, {
			userId: "user-42",
		});

		return new Response(isEnabled ? "Feature is on" : "Feature is off");
	},
};
```

Refer to the [binding API reference](https://developers.cloudflare.com/flagship/binding/) for the full list of methods.

## Local development

Flagship bindings work with `wrangler dev`. Local Workers use the live Flagship app configured by `app_id`. There is no local flag store. Make sure your local Wrangler configuration points to a valid Flagship app before testing evaluations.

Was this helpful?

YesNo

## On this page

[![](https://developers.cloudflare.com/_astro/logo.te5VL_aD.svg)Docs](https://developers.cloudflare.com/)

```json
{"@context":"https://schema.org","@type":"TechArticle","@id":"https://developers.cloudflare.com/flagship/configuration/#page","headline":"Configuration · Cloudflare Flagship docs","description":"Add and configure a Flagship binding in your Wrangler configuration file to evaluate feature flags in a Worker.","url":"https://developers.cloudflare.com/flagship/configuration/","inLanguage":"en","image":"https://developers.cloudflare.com/og-docs.png","dateModified":"2026-06-24","publisher":{"@type":"Organization","name":"Cloudflare","description":"One platform for your apps, agents, and workforce. Build, secure, and scale without managing infrastructure","url":"https://www.cloudflare.com/","sameAs":["https://github.com/cloudflare","https://www.linkedin.com/company/cloudflare","https://x.com/cloudflare"],"logo":{"@type":"ImageObject","url":"https://developers.cloudflare.com/logo.svg"},"address":{"@type":"PostalAddress","streetAddress":"101 Townsend St","addressLocality":"San Francisco","addressRegion":"CA","postalCode":"94107","addressCountry":"US"},"contactPoint":[{"@type":"ContactPoint","contactType":"Customer Support","url":"https://support.cloudflare.com/","availableLanguage":["English"]},{"@type":"ContactPoint","contactType":"Sales","url":"https://www.cloudflare.com/contact/","availableLanguage":["English"]}]},"isPartOf":{"@type":"WebSite","@id":"https://developers.cloudflare.com/#website","name":"Cloudflare Docs","url":"https://developers.cloudflare.com/"}}
```

---

---
description: Best practices for using Flagship in applications, including evaluation paths, rollout workflows, and safe flag cleanup.
title: Best practices
image: https://developers.cloudflare.com/og-docs.png
---

[Skip to content](#main-content)

> Documentation Index  
> Fetch the complete documentation index at: https://developers.cloudflare.com/flagship/llms.txt  
> Use this file to discover all available pages before exploring further.

# Best practices

Last updated Jun 24, 2026|Copy as Markdown|[View as Markdown](https://developers.cloudflare.com/flagship/best-practices/index.md)|[Agent setup](https://developers.cloudflare.com/agent-setup/)

Use these patterns to keep Flagship evaluations predictable, fast, and easy to maintain.

## Choose the right evaluation path

Use the [Workers binding](https://developers.cloudflare.com/flagship/binding/) inside Cloudflare Workers. The binding handles authentication automatically and avoids application-managed API tokens.

Use the [OpenFeature SDK](https://developers.cloudflare.com/flagship/sdk/) when you run outside Workers or need a vendor-neutral OpenFeature interface. In Workers, you can still pass the binding to the OpenFeature server provider to keep binding performance while using OpenFeature APIs.

## Evaluate once per request

Avoid evaluating the same flag repeatedly in a loop. Evaluate the flag once, store the result in a local variable, and reuse it for the rest of the request.

```ts
const enabled = await env.FLAGS.getBooleanValue("show-related-items", false, {
	userId,
});

for (const item of items) {
	if (enabled) {
		item.related = await loadRelatedItems(item.id);
	}
}
```

## Pass context consistently

Targeting and percentage rollouts depend on the evaluation context you pass from your application. Use stable identifiers and the same attribute names everywhere.

```ts
const context = {
	userId: session.user.id,
	plan: session.user.plan,
	country: request.cf?.country ?? "unknown",
};

const enabled = await env.FLAGS.getBooleanValue("new-checkout", false, context);
```

For OpenFeature SDKs, use `targetingKey` as the stable identifier. For the Workers binding, use the attribute configured for your rollout, such as `userId`.

## Choose safe defaults

Every evaluation method requires a default value. Choose a default that keeps your application safe if the flag does not exist, cannot be evaluated, or has a type mismatch.

For release flags, this is usually the existing experience. For configuration flags, choose conservative limits or behavior that your application can handle without extra dependencies.

## Use details for debugging and observability

Use `*Details` methods when you need to understand why a value was returned. Details include the resolved value, variant, reason, and error metadata.

```ts
const details = await env.FLAGS.getBooleanDetails("new-checkout", false, {
	userId: "user-42",
});

console.log(details.value);
console.log(details.variant);
console.log(details.reason);
console.log(details.errorCode);
```

## Roll out progressively

Start with a small percentage rollout, monitor application metrics, then increase the percentage over time.

1. Create the flag with a small rollout, such as 5%.
2. Monitor errors, latency, business metrics, and user feedback.
3. Increase to 25%, then 50%, then 100% as confidence grows.
4. After the rollout reaches 100%, make the winning variant the default and remove temporary targeting rules.
5. After the feature is fully shipped, remove the old code path and delete the flag.

## Clean up stale flags

Flags that are disabled or fully rolled out still add maintenance cost. Before deleting a flag, disable it first, monitor for unexpected behavior, remove the evaluation code, deploy the code change, then delete the flag from Flagship.

Was this helpful?

YesNo

## On this page

[![](https://developers.cloudflare.com/_astro/logo.te5VL_aD.svg)Docs](https://developers.cloudflare.com/)

```json
{"@context":"https://schema.org","@type":"TechArticle","@id":"https://developers.cloudflare.com/flagship/best-practices/#page","headline":"Best practices · Cloudflare Flagship docs","description":"Best practices for using Flagship in applications, including evaluation paths, rollout workflows, and safe flag cleanup.","url":"https://developers.cloudflare.com/flagship/best-practices/","inLanguage":"en","image":"https://developers.cloudflare.com/og-docs.png","dateModified":"2026-06-24","publisher":{"@type":"Organization","name":"Cloudflare","description":"One platform for your apps, agents, and workforce. Build, secure, and scale without managing infrastructure","url":"https://www.cloudflare.com/","sameAs":["https://github.com/cloudflare","https://www.linkedin.com/company/cloudflare","https://x.com/cloudflare"],"logo":{"@type":"ImageObject","url":"https://developers.cloudflare.com/logo.svg"},"address":{"@type":"PostalAddress","streetAddress":"101 Townsend St","addressLocality":"San Francisco","addressRegion":"CA","postalCode":"94107","addressCountry":"US"},"contactPoint":[{"@type":"ContactPoint","contactType":"Customer Support","url":"https://support.cloudflare.com/","availableLanguage":["English"]},{"@type":"ContactPoint","contactType":"Sales","url":"https://www.cloudflare.com/contact/","availableLanguage":["English"]}]},"isPartOf":{"@type":"WebSite","@id":"https://developers.cloudflare.com/#website","name":"Cloudflare Docs","url":"https://developers.cloudflare.com/"}}
```

---

---
description: Evaluate Flagship feature flags directly in Cloudflare Workers using the native binding with type-safe methods and automatic fallback.
title: Binding API
image: https://developers.cloudflare.com/og-docs.png
---

[Skip to content](#main-content)

> Documentation Index  
> Fetch the complete documentation index at: https://developers.cloudflare.com/flagship/llms.txt  
> Use this file to discover all available pages before exploring further.

# Binding API

Last updated Apr 30, 2026|Copy as Markdown|[View as Markdown](https://developers.cloudflare.com/flagship/binding/index.md)|[Agent setup](https://developers.cloudflare.com/agent-setup/)

Workers access Flagship through a binding that you add to your Wrangler configuration file. The `binding` field sets the variable name you use in your Worker code.

```jsonc
{
	"flagship": [
		{
			"binding": "FLAGS",
			"app_id": "<APP_ID>",
		},
	],
}
```

```toml
[[flagship]]
binding = "FLAGS"
app_id = "<APP_ID>"
```

Replace `<APP_ID>` with the app ID from your Flagship app. If you have not created an app yet, refer to the [Get started guide](https://developers.cloudflare.com/flagship/get-started/#create-an-app-and-a-flag). With this configuration, the binding is available as `env.FLAGS`. Refer to [Configuration](https://developers.cloudflare.com/flagship/configuration/) for additional options such as binding to multiple apps.

The binding provides type-safe methods for evaluating feature flags. If an evaluation fails or a flag is not found, the method returns the default value you provide.

```js
export default {
	async fetch(request, env) {
		const enabled = await env.FLAGS.getBooleanValue("new-feature", false, {
			userId: "user-42",
		});
		return new Response(enabled ? "Feature on" : "Feature off");
	},
};
```

```ts
export default {
	async fetch(request: Request, env: Env): Promise<Response> {
		const enabled = await env.FLAGS.getBooleanValue("new-feature", false, {
			userId: "user-42",
		});
		return new Response(enabled ? "Feature on" : "Feature off");
	},
};
```

The binding has the type `Flagship` from the `@cloudflare/workers-types` package.

* [Types](https://developers.cloudflare.com/flagship/binding/types/)
* [Methods](https://developers.cloudflare.com/flagship/binding/methods/)

Was this helpful?

YesNo

## On this page

[![](https://developers.cloudflare.com/_astro/logo.te5VL_aD.svg)Docs](https://developers.cloudflare.com/)

```json
{"@context":"https://schema.org","@type":"WebPage","@id":"https://developers.cloudflare.com/flagship/binding/#page","headline":"Binding API · Cloudflare Flagship docs","description":"Evaluate Flagship feature flags directly in Cloudflare Workers using the native binding with type-safe methods and automatic fallback.","url":"https://developers.cloudflare.com/flagship/binding/","inLanguage":"en","image":"https://developers.cloudflare.com/og-docs.png","dateModified":"2026-04-30","publisher":{"@type":"Organization","name":"Cloudflare","description":"One platform for your apps, agents, and workforce. Build, secure, and scale without managing infrastructure","url":"https://www.cloudflare.com/","sameAs":["https://github.com/cloudflare","https://www.linkedin.com/company/cloudflare","https://x.com/cloudflare"],"logo":{"@type":"ImageObject","url":"https://developers.cloudflare.com/logo.svg"},"address":{"@type":"PostalAddress","streetAddress":"101 Townsend St","addressLocality":"San Francisco","addressRegion":"CA","postalCode":"94107","addressCountry":"US"},"contactPoint":[{"@type":"ContactPoint","contactType":"Customer Support","url":"https://support.cloudflare.com/","availableLanguage":["English"]},{"@type":"ContactPoint","contactType":"Sales","url":"https://www.cloudflare.com/contact/","availableLanguage":["English"]}]},"isPartOf":{"@type":"WebSite","@id":"https://developers.cloudflare.com/#website","name":"Cloudflare Docs","url":"https://developers.cloudflare.com/"}}
```

---

---
description: Reference for all Flagship binding evaluation methods, including typed value and details methods for booleans, strings, numbers, and objects.
title: Methods
image: https://developers.cloudflare.com/og-docs.png
---

[Skip to content](#main-content)

> Documentation Index  
> Fetch the complete documentation index at: https://developers.cloudflare.com/flagship/llms.txt  
> Use this file to discover all available pages before exploring further.

# Methods

Last updated Jun 24, 2026|Copy as Markdown|[View as Markdown](https://developers.cloudflare.com/flagship/binding/methods/index.md)|[Agent setup](https://developers.cloudflare.com/agent-setup/)

The Flagship binding provides the following methods for evaluating feature flags. All methods are asynchronous and return a `Promise`. For known evaluation failures, typed methods return the `defaultValue` you provide.

Refer to the [types reference](https://developers.cloudflare.com/flagship/binding/types/) for the definitions of `FlagshipEvaluationContext` and `FlagshipEvaluationDetails`.

## `get()`

Returns the raw flag value without type checking. Use this method when the flag type is not known at compile time.

If you provide `defaultValue`, `get()` returns that value for known evaluation failures, such as a missing flag. If you omit `defaultValue`, known evaluation failures are thrown.

```ts
get(flagKey: string, defaultValue?: unknown, context?: FlagshipEvaluationContext): Promise<unknown>
```

| Parameter    | Type                      | Required | Description                                                               |
| ------------ | ------------------------- | -------- | ------------------------------------------------------------------------- |
| flagKey      | string                    | Yes      | The key of the flag to evaluate.                                          |
| defaultValue | unknown                   | No       | The fallback value returned if evaluation fails or the flag is not found. |
| context      | FlagshipEvaluationContext | No       | Key-value attributes for targeting rules.                                 |

```ts
const value = await env.FLAGS.get("checkout-flow", "v1", {
	userId: "user-42",
});
```

## `getBooleanValue()`

Returns the flag value as a `boolean`.

```ts
getBooleanValue(flagKey: string, defaultValue: boolean, context?: FlagshipEvaluationContext): Promise<boolean>
```

| Parameter    | Type                      | Required | Description                                                               |
| ------------ | ------------------------- | -------- | ------------------------------------------------------------------------- |
| flagKey      | string                    | Yes      | The key of the flag to evaluate.                                          |
| defaultValue | boolean                   | Yes      | The fallback value returned if evaluation fails or the flag is not found. |
| context      | FlagshipEvaluationContext | No       | Key-value attributes for targeting rules.                                 |

```ts
const enabled = await env.FLAGS.getBooleanValue("dark-mode", false, {
	userId: "user-42",
});
```

## `getStringValue()`

Returns the flag value as a `string`.

```ts
getStringValue(flagKey: string, defaultValue: string, context?: FlagshipEvaluationContext): Promise<string>
```

| Parameter    | Type                      | Required | Description                                                               |
| ------------ | ------------------------- | -------- | ------------------------------------------------------------------------- |
| flagKey      | string                    | Yes      | The key of the flag to evaluate.                                          |
| defaultValue | string                    | Yes      | The fallback value returned if evaluation fails or the flag is not found. |
| context      | FlagshipEvaluationContext | No       | Key-value attributes for targeting rules.                                 |

```ts
const variant = await env.FLAGS.getStringValue("checkout-flow", "v1", {
	userId: "user-42",
	country: "US",
});
```

## `getNumberValue()`

Returns the flag value as a `number`.

```ts
getNumberValue(flagKey: string, defaultValue: number, context?: FlagshipEvaluationContext): Promise<number>
```

| Parameter    | Type                      | Required | Description                                                               |
| ------------ | ------------------------- | -------- | ------------------------------------------------------------------------- |
| flagKey      | string                    | Yes      | The key of the flag to evaluate.                                          |
| defaultValue | number                    | Yes      | The fallback value returned if evaluation fails or the flag is not found. |
| context      | FlagshipEvaluationContext | No       | Key-value attributes for targeting rules.                                 |

```ts
const maxRetries = await env.FLAGS.getNumberValue("max-retries", 3, {
	plan: "enterprise",
});
```

## `getObjectValue()`

Returns the flag value as a typed object. Use the generic parameter `T` to specify the expected shape.

```ts
getObjectValue<T extends object>(flagKey: string, defaultValue: T, context?: FlagshipEvaluationContext): Promise<T>
```

| Parameter    | Type                      | Required | Description                                                               |
| ------------ | ------------------------- | -------- | ------------------------------------------------------------------------- |
| flagKey      | string                    | Yes      | The key of the flag to evaluate.                                          |
| defaultValue | T                         | Yes      | The fallback value returned if evaluation fails or the flag is not found. |
| context      | FlagshipEvaluationContext | No       | Key-value attributes for targeting rules.                                 |

```ts
interface ThemeConfig {
	primaryColor: string;
	fontSize: number;
}

const theme = await env.FLAGS.getObjectValue<ThemeConfig>(
	"theme-config",
	{ primaryColor: "#000", fontSize: 14 },
	{ userId: "user-42" },
);
```

## `getBooleanDetails()`

Returns the flag value as a `boolean` with evaluation metadata.

```ts
getBooleanDetails(flagKey: string, defaultValue: boolean, context?: FlagshipEvaluationContext): Promise<FlagshipEvaluationDetails<boolean>>
```

| Parameter    | Type                      | Required | Description                                                               |
| ------------ | ------------------------- | -------- | ------------------------------------------------------------------------- |
| flagKey      | string                    | Yes      | The key of the flag to evaluate.                                          |
| defaultValue | boolean                   | Yes      | The fallback value returned if evaluation fails or the flag is not found. |
| context      | FlagshipEvaluationContext | No       | Key-value attributes for targeting rules.                                 |

```ts
const details = await env.FLAGS.getBooleanDetails("dark-mode", false, {
	userId: "user-42",
});
console.log(details.value); // true
console.log(details.reason); // "TARGETING_MATCH"
```

## `getStringDetails()`

Returns the flag value as a `string` with evaluation metadata.

```ts
getStringDetails(flagKey: string, defaultValue: string, context?: FlagshipEvaluationContext): Promise<FlagshipEvaluationDetails<string>>
```

| Parameter    | Type                      | Required | Description                                                               |
| ------------ | ------------------------- | -------- | ------------------------------------------------------------------------- |
| flagKey      | string                    | Yes      | The key of the flag to evaluate.                                          |
| defaultValue | string                    | Yes      | The fallback value returned if evaluation fails or the flag is not found. |
| context      | FlagshipEvaluationContext | No       | Key-value attributes for targeting rules.                                 |

```ts
const details = await env.FLAGS.getStringDetails("checkout-flow", "v1", {
	userId: "user-42",
});
console.log(details.value); // "v2"
console.log(details.variant); // "new"
console.log(details.reason); // "TARGETING_MATCH"
```

## `getNumberDetails()`

Returns the flag value as a `number` with evaluation metadata.

```ts
getNumberDetails(flagKey: string, defaultValue: number, context?: FlagshipEvaluationContext): Promise<FlagshipEvaluationDetails<number>>
```

| Parameter    | Type                      | Required | Description                                                               |
| ------------ | ------------------------- | -------- | ------------------------------------------------------------------------- |
| flagKey      | string                    | Yes      | The key of the flag to evaluate.                                          |
| defaultValue | number                    | Yes      | The fallback value returned if evaluation fails or the flag is not found. |
| context      | FlagshipEvaluationContext | No       | Key-value attributes for targeting rules.                                 |

```ts
const details = await env.FLAGS.getNumberDetails("max-retries", 3, {
	plan: "enterprise",
});
console.log(details.value); // 5
console.log(details.reason); // "TARGETING_MATCH"
```

## `getObjectDetails()`

Returns the flag value as a typed object with evaluation metadata. Use the generic parameter `T` to specify the expected shape.

```ts
getObjectDetails<T extends object>(flagKey: string, defaultValue: T, context?: FlagshipEvaluationContext): Promise<FlagshipEvaluationDetails<T>>
```

| Parameter    | Type                      | Required | Description                                                               |
| ------------ | ------------------------- | -------- | ------------------------------------------------------------------------- |
| flagKey      | string                    | Yes      | The key of the flag to evaluate.                                          |
| defaultValue | T                         | Yes      | The fallback value returned if evaluation fails or the flag is not found. |
| context      | FlagshipEvaluationContext | No       | Key-value attributes for targeting rules.                                 |

```ts
interface ThemeConfig {
	primaryColor: string;
	fontSize: number;
}

const details = await env.FLAGS.getObjectDetails<ThemeConfig>(
	"theme-config",
	{ primaryColor: "#000", fontSize: 14 },
	{ userId: "user-42" },
);
console.log(details.value); // { primaryColor: "#0051FF", fontSize: 16 }
console.log(details.variant); // "brand-refresh"
```

## Error handling

Typed evaluation methods return the `defaultValue` you provided for known evaluation failures, such as a missing flag or type mismatch. Unexpected runtime failures can still throw. Use the `*Details` methods to inspect known evaluation failures.

### Type mismatch

If you call a typed method on a flag with a different type (for example, `getBooleanValue` on a string flag), the method returns the default value. The `*Details` methods set `errorCode` to `"TYPE_MISMATCH"`.

```ts
// Flag "checkout-flow" is a string flag, but you call getBooleanDetails.
const details = await env.FLAGS.getBooleanDetails("checkout-flow", false);
console.log(details.value); // false (the default value)
console.log(details.errorCode); // "TYPE_MISMATCH"
```

### Evaluation failure

If evaluation fails for another reason, the method returns the default value. The `*Details` methods include an `errorCode` such as `"FLAG_NOT_FOUND"`, `"INVALID_CONTEXT"`, `"PARSE_ERROR"`, or `"GENERAL"`.

```ts
const details = await env.FLAGS.getStringDetails(
	"nonexistent-flag",
	"fallback",
);
console.log(details.value); // "fallback"
console.log(details.errorCode); // "FLAG_NOT_FOUND"
```

## Parameters reference

The following table summarizes the parameters shared across all evaluation methods.

| Parameter    | Type                      | Required         | Description                                                                                   |
| ------------ | ------------------------- | ---------------- | --------------------------------------------------------------------------------------------- |
| flagKey      | string                    | Yes              | The key of the flag to evaluate.                                                              |
| defaultValue | varies                    | Yes (except get) | The fallback value returned if evaluation fails or the flag is not found.                     |
| context      | FlagshipEvaluationContext | No               | Key-value attributes for targeting rules (for example, { userId: "user-42", country: "US" }). |

Was this helpful?

YesNo

## On this page

[![](https://developers.cloudflare.com/_astro/logo.te5VL_aD.svg)Docs](https://developers.cloudflare.com/)

```json
{"@context":"https://schema.org","@type":"TechArticle","@id":"https://developers.cloudflare.com/flagship/binding/methods/#page","headline":"Methods · Cloudflare Flagship docs","description":"Reference for all Flagship binding evaluation methods, including typed value and details methods for booleans, strings, numbers, and objects.","url":"https://developers.cloudflare.com/flagship/binding/methods/","inLanguage":"en","image":"https://developers.cloudflare.com/og-docs.png","dateModified":"2026-06-24","publisher":{"@type":"Organization","name":"Cloudflare","description":"One platform for your apps, agents, and workforce. Build, secure, and scale without managing infrastructure","url":"https://www.cloudflare.com/","sameAs":["https://github.com/cloudflare","https://www.linkedin.com/company/cloudflare","https://x.com/cloudflare"],"logo":{"@type":"ImageObject","url":"https://developers.cloudflare.com/logo.svg"},"address":{"@type":"PostalAddress","streetAddress":"101 Townsend St","addressLocality":"San Francisco","addressRegion":"CA","postalCode":"94107","addressCountry":"US"},"contactPoint":[{"@type":"ContactPoint","contactType":"Customer Support","url":"https://support.cloudflare.com/","availableLanguage":["English"]},{"@type":"ContactPoint","contactType":"Sales","url":"https://www.cloudflare.com/contact/","availableLanguage":["English"]}]},"isPartOf":{"@type":"WebSite","@id":"https://developers.cloudflare.com/#website","name":"Cloudflare Docs","url":"https://developers.cloudflare.com/"}}
```

---

---
description: TypeScript type definitions for the Flagship binding, including Flagship, FlagshipEvaluationContext, and FlagshipEvaluationDetails.
title: Types
image: https://developers.cloudflare.com/og-docs.png
---

[Skip to content](#main-content)

> Documentation Index  
> Fetch the complete documentation index at: https://developers.cloudflare.com/flagship/llms.txt  
> Use this file to discover all available pages before exploring further.

# Types

Last updated Jun 24, 2026|Copy as Markdown|[View as Markdown](https://developers.cloudflare.com/flagship/binding/types/index.md)|[Agent setup](https://developers.cloudflare.com/agent-setup/)

The Flagship binding uses the following TypeScript types. These are available from the `@cloudflare/workers-types` package after running `npx wrangler types`.

## `Flagship`

The binding type. Each Flagship binding in your Wrangler configuration is typed as `Flagship` on the `Env` interface.

```ts
interface Env {
	FLAGS: Flagship;
}
```

Refer to the [methods reference](https://developers.cloudflare.com/flagship/binding/methods/) for the full list of evaluation methods available on the binding.

## `FlagshipEvaluationContext`

A record of attribute names to values passed for [targeting rules](https://developers.cloudflare.com/flagship/targeting/). Use this to provide user attributes such as user ID, country, or plan type.

```ts
type FlagshipEvaluationContext = Record<string, string | number | boolean>;
```

## `FlagshipEvaluationDetails`

Returned by the `*Details` methods. Contains the evaluated value and metadata about how Flagship resolved the flag.

```ts
interface FlagshipEvaluationDetails<T> {
	flagKey: string;
	value: T;
	variant?: string;
	reason?: string;
	errorCode?: string;
}
```

| Property  | Type   | Description                                                                         |
| --------- | ------ | ----------------------------------------------------------------------------------- |
| flagKey   | string | The key of the evaluated flag.                                                      |
| value     | T      | The resolved flag value.                                                            |
| variant   | string | The name of the matched variant, if any.                                            |
| reason    | string | Why the flag resolved to this value (for example, "TARGETING\_MATCH" or "DEFAULT"). |
| errorCode | string | An error code if evaluation failed (for example, "TYPE\_MISMATCH" or "GENERAL").    |

Refer to [evaluation reasons and error codes](https://developers.cloudflare.com/flagship/reference/evaluation-reasons/) for the full list of possible values.

Was this helpful?

YesNo

## On this page

[![](https://developers.cloudflare.com/_astro/logo.te5VL_aD.svg)Docs](https://developers.cloudflare.com/)

```json
{"@context":"https://schema.org","@type":"TechArticle","@id":"https://developers.cloudflare.com/flagship/binding/types/#page","headline":"Types · Cloudflare Flagship docs","description":"TypeScript type definitions for the Flagship binding, including Flagship, FlagshipEvaluationContext, and FlagshipEvaluationDetails.","url":"https://developers.cloudflare.com/flagship/binding/types/","inLanguage":"en","image":"https://developers.cloudflare.com/og-docs.png","dateModified":"2026-06-24","publisher":{"@type":"Organization","name":"Cloudflare","description":"One platform for your apps, agents, and workforce. Build, secure, and scale without managing infrastructure","url":"https://www.cloudflare.com/","sameAs":["https://github.com/cloudflare","https://www.linkedin.com/company/cloudflare","https://x.com/cloudflare"],"logo":{"@type":"ImageObject","url":"https://developers.cloudflare.com/logo.svg"},"address":{"@type":"PostalAddress","streetAddress":"101 Townsend St","addressLocality":"San Francisco","addressRegion":"CA","postalCode":"94107","addressCountry":"US"},"contactPoint":[{"@type":"ContactPoint","contactType":"Customer Support","url":"https://support.cloudflare.com/","availableLanguage":["English"]},{"@type":"ContactPoint","contactType":"Sales","url":"https://www.cloudflare.com/contact/","availableLanguage":["English"]}]},"isPartOf":{"@type":"WebSite","@id":"https://developers.cloudflare.com/#website","name":"Cloudflare Docs","url":"https://developers.cloudflare.com/"}}
```

---

---
description: Use the official Flagship OpenFeature SDKs to evaluate feature flags from Workers, Node.js, browsers, Python, and Go applications.
title: OpenFeature SDK
image: https://developers.cloudflare.com/og-docs.png
---

[Skip to content](#main-content)

> Documentation Index  
> Fetch the complete documentation index at: https://developers.cloudflare.com/flagship/llms.txt  
> Use this file to discover all available pages before exploring further.

# OpenFeature SDK

Last updated Jun 30, 2026|Copy as Markdown|[View as Markdown](https://developers.cloudflare.com/flagship/sdk/index.md)|[Agent setup](https://developers.cloudflare.com/agent-setup/)

Evaluate Flagship feature flags using OpenFeature.

[OpenFeature ↗](https://openfeature.dev/) is the CNCF standard for feature flag interfaces. It provides a vendor-neutral API so you can switch between flag providers without changing evaluation code.

Flagship provides official OpenFeature-compatible SDKs for TypeScript, Python, and Go. The source code is available on [GitHub ↗](https://github.com/cloudflare/flagship).

| SDK        | Package                                                                                               | Runtime                    | Evaluation modes                              |
| ---------- | ----------------------------------------------------------------------------------------------------- | -------------------------- | --------------------------------------------- |
| TypeScript | [@cloudflare/flagship ↗](https://www.npmjs.com/package/@cloudflare/flagship)                          | Workers, Node.js, browsers | Workers binding, HTTP, browser prefetch cache |
| Python     | [cloudflare-flagship ↗](https://pypi.org/project/cloudflare-flagship/)                                | Python server applications | HTTP                                          |
| Go         | [github.com/cloudflare/flagship/sdks/go ↗](https://pkg.go.dev/github.com/cloudflare/flagship/sdks/go) | Go server applications     | HTTP                                          |

## SDKs

Flagship SDKs are organized by language. The TypeScript SDK has separate setup guides for server-side and browser usage because they use different OpenFeature packages and runtime behavior.

* [TypeScript Server SDK](https://developers.cloudflare.com/flagship/sdk/server-provider/) — For Workers, Node.js, and other server-side JavaScript runtimes.
* [TypeScript Client SDK](https://developers.cloudflare.com/flagship/sdk/client-provider/) — For browser applications that need synchronous OpenFeature web SDK evaluation.
* [Python SDK](https://developers.cloudflare.com/flagship/sdk/python/) — For Python server applications.
* [Go SDK](https://developers.cloudflare.com/flagship/sdk/go/) — For Go server applications.

Note

If you are running inside a Cloudflare Worker, the [binding](https://developers.cloudflare.com/flagship/binding/) is the recommended approach because it avoids HTTP overhead. You can also [pass the binding to the OpenFeature SDK](https://developers.cloudflare.com/flagship/sdk/server-provider/) to get the best of both. Use the SDK without a binding when running in non-Worker runtimes like Node.js or the browser.

## Installation

For TypeScript server-side usage:

npmyarnpnpmbun

```
npm i @cloudflare/flagship @openfeature/server-sdk
```

```
yarn add @cloudflare/flagship @openfeature/server-sdk
```

```
pnpm add @cloudflare/flagship @openfeature/server-sdk
```

```
bun add @cloudflare/flagship @openfeature/server-sdk
```

For TypeScript browser usage:

npmyarnpnpmbun

```
npm i @cloudflare/flagship @openfeature/web-sdk
```

```
yarn add @cloudflare/flagship @openfeature/web-sdk
```

```
pnpm add @cloudflare/flagship @openfeature/web-sdk
```

```
bun add @cloudflare/flagship @openfeature/web-sdk
```

For Python:

```sh
uv add cloudflare-flagship
```

For Go:

```sh
go get github.com/cloudflare/flagship/sdks/go
```

## Next steps

* Set up the [server provider](https://developers.cloudflare.com/flagship/sdk/server-provider/) for Workers, Node.js, or other server-side runtimes.
* Set up the [client provider](https://developers.cloudflare.com/flagship/sdk/client-provider/) for browser applications.
* Set up the [Python SDK](https://developers.cloudflare.com/flagship/sdk/python/) for Python server applications.
* Set up the [Go SDK](https://developers.cloudflare.com/flagship/sdk/go/) for Go server applications.

Was this helpful?

YesNo

## On this page

[![](https://developers.cloudflare.com/_astro/logo.te5VL_aD.svg)Docs](https://developers.cloudflare.com/)

```json
{"@context":"https://schema.org","@type":"WebPage","@id":"https://developers.cloudflare.com/flagship/sdk/#page","headline":"OpenFeature SDK · Cloudflare Flagship docs","description":"Use the official Flagship OpenFeature SDKs to evaluate feature flags from Workers, Node.js, browsers, Python, and Go applications.","url":"https://developers.cloudflare.com/flagship/sdk/","inLanguage":"en","image":"https://developers.cloudflare.com/og-docs.png","dateModified":"2026-06-30","publisher":{"@type":"Organization","name":"Cloudflare","description":"One platform for your apps, agents, and workforce. Build, secure, and scale without managing infrastructure","url":"https://www.cloudflare.com/","sameAs":["https://github.com/cloudflare","https://www.linkedin.com/company/cloudflare","https://x.com/cloudflare"],"logo":{"@type":"ImageObject","url":"https://developers.cloudflare.com/logo.svg"},"address":{"@type":"PostalAddress","streetAddress":"101 Townsend St","addressLocality":"San Francisco","addressRegion":"CA","postalCode":"94107","addressCountry":"US"},"contactPoint":[{"@type":"ContactPoint","contactType":"Customer Support","url":"https://support.cloudflare.com/","availableLanguage":["English"]},{"@type":"ContactPoint","contactType":"Sales","url":"https://www.cloudflare.com/contact/","availableLanguage":["English"]}]},"isPartOf":{"@type":"WebSite","@id":"https://developers.cloudflare.com/#website","name":"Cloudflare Docs","url":"https://developers.cloudflare.com/"}}
```

---

---
description: Set up the FlagshipClientProvider to evaluate feature flags synchronously in browser applications using the OpenFeature web SDK.
title: TypeScript Client SDK
image: https://developers.cloudflare.com/og-docs.png
---

[Skip to content](#main-content)

> Documentation Index  
> Fetch the complete documentation index at: https://developers.cloudflare.com/flagship/llms.txt  
> Use this file to discover all available pages before exploring further.

# TypeScript Client SDK

Last updated Aug 26, 2026|Copy as Markdown|[View as Markdown](https://developers.cloudflare.com/flagship/sdk/client-provider/index.md)|[Agent setup](https://developers.cloudflare.com/agent-setup/)

The `FlagshipClientProvider` implements the OpenFeature web provider interface for browser applications. It pre-fetches a declared set of flag values on initialization and resolves evaluations synchronously from an in-memory cache.

This makes the provider suitable for client-side rendering where synchronous access to flag values is required.

Caution

We do not recommend using the client provider in public-facing apps right now. It requires a Cloudflare API token, which would be exposed in client-side code and visible to anyone who inspects your application. We are working on a safer solution for client-side flag evaluation — in the meantime, use the [Worker binding](https://developers.cloudflare.com/flagship/binding/) or the [TypeScript server SDK](https://developers.cloudflare.com/flagship/sdk/server-provider/).

## prefetchFlags

`prefetchFlags` is a required array of flag keys that the provider fetches during initialization and on every context change. Only flags listed in this array are available for synchronous evaluation — any flag key not included returns a `FLAG_NOT_FOUND` error at resolution time.

**Fetch behavior:**

* **On initialization** — all flags in `prefetchFlags` are fetched in parallel and stored in an in-memory cache. The provider transitions to `READY` once all fetches complete (individual failures are non-fatal).
* **On context change** — the cache is invalidated and all flags are re-fetched for the new context. This is required by the [static context paradigm ↗](https://openfeature.dev/specification/glossary/#static-context-paradigm) used by the OpenFeature web SDK, where context is set globally and providers are expected to re-evaluate when it changes.
* **At resolution time** — evaluations are served synchronously from the cache. No network request is made during `getBooleanValue`, `getStringValue`, etc.

## Setup

The following example initializes the provider with a set of pre-fetched flags and evaluates them in a browser application.

```js
import { OpenFeature } from "@openfeature/web-sdk";
import { FlagshipClientProvider } from "@cloudflare/flagship/web";

await OpenFeature.setProviderAndWait(
	new FlagshipClientProvider({
		appId: "<APP_ID>",
		accountId: "<ACCOUNT_ID>",
		authToken: "<API_TOKEN>",
		prefetchFlags: ["promo-banner", "dark-mode", "max-uploads"],
	}),
);

// Set evaluation context globally. The provider re-fetches all prefetchFlags
// whenever the context changes.
await OpenFeature.setContext({ targetingKey: "user-42", plan: "enterprise" });

const client = OpenFeature.getClient();

// Synchronous — served from the in-memory cache.
const showBanner = client.getBooleanValue("promo-banner", false);

if (showBanner) {
	document.getElementById("banner").style.display = "block";
}
```

```ts
import { OpenFeature } from "@openfeature/web-sdk";
import { FlagshipClientProvider } from "@cloudflare/flagship/web";

await OpenFeature.setProviderAndWait(
	new FlagshipClientProvider({
		appId: "<APP_ID>",
		accountId: "<ACCOUNT_ID>",
		authToken: "<API_TOKEN>",
		prefetchFlags: ["promo-banner", "dark-mode", "max-uploads"],
	}),
);

// Set evaluation context globally. The provider re-fetches all prefetchFlags
// whenever the context changes.
await OpenFeature.setContext({ targetingKey: "user-42", plan: "enterprise" });

const client = OpenFeature.getClient();

// Synchronous — served from the in-memory cache.
const showBanner = client.getBooleanValue("promo-banner", false);

if (showBanner) {
	document.getElementById("banner").style.display = "block";
}
```

Note

`getBooleanValue` on the client provider is synchronous and does not require `await`, unlike the [TypeScript server SDK](https://developers.cloudflare.com/flagship/sdk/server-provider/).

## Configuration options

| Option        | Type        | Required | Description                                                                                                                                  |
| ------------- | ----------- | -------- | -------------------------------------------------------------------------------------------------------------------------------------------- |
| appId         | string      | Yes      | The Flagship app ID from the Cloudflare dashboard.                                                                                           |
| accountId     | string      | Yes      | Your Cloudflare account ID.                                                                                                                  |
| authToken     | string      | Yes      | A Cloudflare [API token](https://developers.cloudflare.com/flagship/api-tokens/) with Flagship Evaluate or Flagship App Evaluate permission. |
| fetchOptions  | RequestInit | No       | Custom fetch options applied to HTTP requests.                                                                                               |
| timeout       | number      | No       | Request timeout in milliseconds. Defaults to 5000.                                                                                           |
| retries       | number      | No       | Retry attempts on transient errors. Defaults to 1 and is capped at 10.                                                                       |
| retryDelay    | number      | No       | Delay between retries in milliseconds. Defaults to 1000 and is capped at 30000.                                                              |
| prefetchFlags | string\[\]  | Yes      | Flag keys to fetch on initialization and on every context change. Flags not in this list return FLAG\_NOT\_FOUND at evaluation time.         |

## When to use the client provider

Use the client provider in browser applications, single-page apps, or any client-side JavaScript environment.

Evaluations are synchronous, so they do not block rendering. Flag values are fetched once during initialization and re-fetched whenever the evaluation context changes. To force a refresh, update the context via `OpenFeature.setContext(...)`.

Was this helpful?

YesNo

## On this page

[![](https://developers.cloudflare.com/_astro/logo.te5VL_aD.svg)Docs](https://developers.cloudflare.com/)

```json
{"@context":"https://schema.org","@type":"TechArticle","@id":"https://developers.cloudflare.com/flagship/sdk/client-provider/#page","headline":"TypeScript Client SDK · Cloudflare Flagship docs","description":"Set up the FlagshipClientProvider to evaluate feature flags synchronously in browser applications using the OpenFeature web SDK.","url":"https://developers.cloudflare.com/flagship/sdk/client-provider/","inLanguage":"en","image":"https://developers.cloudflare.com/og-docs.png","dateModified":"2026-08-26","publisher":{"@type":"Organization","name":"Cloudflare","description":"One platform for your apps, agents, and workforce. Build, secure, and scale without managing infrastructure","url":"https://www.cloudflare.com/","sameAs":["https://github.com/cloudflare","https://www.linkedin.com/company/cloudflare","https://x.com/cloudflare"],"logo":{"@type":"ImageObject","url":"https://developers.cloudflare.com/logo.svg"},"address":{"@type":"PostalAddress","streetAddress":"101 Townsend St","addressLocality":"San Francisco","addressRegion":"CA","postalCode":"94107","addressCountry":"US"},"contactPoint":[{"@type":"ContactPoint","contactType":"Customer Support","url":"https://support.cloudflare.com/","availableLanguage":["English"]},{"@type":"ContactPoint","contactType":"Sales","url":"https://www.cloudflare.com/contact/","availableLanguage":["English"]}]},"isPartOf":{"@type":"WebSite","@id":"https://developers.cloudflare.com/#website","name":"Cloudflare Docs","url":"https://developers.cloudflare.com/"}}
```

---

---
description: Set up the Flagship OpenFeature provider to evaluate Flagship feature flags from Go server applications.
title: Go SDK
image: https://developers.cloudflare.com/og-docs.png
---

[Skip to content](#main-content)

> Documentation Index  
> Fetch the complete documentation index at: https://developers.cloudflare.com/flagship/llms.txt  
> Use this file to discover all available pages before exploring further.

# Go SDK

Last updated Aug 26, 2026|Copy as Markdown|[View as Markdown](https://developers.cloudflare.com/flagship/sdk/go/index.md)|[Agent setup](https://developers.cloudflare.com/agent-setup/)

The Go SDK provides an OpenFeature-compatible server provider for Go applications. It evaluates flags over HTTP and does not support the Cloudflare Workers binding.

## Installation

Install with `go get`:

```sh
go get github.com/cloudflare/flagship/sdks/go
```

## Setup

Configure the provider with your Flagship app ID, Cloudflare account ID, and an [API token](https://developers.cloudflare.com/flagship/api-tokens/) with Flagship Evaluate or Flagship App Evaluate permission.

```go
package main

import (
	"context"
	"log"

	flagship "github.com/cloudflare/flagship/sdks/go"
	"github.com/open-feature/go-sdk/openfeature"
)

func main() {
	ctx := context.Background()

	provider, err := flagship.NewProvider(flagship.Options{
		AppID:     "<APP_ID>",
		AccountID: "<ACCOUNT_ID>",
		AuthToken: "<API_TOKEN>",
	})
	if err != nil {
		log.Fatal(err)
	}

	if err := openfeature.SetProviderAndWait(provider); err != nil {
		log.Fatal(err)
	}
	defer openfeature.Shutdown()

	client := openfeature.NewDefaultClient()
	evalCtx := openfeature.NewEvaluationContext("user-42", map[string]any{
		"plan": "enterprise",
	})

	enabled, err := client.BooleanValue(ctx, "new-checkout", false, evalCtx)
	if err != nil {
		log.Fatal(err)
	}

	log.Println("new-checkout:", enabled)
}
```

## Flag types

The Go SDK supports all OpenFeature server-side flag types.

```go
enabled, _ := client.BooleanValue(ctx, "new-checkout", false, evalCtx)
variant, _ := client.StringValue(ctx, "homepage-hero", "control", evalCtx)
rate, _ := client.FloatValue(ctx, "sample-rate", 0.1, evalCtx)
limit, _ := client.IntValue(ctx, "upload-limit", 10, evalCtx)
config, _ := client.ObjectValue(ctx, "ui-config", map[string]any{"theme": "light"}, evalCtx)
```

Use the `*ValueDetails` methods when you need reason, variant, metadata, or error codes.

## Response caching

The provider can cache evaluations to avoid a network round-trip for repeated flag/context pairs. Caching is off by default and enabled by setting `CacheTTL`:

```go
provider, err := flagship.NewProvider(flagship.Options{
	AppID:        "<APP_ID>",
	AccountID:    "<ACCOUNT_ID>",
	AuthToken:    "<API_TOKEN>",
	CacheTTL:     30 * time.Second, // values may be up to this stale
	CacheMaxSize: 1000,             // LRU-evicted beyond this many entries
})
```

Each cache entry is keyed by flag key, flag type, and the full evaluation context, so distinct contexts never share a cached value. Cache hits resolve with `reason == openfeature.CachedReason`.

Disabled flags, errors, and type mismatches are never cached. Because freshness is TTL-based, a flag change in Flagship takes effect after the entry expires.

The cache is per-provider instance, guarded by a mutex for concurrent use, and cleared on `Shutdown`.

## Configuration options

| Option         | Description                                                                                              |
| -------------- | -------------------------------------------------------------------------------------------------------- |
| AppID          | Flagship app ID.                                                                                         |
| AccountID      | Required with AppID.                                                                                     |
| BaseURL        | Base URL override. Defaults to https://api.cloudflare.com.                                               |
| AuthToken      | Adds Authorization: Bearer <token> to each request.                                                      |
| Headers        | Static headers. Explicit Authorization overrides AuthToken.                                              |
| HeadersFactory | Dynamic per-request headers. Values override Headers and AuthToken.                                      |
| HTTPClient     | Custom HTTP client.                                                                                      |
| Timeout        | Per-attempt timeout. Defaults to 5 seconds.                                                              |
| Retries        | Retry attempts on transient errors. Defaults to 1 and is capped at 10.                                   |
| DisableRetries | Disables retries when set to true.                                                                       |
| RetryDelay     | Delay between retries. Defaults to 1 second and is capped at 30 seconds.                                 |
| CacheTTL       | Enables in-memory response caching when greater than 0\. Cached values may be up to this duration stale. |
| CacheMaxSize   | Maximum number of cached entries. LRU-evicted beyond this limit. Defaults to 1000 when CacheTTL is set.  |
| Logging        | Enables debug and error logging. Off by default.                                                         |
| Logger         | Optional slog\-compatible logger. Uses the default slog logger when unset.                               |
| Hooks          | Provider-level OpenFeature hooks.                                                                        |

## Evaluation context

Context attributes are sent as URL query parameters. Supported values are strings, numeric types, booleans, and `time.Time`. `nil` values are skipped. Maps, slices, structs, and other complex values return `INVALID_CONTEXT` through OpenFeature and do not trigger an HTTP request.

Was this helpful?

YesNo

## On this page

[![](https://developers.cloudflare.com/_astro/logo.te5VL_aD.svg)Docs](https://developers.cloudflare.com/)

```json
{"@context":"https://schema.org","@type":"TechArticle","@id":"https://developers.cloudflare.com/flagship/sdk/go/#page","headline":"Go SDK · Cloudflare Flagship docs","description":"Set up the Flagship OpenFeature provider to evaluate Flagship feature flags from Go server applications.","url":"https://developers.cloudflare.com/flagship/sdk/go/","inLanguage":"en","image":"https://developers.cloudflare.com/og-docs.png","dateModified":"2026-08-26","publisher":{"@type":"Organization","name":"Cloudflare","description":"One platform for your apps, agents, and workforce. Build, secure, and scale without managing infrastructure","url":"https://www.cloudflare.com/","sameAs":["https://github.com/cloudflare","https://www.linkedin.com/company/cloudflare","https://x.com/cloudflare"],"logo":{"@type":"ImageObject","url":"https://developers.cloudflare.com/logo.svg"},"address":{"@type":"PostalAddress","streetAddress":"101 Townsend St","addressLocality":"San Francisco","addressRegion":"CA","postalCode":"94107","addressCountry":"US"},"contactPoint":[{"@type":"ContactPoint","contactType":"Customer Support","url":"https://support.cloudflare.com/","availableLanguage":["English"]},{"@type":"ContactPoint","contactType":"Sales","url":"https://www.cloudflare.com/contact/","availableLanguage":["English"]}]},"isPartOf":{"@type":"WebSite","@id":"https://developers.cloudflare.com/#website","name":"Cloudflare Docs","url":"https://developers.cloudflare.com/"}}
```

---

---
description: Set up the FlagshipServerProvider to evaluate Flagship feature flags from Python server applications using OpenFeature.
title: Python SDK
image: https://developers.cloudflare.com/og-docs.png
---

[Skip to content](#main-content)

> Documentation Index  
> Fetch the complete documentation index at: https://developers.cloudflare.com/flagship/llms.txt  
> Use this file to discover all available pages before exploring further.

# Python SDK

Last updated Aug 26, 2026|Copy as Markdown|[View as Markdown](https://developers.cloudflare.com/flagship/sdk/python/index.md)|[Agent setup](https://developers.cloudflare.com/agent-setup/)

The Python SDK provides an OpenFeature-compatible `FlagshipServerProvider` for server-side Python applications. It evaluates flags over HTTP and does not support the Cloudflare Workers binding.

## Installation

Install with `uv` or `pip`:

```sh
uv add cloudflare-flagship
```

```sh
pip install cloudflare-flagship
```

## Setup

Configure the provider with your Flagship app ID, Cloudflare account ID, and an [API token](https://developers.cloudflare.com/flagship/api-tokens/) with Flagship Evaluate or Flagship App Evaluate permission.

```python
from openfeature import api
from openfeature.evaluation_context import EvaluationContext
from flagship import FlagshipServerProvider

api.set_provider(
    FlagshipServerProvider(
        app_id="<APP_ID>",
        account_id="<ACCOUNT_ID>",
        auth_token="<API_TOKEN>",
    )
)

client = api.get_client()
enabled = client.get_boolean_value(
    "new-checkout",
    False,
    EvaluationContext(targeting_key="user-42", attributes={"plan": "enterprise"}),
)
```

## Flag types

The Python SDK supports all OpenFeature flag types. Python's OpenFeature SDK separates numeric values into integer and float methods.

```python
enabled = client.get_boolean_value("new-checkout", False, context)
variant = client.get_string_value("homepage-hero", "control", context)
limit = client.get_integer_value("upload-limit", 10, context)
rate = client.get_float_value("sample-rate", 0.1, context)
config = client.get_object_value("ui-config", {"theme": "light"}, context)
```

Use the `*_details` methods when you need the resolved value, reason, variant, or error code.

## Configuration options

| Option           | Type                               | Default | Description                                                 |
| ---------------- | ---------------------------------- | ------- | ----------------------------------------------------------- |
| app\_id          | str                                | None    | Flagship app ID.                                            |
| account\_id      | str                                | None    | Required with app\_id.                                      |
| auth\_token      | str                                | None    | Bearer token added to every request.                        |
| headers\_factory | Callable\[\[\], dict\[str, str\]\] | None    | Dynamic per-request headers.                                |
| timeout          | float                              | 5.0     | Request timeout in seconds.                                 |
| retries          | int                                | 1       | Retry attempts on transient errors, capped at 10.           |
| retry\_delay     | float                              | 1.0     | Delay between retries in seconds, capped at 30.0.           |
| logging          | bool                               | False   | Enable SDK-level debug output through the SDK logger.       |
| cache\_ttl       | float                              | None    | Cache TTL in seconds. Enables caching when set.             |
| cache\_max\_size | int                                | 1000    | Maximum cached entries before least-recently-used eviction. |

## Response caching

Server-side response caching is off by default. Enable it with `cache_ttl` when you want repeated evaluations for the same flag, type, and evaluation context to reuse a recent result.

```python
FlagshipServerProvider(
    app_id="<APP_ID>",
    account_id="<ACCOUNT_ID>",
    auth_token="<API_TOKEN>",
    cache_ttl=30.0,
    cache_max_size=1000,
)
```

Cached values may be stale until the TTL expires. Keep the TTL short for flags that you expect to change during active rollouts. The provider does not cache disabled flags or errors.

## Evaluation context

Context attributes are sent as URL query parameters. Supported values are strings, integers, floats, booleans, and `datetime` values. Dictionaries, lists, tuples, and other complex values raise `InvalidContextError`.

## Async evaluation

The async API mirrors the sync API:

```python
enabled = await client.get_boolean_value_async("new-checkout", False, context)
details = await client.get_boolean_details_async("new-checkout", False, context)
```

When shutting down in an async context, use `shutdown_async()`:

```python
await api.shutdown_async()
```

Was this helpful?

YesNo

## On this page

[![](https://developers.cloudflare.com/_astro/logo.te5VL_aD.svg)Docs](https://developers.cloudflare.com/)

```json
{"@context":"https://schema.org","@type":"TechArticle","@id":"https://developers.cloudflare.com/flagship/sdk/python/#page","headline":"Python SDK · Cloudflare Flagship docs","description":"Set up the FlagshipServerProvider to evaluate Flagship feature flags from Python server applications using OpenFeature.","url":"https://developers.cloudflare.com/flagship/sdk/python/","inLanguage":"en","image":"https://developers.cloudflare.com/og-docs.png","dateModified":"2026-08-26","publisher":{"@type":"Organization","name":"Cloudflare","description":"One platform for your apps, agents, and workforce. Build, secure, and scale without managing infrastructure","url":"https://www.cloudflare.com/","sameAs":["https://github.com/cloudflare","https://www.linkedin.com/company/cloudflare","https://x.com/cloudflare"],"logo":{"@type":"ImageObject","url":"https://developers.cloudflare.com/logo.svg"},"address":{"@type":"PostalAddress","streetAddress":"101 Townsend St","addressLocality":"San Francisco","addressRegion":"CA","postalCode":"94107","addressCountry":"US"},"contactPoint":[{"@type":"ContactPoint","contactType":"Customer Support","url":"https://support.cloudflare.com/","availableLanguage":["English"]},{"@type":"ContactPoint","contactType":"Sales","url":"https://www.cloudflare.com/contact/","availableLanguage":["English"]}]},"isPartOf":{"@type":"WebSite","@id":"https://developers.cloudflare.com/#website","name":"Cloudflare Docs","url":"https://developers.cloudflare.com/"}}
```

---

---
description: Set up the FlagshipServerProvider to evaluate feature flags from Workers, Node.js, or other server-side JavaScript runtimes using OpenFeature.
title: TypeScript Server SDK
image: https://developers.cloudflare.com/og-docs.png
---

[Skip to content](#main-content)

> Documentation Index  
> Fetch the complete documentation index at: https://developers.cloudflare.com/flagship/llms.txt  
> Use this file to discover all available pages before exploring further.

# TypeScript Server SDK

Last updated Aug 26, 2026|Copy as Markdown|[View as Markdown](https://developers.cloudflare.com/flagship/sdk/server-provider/index.md)|[Agent setup](https://developers.cloudflare.com/agent-setup/)

The `FlagshipServerProvider` implements the OpenFeature server provider interface. The provider works in [Cloudflare Workers](https://developers.cloudflare.com/workers/), Node.js, and any server-side JavaScript runtime that supports the Fetch API.

Inside a Cloudflare Worker, you can pass the Flagship [binding](https://developers.cloudflare.com/flagship/binding/) directly to the provider. This avoids HTTP overhead and is the recommended approach. Outside of Workers, initialize the provider with an app ID and account ID.

## Setup

Pass the Flagship binding directly to the provider. This is the recommended approach inside a Worker.

```js
import { OpenFeature } from "@openfeature/server-sdk";
import { FlagshipServerProvider } from "@cloudflare/flagship/server";

export default {
	async fetch(request, env) {
		await OpenFeature.setProviderAndWait(
			new FlagshipServerProvider({ binding: env.FLAGS }),
		);

		const client = OpenFeature.getClient();

		const showNewCheckout = await client.getBooleanValue(
			"new-checkout",
			false,
			{ targetingKey: "user-42", plan: "enterprise" },
		);

		if (showNewCheckout) {
			return new Response("New checkout enabled!");
		}

		return new Response("Standard checkout.");
	},
};
```

```ts
import { OpenFeature } from "@openfeature/server-sdk";
import { FlagshipServerProvider } from "@cloudflare/flagship/server";

export default {
	async fetch(request: Request, env: Env): Promise<Response> {
		await OpenFeature.setProviderAndWait(
			new FlagshipServerProvider({ binding: env.FLAGS }),
		);

		const client = OpenFeature.getClient();

		const showNewCheckout = await client.getBooleanValue(
			"new-checkout",
			false,
			{ targetingKey: "user-42", plan: "enterprise" },
		);

		if (showNewCheckout) {
			return new Response("New checkout enabled!");
		}

		return new Response("Standard checkout.");
	},
};
```

Use an app ID, account ID, and an API token when running outside of a Worker (for example, in Node.js). Generate an [API token](https://developers.cloudflare.com/flagship/api-tokens/) from your Cloudflare account with Flagship Evaluate or Flagship App Evaluate permission.

```js
import { OpenFeature } from "@openfeature/server-sdk";
import { FlagshipServerProvider } from "@cloudflare/flagship/server";

await OpenFeature.setProviderAndWait(
	new FlagshipServerProvider({
		appId: "<APP_ID>",
		accountId: "<ACCOUNT_ID>",
		authToken: "<API_TOKEN>",
	}),
);

const client = OpenFeature.getClient();

const showNewCheckout = await client.getBooleanValue("new-checkout", false, {
	targetingKey: "user-42",
	plan: "enterprise",
});
```

```ts
import { OpenFeature } from "@openfeature/server-sdk";
import { FlagshipServerProvider } from "@cloudflare/flagship/server";

await OpenFeature.setProviderAndWait(
	new FlagshipServerProvider({
		appId: "<APP_ID>",
		accountId: "<ACCOUNT_ID>",
		authToken: "<API_TOKEN>",
	}),
);

const client = OpenFeature.getClient();

const showNewCheckout = await client.getBooleanValue("new-checkout", false, {
	targetingKey: "user-42",
	plan: "enterprise",
});
```

## Configuration options

| Option       | Type        | Required | Description                                                                                                                                                                     |
| ------------ | ----------- | -------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| binding      | Flagship    | No       | The Flagship binding from env.FLAGS. Use this inside a Worker for best performance. The binding handles authentication automatically.                                           |
| appId        | string      | No       | The Flagship app ID from the Cloudflare dashboard. Required when not using a binding.                                                                                           |
| accountId    | string      | No       | Your Cloudflare account ID. Required when using appId.                                                                                                                          |
| authToken    | string      | No       | A Cloudflare [API token](https://developers.cloudflare.com/flagship/api-tokens/) with Flagship Evaluate or Flagship App Evaluate permission. Required when not using a binding. |
| fetchOptions | RequestInit | No       | Custom fetch options applied to HTTP requests.                                                                                                                                  |
| timeout      | number      | No       | Request timeout in milliseconds. Defaults to 5000.                                                                                                                              |
| retries      | number      | No       | Retry attempts on transient errors. Defaults to 1 and is capped at 10.                                                                                                          |
| retryDelay   | number      | No       | Delay between retries in milliseconds. Defaults to 1000 and is capped at 30000.                                                                                                 |
| cacheTtl     | number      | No       | Cache TTL in milliseconds. Enables response caching when greater than 0.                                                                                                        |
| cacheMaxSize | number      | No       | Maximum cached entries. Defaults to 1000 when cacheTtl is set.                                                                                                                  |

Provide either `binding` or `appId`, `accountId`, and `authToken`.

## Response caching

Server-side response caching is off by default. Enable it with `cacheTtl` when you want repeated evaluations for the same flag, type, and evaluation context to reuse a recent result.

```ts
new FlagshipServerProvider({
	appId: "<APP_ID>",
	accountId: "<ACCOUNT_ID>",
	authToken: "<API_TOKEN>",
	cacheTtl: 30_000,
	cacheMaxSize: 1000,
});
```

Use caching for high-traffic server applications that repeatedly evaluate the same flags for the same contexts. Cached values may be stale until the TTL expires, so keep the TTL short for flags that you expect to change during active rollouts. The provider does not cache disabled flags or errors.

## Evaluation context

OpenFeature uses an evaluation context to pass user attributes to the flag provider. The `targetingKey` field is the primary user identifier.

Pass additional attributes alongside `targetingKey` to match [targeting rules](https://developers.cloudflare.com/flagship/targeting/). For example, you can include `plan`, `country`, or any custom attribute your rules reference.

Use primitive context values such as strings, numbers, booleans, and `Date` objects. The provider rejects objects and arrays as invalid context.

```js
const value = await client.getBooleanValue("new-checkout", false, {
	targetingKey: "user-42",
	plan: "enterprise",
	country: "US",
});
```

```ts
const value = await client.getBooleanValue("new-checkout", false, {
	targetingKey: "user-42",
	plan: "enterprise",
	country: "US",
});
```

## Available hooks

The SDK ships with two hooks that you can attach to the OpenFeature client.

* **LoggingHook** — Logs structured information for every evaluation.
* **TelemetryHook** — Captures timing and event data for observability.

```js
import { LoggingHook, TelemetryHook } from "@cloudflare/flagship/server";

OpenFeature.addHooks(new LoggingHook(), new TelemetryHook());
```

```ts
import { LoggingHook, TelemetryHook } from "@cloudflare/flagship/server";

OpenFeature.addHooks(new LoggingHook(), new TelemetryHook());
```

## Migrate from another provider

If you use another OpenFeature-compatible provider (for example, LaunchDarkly or Flagsmith), switch to Flagship by replacing the provider initialization. No changes are needed at evaluation call sites.

```js
// Before
await OpenFeature.setProviderAndWait(
	new LaunchDarklyProvider({ sdkKey: "..." }),
);

// After
await OpenFeature.setProviderAndWait(
	new FlagshipServerProvider({
		appId: "<APP_ID>",
		accountId: "<ACCOUNT_ID>",
		authToken: "<API_TOKEN>",
	}),
);
```

```ts
// Before
await OpenFeature.setProviderAndWait(
	new LaunchDarklyProvider({ sdkKey: "..." }),
);

// After
await OpenFeature.setProviderAndWait(
	new FlagshipServerProvider({
		appId: "<APP_ID>",
		accountId: "<ACCOUNT_ID>",
		authToken: "<API_TOKEN>",
	}),
);
```

Was this helpful?

YesNo

## On this page

[![](https://developers.cloudflare.com/_astro/logo.te5VL_aD.svg)Docs](https://developers.cloudflare.com/)

```json
{"@context":"https://schema.org","@type":"TechArticle","@id":"https://developers.cloudflare.com/flagship/sdk/server-provider/#page","headline":"TypeScript Server SDK · Cloudflare Flagship docs","description":"Set up the FlagshipServerProvider to evaluate feature flags from Workers, Node.js, or other server-side JavaScript runtimes using OpenFeature.","url":"https://developers.cloudflare.com/flagship/sdk/server-provider/","inLanguage":"en","image":"https://developers.cloudflare.com/og-docs.png","dateModified":"2026-08-26","publisher":{"@type":"Organization","name":"Cloudflare","description":"One platform for your apps, agents, and workforce. Build, secure, and scale without managing infrastructure","url":"https://www.cloudflare.com/","sameAs":["https://github.com/cloudflare","https://www.linkedin.com/company/cloudflare","https://x.com/cloudflare"],"logo":{"@type":"ImageObject","url":"https://developers.cloudflare.com/logo.svg"},"address":{"@type":"PostalAddress","streetAddress":"101 Townsend St","addressLocality":"San Francisco","addressRegion":"CA","postalCode":"94107","addressCountry":"US"},"contactPoint":[{"@type":"ContactPoint","contactType":"Customer Support","url":"https://support.cloudflare.com/","availableLanguage":["English"]},{"@type":"ContactPoint","contactType":"Sales","url":"https://www.cloudflare.com/contact/","availableLanguage":["English"]}]},"isPartOf":{"@type":"WebSite","@id":"https://developers.cloudflare.com/#website","name":"Cloudflare Docs","url":"https://developers.cloudflare.com/"}}
```

---

---
description: Serve different Flagship flag values to different users based on attributes, conditions, and logical grouping.
title: Targeting rules
image: https://developers.cloudflare.com/og-docs.png
---

[Skip to content](#main-content)

> Documentation Index  
> Fetch the complete documentation index at: https://developers.cloudflare.com/flagship/llms.txt  
> Use this file to discover all available pages before exploring further.

# Targeting rules

Last updated Jun 24, 2026|Copy as Markdown|[View as Markdown](https://developers.cloudflare.com/flagship/targeting/index.md)|[Agent setup](https://developers.cloudflare.com/agent-setup/)

Targeting rules let you serve different flag values to different users based on their attributes. Each flag can have zero or more rules.

Rules are evaluated in sequential order, from top to bottom. The first rule whose conditions match is used, and its configured variant is returned. If no rule matches, Flagship returns the flag's default variant.

When a flag is disabled, the default variant is always returned regardless of rules.

Place more specific rules before broader rules. A broad catch-all rule can prevent later rules from running.

## How rules work

A rule consists of:

* **Conditions** — One or more attribute comparisons that must be satisfied. For example, `country equals "US"` or `plan in ["enterprise", "business"]`.
* **Serve variant** — The variant to return when the rule matches.
* **Rollout** (optional) — A percentage-based gradual release. Only the specified percentage of matching users receive the rule's variant. The rest continue to the next rule.

## Condition structure

Each condition compares an attribute from the evaluation context against a value using an operator:

* **Attribute** — The context key to evaluate (for example, `userId`, `country`, `plan`).
* **Operator** — The comparison to perform. Flagship supports [11 operators](https://developers.cloudflare.com/flagship/targeting/operators/).
* **Value** — The value to compare against. Can be a string, number, or array depending on the operator.

If the evaluation context does not include the attribute referenced by a condition, that condition does not match.

## Logical grouping

Conditions within a rule can be grouped with `AND`/`OR` operators and nested up to five levels deep.

For example, to target enterprise users in the US or Canada:

* `AND`:  
  * `plan equals "enterprise"`
  * `OR`:  
    * `country equals "US"`
    * `country equals "CA"`

Use the smallest set of context attributes necessary to express the rule. This keeps rule behavior easier to reason about and avoids sending unnecessary user data in evaluation context.

## Learn more

* [Operators](https://developers.cloudflare.com/flagship/targeting/operators/)
* [Percentage rollouts](https://developers.cloudflare.com/flagship/targeting/percentage-rollouts/)

Was this helpful?

YesNo

## On this page

[![](https://developers.cloudflare.com/_astro/logo.te5VL_aD.svg)Docs](https://developers.cloudflare.com/)

```json
{"@context":"https://schema.org","@type":"WebPage","@id":"https://developers.cloudflare.com/flagship/targeting/#page","headline":"Targeting rules · Cloudflare Flagship docs","description":"Serve different Flagship flag values to different users based on attributes, conditions, and logical grouping.","url":"https://developers.cloudflare.com/flagship/targeting/","inLanguage":"en","image":"https://developers.cloudflare.com/og-docs.png","dateModified":"2026-06-24","publisher":{"@type":"Organization","name":"Cloudflare","description":"One platform for your apps, agents, and workforce. Build, secure, and scale without managing infrastructure","url":"https://www.cloudflare.com/","sameAs":["https://github.com/cloudflare","https://www.linkedin.com/company/cloudflare","https://x.com/cloudflare"],"logo":{"@type":"ImageObject","url":"https://developers.cloudflare.com/logo.svg"},"address":{"@type":"PostalAddress","streetAddress":"101 Townsend St","addressLocality":"San Francisco","addressRegion":"CA","postalCode":"94107","addressCountry":"US"},"contactPoint":[{"@type":"ContactPoint","contactType":"Customer Support","url":"https://support.cloudflare.com/","availableLanguage":["English"]},{"@type":"ContactPoint","contactType":"Sales","url":"https://www.cloudflare.com/contact/","availableLanguage":["English"]}]},"isPartOf":{"@type":"WebSite","@id":"https://developers.cloudflare.com/#website","name":"Cloudflare Docs","url":"https://developers.cloudflare.com/"}}
```

---

---
description: Reference for the 11 comparison operators available in Flagship targeting rule conditions, including equality, comparison, string, and array operators.
title: Operators
image: https://developers.cloudflare.com/og-docs.png
---

[Skip to content](#main-content)

> Documentation Index  
> Fetch the complete documentation index at: https://developers.cloudflare.com/flagship/llms.txt  
> Use this file to discover all available pages before exploring further.

# Operators

Last updated Apr 21, 2026|Copy as Markdown|[View as Markdown](https://developers.cloudflare.com/flagship/targeting/operators/index.md)|[Agent setup](https://developers.cloudflare.com/agent-setup/)

Flagship supports 11 comparison operators for targeting rule conditions. Each operator compares an attribute from the [evaluation context](https://developers.cloudflare.com/flagship/concepts/#evaluation-context) against a specified value.

## Operator reference

| Operator                  | Description                                                                          | Example                                                 | Value type                |
| ------------------------- | ------------------------------------------------------------------------------------ | ------------------------------------------------------- | ------------------------- |
| equals                    | Returns true if the attribute value matches the specified value.                     | country equals "US"                                     | String                    |
| not\_equals               | Returns true if the attribute value does not match the specified value.              | plan not\_equals "free"                                 | String                    |
| greater\_than             | Returns true if the attribute value is greater than the specified value.             | age greater\_than 18                                    | Number, ISO 8601 datetime |
| less\_than                | Returns true if the attribute value is less than the specified value.                | loginCount less\_than 5                                 | Number, ISO 8601 datetime |
| greater\_than\_or\_equals | Returns true if the attribute value is greater than or equal to the specified value. | score greater\_than\_or\_equals 90                      | Number, ISO 8601 datetime |
| less\_than\_or\_equals    | Returns true if the attribute value is less than or equal to the specified value.    | createdAt less\_than\_or\_equals "2025-01-01T00:00:00Z" | Number, ISO 8601 datetime |
| contains                  | Returns true if the attribute value contains the specified substring.                | email contains "@cloudflare.com"                        | String                    |
| starts\_with              | Returns true if the attribute value starts with the specified prefix.                | path starts\_with "/api/v2"                             | String                    |
| ends\_with                | Returns true if the attribute value ends with the specified suffix.                  | domain ends\_with ".dev"                                | String                    |
| in                        | Returns true if the attribute value is in the specified array.                       | country in \["US", "CA", "UK"\]                         | Array                     |
| not\_in                   | Returns true if the attribute value is not in the specified array.                   | userId not\_in \["blocked-1", "blocked-2"\]             | Array                     |

## Operator categories

### Equality operators

`equals`, `not_equals`

Use these operators for exact string matching. The comparison is case-sensitive.

### Comparison operators

`greater_than`, `less_than`, `greater_than_or_equals`, `less_than_or_equals`

These operators work with numeric values and ISO 8601 datetime strings. When comparing datetimes, provide the value in ISO 8601 format (for example, `"2025-01-01T00:00:00Z"`).

### String operators

`contains`, `starts_with`, `ends_with`

These operators perform substring matching against the attribute value. All string comparisons are case-sensitive.

### Array operators

`in`, `not_in`

The value must be an array. Flagship checks whether the attribute value is a member of the specified array.

Was this helpful?

YesNo

## On this page

[![](https://developers.cloudflare.com/_astro/logo.te5VL_aD.svg)Docs](https://developers.cloudflare.com/)

```json
{"@context":"https://schema.org","@type":"TechArticle","@id":"https://developers.cloudflare.com/flagship/targeting/operators/#page","headline":"Operators · Cloudflare Flagship docs","description":"Reference for the 11 comparison operators available in Flagship targeting rule conditions, including equality, comparison, string, and array operators.","url":"https://developers.cloudflare.com/flagship/targeting/operators/","inLanguage":"en","image":"https://developers.cloudflare.com/og-docs.png","dateModified":"2026-04-21","publisher":{"@type":"Organization","name":"Cloudflare","description":"One platform for your apps, agents, and workforce. Build, secure, and scale without managing infrastructure","url":"https://www.cloudflare.com/","sameAs":["https://github.com/cloudflare","https://www.linkedin.com/company/cloudflare","https://x.com/cloudflare"],"logo":{"@type":"ImageObject","url":"https://developers.cloudflare.com/logo.svg"},"address":{"@type":"PostalAddress","streetAddress":"101 Townsend St","addressLocality":"San Francisco","addressRegion":"CA","postalCode":"94107","addressCountry":"US"},"contactPoint":[{"@type":"ContactPoint","contactType":"Customer Support","url":"https://support.cloudflare.com/","availableLanguage":["English"]},{"@type":"ContactPoint","contactType":"Sales","url":"https://www.cloudflare.com/contact/","availableLanguage":["English"]}]},"isPartOf":{"@type":"WebSite","@id":"https://developers.cloudflare.com/#website","name":"Cloudflare Docs","url":"https://developers.cloudflare.com/"}}
```

---

---
description: Gradually release features to a fraction of users with Flagship percentage rollouts and consistent hashing for sticky bucketing.
title: Percentage rollouts
image: https://developers.cloudflare.com/og-docs.png
---

[Skip to content](#main-content)

> Documentation Index  
> Fetch the complete documentation index at: https://developers.cloudflare.com/flagship/llms.txt  
> Use this file to discover all available pages before exploring further.

# Percentage rollouts

Last updated Jun 24, 2026|Copy as Markdown|[View as Markdown](https://developers.cloudflare.com/flagship/targeting/percentage-rollouts/index.md)|[Agent setup](https://developers.cloudflare.com/agent-setup/)

Percentage rollouts let you gradually release a feature to a fraction of your users. Any [targeting rule](https://developers.cloudflare.com/flagship/targeting/) can include a rollout percentage between 0 and 100.

Use percentage rollouts when you want to limit blast radius, run an experiment, or sample requests without deploying new code.

## How percentage rollouts work

When a rule has a percentage rollout, the rule only serves its variant when both the rule conditions and the rollout bucket match. Contexts that do not match the rule continue to the next rule or receive the default variant if no later rule matches.

For example, a rule can target users on the `enterprise` plan, then serve the new experience to only 10% of those users. Users outside the 10% continue through the rest of the rule list.

```json
{
	"priority": 1,
	"conditions": [
		{ "attribute": "plan", "operator": "equals", "value": "enterprise" }
	],
	"serve_variation": "on",
	"rollout": {
		"percentage": 10,
		"attribute": "userId"
	}
}
```

The `reason` in evaluation details is `SPLIT` when a percentage rollout serves the variant.

## Sticky bucketing

Flagship uses consistent hashing on a configurable attribute to assign users to a rollout bucket. The same user always receives the same flag value for a given rollout configuration. This ensures a consistent experience across repeated evaluations.

By default, the bucketing attribute is `targetingKey`. You can configure which attribute to use for bucketing when you set up the rollout in the dashboard.

Rollout buckets are independent across accounts and flags. The same identifier may fall into different buckets for different flags, which helps avoid correlated rollouts across unrelated features.

Choose a bucketing attribute based on what should remain stable:

| Use case               | Suggested attribute                     |
| ---------------------- | --------------------------------------- |
| User-facing release    | Stable user ID or targetingKey          |
| Account-level rollout  | Account ID                              |
| Organization rollout   | Organization or workspace ID            |
| Request-level sampling | Request ID or another per-request value |

For most feature releases and experiments, use a stable user or account identifier. Use request-level values only when changing between requests is acceptable, such as for traffic sampling.

Random assignment without targetingKey

If `targetingKey` is not present in the evaluation context and no alternative bucketing attribute is configured, Flagship cannot produce a stable hash. In this case the rollout bucket is assigned randomly on each evaluation, meaning the same user may receive different flag values across requests.

Always provide a stable `targetingKey` (or configure a consistent bucketing attribute) to guarantee sticky bucketing.

## Common rollout patterns

### Progressive rollout

Start with a small rollout, monitor your application, then increase the percentage as confidence grows.

1. Create a flag with a 5% rollout.
2. Monitor errors, latency, product metrics, and user feedback.
3. Increase to 25%, then 50%, then 100%.
4. After the rollout reaches 100%, remove temporary targeting rules and make the winning variant the default.
5. After the feature is fully shipped, remove the old code path and delete the flag.

### Targeted rollout plus percentage rollout

Consider a flag `new-checkout` with the following rules:

1. **Rule 1**: `plan equals "enterprise"` — serve variant `on`.
2. **Rule 2**: 25% rollout on `userId` — serve variant `on`.
3. **Default variant**: `off`.

In this configuration:

* All enterprise users see the new checkout.
* 25% of all other users, determined by their `userId`, also see the new checkout.
* The remaining 75% of non-enterprise users see the standard checkout.

As you gain confidence, increase the rollout percentage until you reach 100%.

### A/B/n testing

For a plain A/B/n test with no audience conditions, configure each variant's traffic share in the Cloudflare dashboard. The dashboard calculates the cumulative thresholds for you.

If you manage a plain A/B/n test directly through the API, create one rule per variant with cumulative rollout percentages. Flagship evaluates rules in priority order. If a context matches a rule but does not fall into that rule's rollout percentage, evaluation continues to the next rule.

For a 30% / 40% / 30% split across variants A, B, and C:

| Variant | Share | Cumulative threshold |
| ------- | ----- | -------------------- |
| A       | 30%   | 30                   |
| B       | 40%   | 70                   |
| C       | 30%   | 100                  |

```json
[
	{
		"priority": 1,
		"conditions": [],
		"serve_variation": "variant-a",
		"rollout": { "percentage": 30, "attribute": "targetingKey" }
	},
	{
		"priority": 2,
		"conditions": [],
		"serve_variation": "variant-b",
		"rollout": { "percentage": 70, "attribute": "targetingKey" }
	},
	{
		"priority": 3,
		"conditions": [],
		"serve_variation": "variant-c",
		"rollout": { "percentage": 100, "attribute": "targetingKey" }
	}
]
```

In API-managed configurations, the first rule covers buckets 0-30\. The second rule covers buckets 31-70\. The final rule catches the remaining buckets through 100\. Always set the final rule to 100 when every eligible context should receive a variant.

Use the same bucketing attribute on every rule in the experiment. If each rule uses a different attribute, users may not stay in the intended split.

### Targeted A/B/n testing

You can combine audience targeting with a multi-variant rollout. For example, you might want only premium users to enter an experiment, then split those premium users across three variants.

For targeted A/B/n tests, repeat the same audience condition on each variant rule and use cumulative rollout thresholds. When you use this targeted multi-rule pattern, configure the cumulative threshold for each rule explicitly, whether you are using the dashboard or the API.

For a premium-only split where 20% receive variant A, 40% receive variant B, and the remaining 40% receive variant C, use thresholds of 20, 60, and 100:

```json
[
	{
		"priority": 1,
		"conditions": [
			{ "attribute": "plan", "operator": "equals", "value": "premium" }
		],
		"serve_variation": "variant-a",
		"rollout": { "percentage": 20, "attribute": "targetingKey" }
	},
	{
		"priority": 2,
		"conditions": [
			{ "attribute": "plan", "operator": "equals", "value": "premium" }
		],
		"serve_variation": "variant-b",
		"rollout": { "percentage": 60, "attribute": "targetingKey" }
	},
	{
		"priority": 3,
		"conditions": [
			{ "attribute": "plan", "operator": "equals", "value": "premium" }
		],
		"serve_variation": "variant-c",
		"rollout": { "percentage": 100, "attribute": "targetingKey" }
	}
]
```

Users who do not match `plan equals "premium"` skip all three rules and receive the flag's default variant, unless a later rule matches them.

### Request sampling

You can use percentage rollouts for request-level sampling by choosing a per-request bucketing attribute. For example, a 1% rollout can enable extra logging or diagnostics for a small fraction of requests.

Only use this pattern when it is acceptable for the same user to receive different results on different requests.

## Troubleshooting

### Rollout results change between requests

If the same user receives different values across requests, the evaluation context is probably missing `targetingKey` or the configured bucketing attribute.

Pass the same stable identifier on every evaluation:

```ts
const enabled = await env.FLAGS.getBooleanValue("gradual-rollout", false, {
	userId: session.user.id,
});
```

Then configure the rollout to bucket by `userId`.

### Rollout never reaches some users

Check rule order. A catch-all rule with a lower priority number can return a variant before later rollout rules run. Place broad catch-all rules after more specific rules.

### A/B/n split does not match expected percentages

For plain dashboard-managed A/B/n tests, enter each variant's traffic share and let the dashboard calculate thresholds.

For API-managed A/B/n tests, or for targeted A/B/n tests configured as multiple rules, use cumulative thresholds. A 30% / 40% / 30% split should use thresholds of 30, 70, and 100, not 30, 40, and 30.

### Default variant appears during a rollout

This can happen when a context matches the rule conditions but falls outside the rollout percentage, and no later rule matches. Add a later rule or use a 100% final rule if every matching context should receive a non-default variant.

Was this helpful?

YesNo

## On this page

[![](https://developers.cloudflare.com/_astro/logo.te5VL_aD.svg)Docs](https://developers.cloudflare.com/)

```json
{"@context":"https://schema.org","@type":"TechArticle","@id":"https://developers.cloudflare.com/flagship/targeting/percentage-rollouts/#page","headline":"Percentage rollouts · Cloudflare Flagship docs","description":"Gradually release features to a fraction of users with Flagship percentage rollouts and consistent hashing for sticky bucketing.","url":"https://developers.cloudflare.com/flagship/targeting/percentage-rollouts/","inLanguage":"en","image":"https://developers.cloudflare.com/og-docs.png","dateModified":"2026-06-24","publisher":{"@type":"Organization","name":"Cloudflare","description":"One platform for your apps, agents, and workforce. Build, secure, and scale without managing infrastructure","url":"https://www.cloudflare.com/","sameAs":["https://github.com/cloudflare","https://www.linkedin.com/company/cloudflare","https://x.com/cloudflare"],"logo":{"@type":"ImageObject","url":"https://developers.cloudflare.com/logo.svg"},"address":{"@type":"PostalAddress","streetAddress":"101 Townsend St","addressLocality":"San Francisco","addressRegion":"CA","postalCode":"94107","addressCountry":"US"},"contactPoint":[{"@type":"ContactPoint","contactType":"Customer Support","url":"https://support.cloudflare.com/","availableLanguage":["English"]},{"@type":"ContactPoint","contactType":"Sales","url":"https://www.cloudflare.com/contact/","availableLanguage":["English"]}]},"isPartOf":{"@type":"WebSite","@id":"https://developers.cloudflare.com/#website","name":"Cloudflare Docs","url":"https://developers.cloudflare.com/"}}
```

---

---
description: Flagship evaluation reason values and error codes returned by binding details methods and the OpenFeature SDK.
title: Evaluation reasons and error codes
image: https://developers.cloudflare.com/og-docs.png
---

[Skip to content](#main-content)

> Documentation Index  
> Fetch the complete documentation index at: https://developers.cloudflare.com/flagship/llms.txt  
> Use this file to discover all available pages before exploring further.

# Evaluation reasons and error codes

Last updated Jun 24, 2026|Copy as Markdown|[View as Markdown](https://developers.cloudflare.com/flagship/reference/evaluation-reasons/index.md)|[Agent setup](https://developers.cloudflare.com/agent-setup/)

When you evaluate a flag using the binding's `*Details` methods or the OpenFeature SDK, the response includes a `reason` field that explains why a particular value was returned. If an error occurs, the response includes an `errorCode` field.

## Evaluation reasons

| Reason           | Description                                                                                                                      |
| ---------------- | -------------------------------------------------------------------------------------------------------------------------------- |
| TARGETING\_MATCH | A targeting rule's conditions matched the evaluation context, and the rule's variant was returned.                               |
| SPLIT            | A targeting rule with a percentage rollout matched. The user fell within the rollout percentage and received the rule's variant. |
| DEFAULT          | No targeting rule matched the evaluation context. The flag's default variant was returned.                                       |
| DISABLED         | The flag is disabled. The default variant was returned regardless of targeting rules.                                            |
| CACHED           | The SDK returned a cached evaluation result.                                                                                     |
| ERROR            | Evaluation failed and the default value was returned.                                                                            |

## Error codes

When an evaluation error occurs, the method returns the default value you provided. The `*Details` methods include additional metadata about the error.

| Error code       | Description                                                                                                                                                         |
| ---------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| TYPE\_MISMATCH   | The flag's variant type does not match the requested type. For example, calling getBooleanValue on a flag whose variant is a string. The default value is returned. |
| FLAG\_NOT\_FOUND | The specified flag key does not exist in the app. The default value is returned.                                                                                    |
| INVALID\_CONTEXT | The evaluation context contains unsupported values, such as objects or arrays in HTTP evaluation. The default value is returned.                                    |
| PARSE\_ERROR     | The SDK received an invalid evaluation response. The default value is returned.                                                                                     |
| GENERAL          | An unexpected error occurred during evaluation, such as a timeout or network failure. The default value is returned.                                                |

## Example

The following example inspects evaluation details returned by `getBooleanDetails`:

```js
const details = await env.FLAGS.getBooleanDetails("my-feature", false, {
	userId: "user-42",
});

switch (details.reason) {
	case "TARGETING_MATCH":
		console.log(`Matched targeting rule, variant: ${details.variant}`);
		break;
	case "SPLIT":
		console.log(`Included in rollout, variant: ${details.variant}`);
		break;
	case "DEFAULT":
		console.log("No rule matched, using default variant");
		break;
	case "DISABLED":
		console.log("Flag is disabled");
		break;
}

if (details.errorCode) {
	console.error(`Evaluation error: ${details.errorCode}`);
}
```

```ts
const details = await env.FLAGS.getBooleanDetails("my-feature", false, {
	userId: "user-42",
});

switch (details.reason) {
	case "TARGETING_MATCH":
		console.log(`Matched targeting rule, variant: ${details.variant}`);
		break;
	case "SPLIT":
		console.log(`Included in rollout, variant: ${details.variant}`);
		break;
	case "DEFAULT":
		console.log("No rule matched, using default variant");
		break;
	case "DISABLED":
		console.log("Flag is disabled");
		break;
}

if (details.errorCode) {
	console.error(`Evaluation error: ${details.errorCode}`);
}
```

Was this helpful?

YesNo

## On this page

[![](https://developers.cloudflare.com/_astro/logo.te5VL_aD.svg)Docs](https://developers.cloudflare.com/)

```json
{"@context":"https://schema.org","@type":"TechArticle","@id":"https://developers.cloudflare.com/flagship/reference/evaluation-reasons/#page","headline":"Evaluation reasons and error codes · Cloudflare Flagship docs","description":"Flagship evaluation reason values and error codes returned by binding details methods and the OpenFeature SDK.","url":"https://developers.cloudflare.com/flagship/reference/evaluation-reasons/","inLanguage":"en","image":"https://developers.cloudflare.com/og-docs.png","dateModified":"2026-06-24","publisher":{"@type":"Organization","name":"Cloudflare","description":"One platform for your apps, agents, and workforce. Build, secure, and scale without managing infrastructure","url":"https://www.cloudflare.com/","sameAs":["https://github.com/cloudflare","https://www.linkedin.com/company/cloudflare","https://x.com/cloudflare"],"logo":{"@type":"ImageObject","url":"https://developers.cloudflare.com/logo.svg"},"address":{"@type":"PostalAddress","streetAddress":"101 Townsend St","addressLocality":"San Francisco","addressRegion":"CA","postalCode":"94107","addressCountry":"US"},"contactPoint":[{"@type":"ContactPoint","contactType":"Customer Support","url":"https://support.cloudflare.com/","availableLanguage":["English"]},{"@type":"ContactPoint","contactType":"Sales","url":"https://www.cloudflare.com/contact/","availableLanguage":["English"]}]},"isPartOf":{"@type":"WebSite","@id":"https://developers.cloudflare.com/#website","name":"Cloudflare Docs","url":"https://developers.cloudflare.com/"}}
```

---

---
description: Platform limits for Flagship, including maximum apps per account, flags per app, condition nesting depth, and configuration size.
title: Limits
image: https://developers.cloudflare.com/og-docs.png
---

[Skip to content](#main-content)

> Documentation Index  
> Fetch the complete documentation index at: https://developers.cloudflare.com/flagship/llms.txt  
> Use this file to discover all available pages before exploring further.

# Limits

Last updated Jun 24, 2026|Copy as Markdown|[View as Markdown](https://developers.cloudflare.com/flagship/reference/limits/index.md)|[Agent setup](https://developers.cloudflare.com/agent-setup/)

Flagship enforces the following limits.

## Platform limits

| Feature                         | Limit     |
| ------------------------------- | --------- |
| Apps per account                | 10,000    |
| Flags per app                   | 5,000     |
| Flag, app, and variant keys     | 64 chars  |
| Condition attribute names       | 64 chars  |
| Condition string values         | 256 chars |
| Variant value size              | 10 KB     |
| Condition nesting depth         | 5 levels  |
| Flag description                | 512 chars |
| Flag configuration size per app | 25 MB     |

Note

The apps-per-account and flags-per-app limits are soft limits. If your use case requires higher limits, contact Cloudflare support.

## Notes

* Condition nesting depth counts from the top-level condition group. A flat list of conditions (no nesting) has a depth of 1.
* Flag keys, app names, condition set names, and variant keys can contain letters, numbers, hyphens, and underscores.
* All variants on a flag must use the same value type: boolean, string, number, or JSON.
* Flag configuration size refers to the total serialized size of all flags within a single app, including their variants and rules.

Was this helpful?

YesNo

## On this page

[![](https://developers.cloudflare.com/_astro/logo.te5VL_aD.svg)Docs](https://developers.cloudflare.com/)

```json
{"@context":"https://schema.org","@type":"TechArticle","@id":"https://developers.cloudflare.com/flagship/reference/limits/#page","headline":"Limits · Cloudflare Flagship docs","description":"Platform limits for Flagship, including maximum apps per account, flags per app, condition nesting depth, and configuration size.","url":"https://developers.cloudflare.com/flagship/reference/limits/","inLanguage":"en","image":"https://developers.cloudflare.com/og-docs.png","dateModified":"2026-06-24","publisher":{"@type":"Organization","name":"Cloudflare","description":"One platform for your apps, agents, and workforce. Build, secure, and scale without managing infrastructure","url":"https://www.cloudflare.com/","sameAs":["https://github.com/cloudflare","https://www.linkedin.com/company/cloudflare","https://x.com/cloudflare"],"logo":{"@type":"ImageObject","url":"https://developers.cloudflare.com/logo.svg"},"address":{"@type":"PostalAddress","streetAddress":"101 Townsend St","addressLocality":"San Francisco","addressRegion":"CA","postalCode":"94107","addressCountry":"US"},"contactPoint":[{"@type":"ContactPoint","contactType":"Customer Support","url":"https://support.cloudflare.com/","availableLanguage":["English"]},{"@type":"ContactPoint","contactType":"Sales","url":"https://www.cloudflare.com/contact/","availableLanguage":["English"]}]},"isPartOf":{"@type":"WebSite","@id":"https://developers.cloudflare.com/#website","name":"Cloudflare Docs","url":"https://developers.cloudflare.com/"}}
```

---

---
description: Use wrangler flagship to create apps, manage feature flags, configure targeting rules, run rollouts, evaluate flags, and inspect changelog history.
title: Wrangler commands
image: https://developers.cloudflare.com/og-docs.png
---

[Skip to content](#main-content)

> Documentation Index  
> Fetch the complete documentation index at: https://developers.cloudflare.com/flagship/llms.txt  
> Use this file to discover all available pages before exploring further.

# Wrangler commands

Last updated Jul 16, 2026|Copy as Markdown|[View as Markdown](https://developers.cloudflare.com/flagship/reference/wrangler-commands/index.md)|[Agent setup](https://developers.cloudflare.com/agent-setup/)

Use `wrangler flagship` to manage Flagship apps and feature flags from the command line. Every `wrangler flagship flags` command takes the app ID as the first argument. Most subcommands then take a flag key, for example `wrangler flagship flags get <APP_ID> <KEY>`. List-style commands, such as `wrangler flagship flags list <APP_ID>`, take only the app ID.

## Before you begin

### Authenticate Wrangler

`wrangler flagship` calls the Cloudflare API. Authenticate Wrangler before running commands:

```sh
wrangler login
```

For automation, set [CLOUDFLARE\_API\_TOKEN](https://developers.cloudflare.com/workers/wrangler/system-environment-variables/) to an [API token](https://developers.cloudflare.com/fundamentals/api/get-started/create-token/) with the appropriate Flagship permissions.

| Permission     | Use it for                                                                                                                                            |
| -------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------- |
| flagship:read  | Listing apps, getting apps, listing flags, inspecting flags, evaluating flags, and reading changelogs.                                                |
| flagship:write | Creating apps, updating apps, deleting apps, creating flags, updating flags, changing defaults, rollouts, splits, enable/disable, and deleting flags. |

Most commands that modify an existing flag first read the current flag and then write back the updated definition. For those workflows, grant both `flagship:read` and `flagship:write`.

### Bind Flagship to your Worker

Add a Flagship binding to your Worker project so your Worker code can evaluate flags with low latency at runtime:

```jsonc
{
  "$schema": "./node_modules/wrangler/config-schema.json",
  "flagship": [
    {
      "binding": "FLAGS",
      "app_id": "<APP_ID>"
    }
  ]
}
```

```toml
[[flagship]]
binding = "FLAGS"
app_id = "<APP_ID>"
```

Note

This binding is only used by your Worker's runtime code (`env.FLAGS`). `wrangler flagship` commands always take the app ID as an explicit argument and do not read it from this binding.

## Quick start

Create a boolean flag, evaluate it for a user, and disable it as a kill switch:

```sh
# With no variations, Wrangler creates on=true, off=false,
# and serves off by default.
wrangler flagship flags create <APP_ID> new-checkout

# Evaluate the flag for a user.
wrangler flagship flags evaluate <APP_ID> new-checkout --targeting-key user-42

# Disable the flag instantly. Disabled flags always serve their default variation.
wrangler flagship flags disable <APP_ID> new-checkout
```

## Manage apps

Apps group related flags. A common pattern is one app per service, Worker, or product surface.

| Task       | Command                                               |
| ---------- | ----------------------------------------------------- |
| Create app | wrangler flagship apps create <NAME>                  |
| List apps  | wrangler flagship apps list                           |
| Get app    | wrangler flagship apps get <APP\_ID>                  |
| Rename app | wrangler flagship apps update <APP\_ID> --name <NAME> |
| Delete app | wrangler flagship apps delete <APP\_ID>               |

`wrangler flagship apps ls` is an alias for `apps list`. `wrangler flagship apps rm` is an alias for `apps delete`.

`wrangler flagship apps list` follows pagination automatically and displays all apps in the account.

Creating an app returns the app ID and shows the binding snippet to add to your Wrangler configuration:

```sh
wrangler flagship apps create checkout-service
```

To add the new app to your `wrangler.json` or `wrangler.jsonc` file as a Worker binding, pass `--binding`:

```sh
wrangler flagship apps create checkout-service --binding FLAGS
```

Wrangler also supports `--update-config` to update your JSON or JSONC configuration after prompting for a binding name.

For non-JSON configuration files, Wrangler prints the binding snippet but does not edit the file automatically.

When `--json` is used, `apps create` prints the created app as JSON and does not prompt for or update configuration.

For scripts, capture the app ID from JSON output:

```sh
APP_ID=$(wrangler flagship apps create checkout-service --json | jq -r '.id')
```

Deleting an app deletes all of its flags and changelog history. The API rejects app deletion if a Worker still references the app through a Flagship binding.

Use `--force` or `-y` to skip the delete confirmation prompt. If you also use `--json`, you must pass `--force` so the confirmation prompt cannot appear in JSON output.

```sh
wrangler flagship apps delete <APP_ID> --force
```

Delete multiple apps by passing multiple app IDs:

```sh
wrangler flagship apps delete <APP_ID_1> <APP_ID_2> <APP_ID_3> --force
```

## Create flags

Flag keys are unique within an app. Use stable keys that describe the behavior being controlled, such as `new-checkout`, `pricing-page-layout`, or `upload-limit`.

### Boolean flags

If you omit variations, Wrangler creates a boolean flag with `on=true`, `off=false`, and `off` as the default variation.

```sh
wrangler flagship flags create <APP_ID> new-checkout
```

### Explicit variations

Use `--variation` (`-V`) to add each variation as `name=value`. Use `--default` to choose the fallback variation.

```sh
# String flag.
wrangler flagship flags create <APP_ID> checkout-flow \
	-V v1=old-checkout \
	-V v2=new-checkout \
	--default v1 \
	--type string

# Number flag.
wrangler flagship flags create <APP_ID> upload-limit \
	-V free=10 \
	-V pro=100 \
	-V enterprise=1000 \
	--default free \
	--type number

# JSON flag.
wrangler flagship flags create <APP_ID> theme-config \
	-V 'light={"bg":"#ffffff","fg":"#111111"}' \
	-V 'dark={"bg":"#111111","fg":"#ffffff"}' \
	--default light \
	--type json
```

Supported value types are `boolean`, `string`, `number`, and `json`. If `--type` is omitted, Wrangler infers each value's scalar type independently.

All variations on a flag must use the same value type. Wrangler rejects a flag whose variations resolve to mixed types, for example one boolean and one number, before sending the request. Pass `--type` explicitly to coerce every variation to the same type.

Use `--description` (`-d`) to document the purpose of a flag:

```sh
wrangler flagship flags create <APP_ID> checkout-flow \
	-V v1=old-checkout \
	-V v2=new-checkout \
	--default v1 \
	--type string \
	--description "Controls which checkout experience is served"
```

Flag keys and variation names can contain letters, numbers, hyphens, and underscores. Keep keys stable, because application code evaluates flags by key.

### Disabled flags

Use `--disabled` to create a flag that serves its default variation until you enable it.

```sh
wrangler flagship flags create <APP_ID> coming-soon \
	-V on=true \
	-V off=false \
	--default off \
	--disabled
```

## Target users with rules

Targeting rules decide which variation to serve for a given evaluation context. Pass rules with `--rule` or `--rule-json`.

### Rule syntax

The compact `--rule` syntax uses semicolon-separated segments:

```txt
serve=<VARIATION>; when=<CONDITIONS>; rollout=<PERCENT>%@<ATTRIBUTE>; priority=<NUMBER>
```

| Segment  | Required | Description                                                                                       |
| -------- | -------- | ------------------------------------------------------------------------------------------------- |
| serve    | Yes      | Variation served when the rule matches. Must reference an existing variation.                     |
| when     | No       | Conditions matched against evaluation context. If omitted, the rule matches every context.        |
| rollout  | No       | Percentage of matching traffic to receive the variation. The attribute controls sticky bucketing. |
| priority | No       | Evaluation order. Lower numbers run first. If omitted, Wrangler assigns priorities by order.      |

```sh
wrangler flagship flags create <APP_ID> premium-banner \
	-V on=true \
	-V off=false \
	--default off \
	--rule "serve=on; when=plan equals enterprise AND country in [US,CA]; rollout=25%@user_id"
```

### Conditions

Conditions compare attributes from the evaluation context with rule values. The compact syntax supports all [Flagship operators](https://developers.cloudflare.com/flagship/targeting/operators/):

```sh
--rule "serve=on; when=plan equals pro"
--rule "serve=on; when=country in [US,CA,UK]"
--rule "serve=off; when=email ends_with @example.com"
--rule "serve=strict; when=score less_than 20"
```

Use `AND` and `OR` to combine conditions. `AND` has higher precedence than `OR`.

```sh
# Both conditions must match.
--rule "serve=on; when=plan equals pro AND country equals US"

# Either condition can match.
--rule "serve=on; when=plan equals enterprise OR plan equals team"

# Equivalent to: (plan=pro AND country=US) OR plan=enterprise.
--rule "serve=on; when=plan equals pro AND country equals US OR plan equals enterprise"
```

`AND` and `OR` are reserved as logical operators when they appear outside quoted values or lists. Wrap values in single or double quotes when they contain reserved words or separators such as `AND`, `OR`, `;`, or `,`:

```sh
--rule 'serve=on; when=title equals "WAR AND PEACE" OR title equals "tom; jerry"'
--rule 'serve=on; when=country in ["US","CA"]'
```

For `in` and `not_in`, pass a bracketed list. Wrangler rejects malformed lists, empty list items, unterminated quotes, and unbalanced brackets before sending the request.

Use `--rule-json` for deeply nested logical groups or if you prefer to pass the API rule shape directly. Wrangler validates `--rule-json` against the Flagship rule schema and rejects unknown or conflicting fields.

```sh
wrangler flagship flags create <APP_ID> beta-features \
	-V on=true \
	-V off=false \
	--default off \
	--rule-json '{"serve_variation":"on","conditions":[{"logical_operator":"OR","clauses":[{"attribute":"beta","operator":"equals","value":true},{"attribute":"plan","operator":"equals","value":"enterprise"}]}]}'
```

### Multiple rules

Repeat `--rule` or `--rule-json` to declare multiple rules. Rules are evaluated in priority order. The first matching rule wins.

```sh
wrangler flagship flags create <APP_ID> rate-limit-tier \
	-V strict=50 \
	-V normal=200 \
	-V relaxed=1000 \
	--default normal \
	--type number \
	--rule "serve=strict; when=score less_than 20" \
	--rule "serve=relaxed; when=score greater_than_or_equals 90"
```

Wrangler validates duplicate rule priorities, duplicate variation names, malformed lists, non-finite numeric values such as `Infinity`, and unknown variation names before sending the request.

## Inspect flags

List flags in an app:

```sh
wrangler flagship flags list <APP_ID>
```

The list command is paginated. Use `--limit` and `--cursor` for manual pagination, or `--all` to fetch every page.

```sh
wrangler flagship flags list <APP_ID> --limit 50
wrangler flagship flags list <APP_ID> --cursor <CURSOR>
wrangler flagship flags list <APP_ID> --all
```

Inspect a full flag definition:

```sh
wrangler flagship flags get <APP_ID> new-checkout
```

`wrangler flagship flags ls` is an alias for `flags list`. `wrangler flagship flags inspect` is an alias for `flags get`.

## Update flags

`wrangler flagship flags update` reads the current flag, applies your changes, and writes the full flag definition back to the API.

### Update metadata and variations

```sh
wrangler flagship flags update <APP_ID> new-checkout \
	--description "Redesigned checkout experience"

wrangler flagship flags update <APP_ID> upload-limit \
	--set-variation team=500

wrangler flagship flags update <APP_ID> upload-limit \
	--remove-variation team
```

To add a variant to an existing flag, set a new variation name and value:

```sh
wrangler flagship flags update <APP_ID> checkout-flow \
	--set-variation experiment=new-checkout-v2
```

Pass an empty description to clear it:

```sh
wrangler flagship flags update <APP_ID> new-checkout --description ""
```

When you add or replace variations on an existing flag, use `--type` if Wrangler should coerce the new values to a specific type:

```sh
wrangler flagship flags update <APP_ID> upload-limit \
	--type number \
	--set-variation team=500
```

Wrangler validates that the resulting variation set still has a single value type and that the default variation and targeting rules still reference known variations.

You can also enable or disable a flag through `flags update`, although `flags enable` and `flags disable` are shorter for kill-switch workflows:

```sh
wrangler flagship flags update <APP_ID> new-checkout --disable
wrangler flagship flags update <APP_ID> new-checkout --enable
```

### Change the default variation

```sh
wrangler flagship flags set <APP_ID> checkout-flow --variation v2
```

Use `--clear-rules` if the new default should be served to everyone.

```sh
wrangler flagship flags set <APP_ID> checkout-flow --variation v2 --clear-rules
```

### Replace, append, or clear all rules

Use `--rule` or `--rule-json` to replace the full rule set:

```sh
wrangler flagship flags update <APP_ID> premium-banner \
	--rule "serve=on; when=plan equals pro AND country not_in [CN,RU]"
```

Use `--add-rule` or `--add-rule-json` to append rules without changing existing rules:

```sh
wrangler flagship flags update <APP_ID> premium-banner \
	--add-rule "serve=off; when=account_age less_than 7"

wrangler flagship flags update <APP_ID> premium-banner \
	--add-rule-json '{"serve_variation":"off","conditions":[{"attribute":"country","operator":"in","value":["CN","RU"]}]}'
```

Clear all rules:

```sh
wrangler flagship flags update <APP_ID> premium-banner --clear-rules
```

Note

Do not combine replacement flags (`--rule`, `--rule-json`) with append flags (`--add-rule`, `--add-rule-json`), or with `--clear-rules`, in the same command.

### List rules

Use `rules list` to see the priorities you can target with rule-specific commands:

```sh
wrangler flagship flags rules list <APP_ID> premium-banner
```

### Reorder rules

Flagship evaluates rules by ascending `priority`; the first matching rule wins. Use `rules reorder` to reorder existing rules without rewriting every condition.

Pass the existing priorities in the new order. Wrangler renumbers them to `1..n` in that order:

```sh
wrangler flagship flags rules reorder <APP_ID> rate-limit-tier --order 2,1
```

If the existing priorities were `1=strict` and `2=relaxed`, this makes `relaxed` priority `1` and `strict` priority `2`.

### Change one rule

Use `rules update` to edit one rule by priority while preserving the rest of the rule set.

Change only a rollout percentage:

```sh
wrangler flagship flags rules update <APP_ID> premium-banner \
	--priority 1 \
	--rollout 50%@user_id
```

Change the variation served by a rule:

```sh
wrangler flagship flags rules update <APP_ID> premium-banner \
	--priority 1 \
	--serve off
```

Change the conditions on a rule:

```sh
wrangler flagship flags rules update <APP_ID> premium-banner \
	--priority 1 \
	--when "plan equals enterprise OR plan equals team"
```

Remove conditions from a rule so it matches every evaluation context:

```sh
wrangler flagship flags rules update <APP_ID> premium-banner \
	--priority 1 \
	--clear-conditions
```

Caution

A rule with no conditions matches every evaluation context. Flagship requires unconditional rules to come after all rules that have conditions. If the rule you are clearing is not the last rule in the set, the API will reject the update with `Rules with empty conditions must come after rules with conditions`.

Use `rules reorder` first to move the rule to the last position, then clear its conditions. If you want to serve a single variation to everyone and discard all other rules, use `--clear-rules` on `flags set` instead.

Remove a rollout from a rule:

```sh
wrangler flagship flags rules update <APP_ID> premium-banner \
	--priority 1 \
	--clear-rollout
```

### Delete one rule

Use `rules delete` to remove one rule by priority:

```sh
wrangler flagship flags rules delete <APP_ID> premium-banner --priority 2
```

After deleting a rule, Wrangler renumbers the remaining rules so priorities stay contiguous.

## Run releases and kill switches

Note

After you change a flag, it can take up to 30 seconds for the updated value to reflect globally. During this propagation window, some evaluations may still return the previous flag value.

### Enable and disable

Disabling a flag is an immediate kill switch. A disabled flag ignores targeting rules and serves its default variation.

```sh
wrangler flagship flags disable <APP_ID> new-checkout
wrangler flagship flags enable <APP_ID> new-checkout
```

Enable or disable multiple flags in an app by passing the app ID followed by multiple keys:

```sh
wrangler flagship flags disable <APP_ID> new-checkout dark-mode premium-banner
wrangler flagship flags enable <APP_ID> new-checkout dark-mode premium-banner
```

### Roll out one variation

Use `rollout` to serve one variation to a percentage of traffic.

```sh
wrangler flagship flags rollout <APP_ID> new-checkout \
	--to on \
	--percentage 25 \
	--by user_id
```

Use `--from-variation` (alias `--from`) to choose the fallback variation for the remaining traffic. A rollout percentage of `0` removes the rollout rule and keeps the flag's current default variation unchanged.

`rollout` sends the percentage you provide directly to Flagship. For example, `--percentage 25 --to on` serves the `on` variation to 25% of bucketed traffic. The remaining traffic falls through to the flag's default variation.

### Split traffic across variations

Use `split` for A/B tests or multi-way traffic allocation. Wrangler converts weights into cumulative rollout thresholds.

```sh
wrangler flagship flags split <APP_ID> checkout-flow \
	--weight v1=80 \
	--weight v2=20 \
	--by user_id
```

`-w` is an alias for `--weight`. Each variation can only be weighted once, and weights must be finite, non-negative numbers.

Weights are relative. Wrangler totals the weights, converts each one into a percentage of the total, and sends cumulative thresholds to Flagship. For example, `--weight v1=80 --weight v2=20` sends two generated rules: one for `v1` with a rollout percentage of `80`, and one for `v2` with a rollout percentage of `100`. This creates bucket ranges of `0-80` for `v1` and `80-100` for `v2`.

With three weights, `--weight a=50 --weight b=30 --weight c=20` becomes cumulative thresholds of `50`, `80`, and `100`. Zero-weight variations are skipped.

Use `--default` with `split` to choose the fallback variation when bucketing cannot run:

```sh
wrangler flagship flags split <APP_ID> checkout-flow \
	--weight v1=80 \
	--weight v2=20 \
	--default v1 \
	--by user_id
```

Caution

`rollout` and `split` replace the flag's entire rule set with the rollout or split rules they generate. If the flag has other targeting rules built with `--rule`, `--rule-json`, `--add-rule`, or `rules update` (rules with real conditions, not just a previous rollout or split), Wrangler asks for confirmation before overwriting them. Pass `--force` (`-y`) to skip the prompt, or use `--json` with `--force` in scripts. Rules with no conditions, such as ones created by an earlier `rollout` or `split` call, are replaced without a prompt.

```sh
wrangler flagship flags rollout <APP_ID> new-checkout --to on --percentage 100 --force
```

## Evaluate flags

Evaluate a flag from the CLI to verify what a specific context receives.

```sh
wrangler flagship flags evaluate <APP_ID> new-checkout

wrangler flagship flags evaluate <APP_ID> new-checkout \
	--targeting-key user-42

wrangler flagship flags evaluate <APP_ID> premium-banner \
	--context plan=enterprise \
	--context country=US \
	--targeting-key user-99
```

Use `--targeting-key` for stable percentage rollout bucketing. Pass each context attribute with `--context name=value`. `wrangler flagship flags eval` is an alias for `flags evaluate`.

`--context` can be repeated. `--ctx` and `-C` are aliases:

```sh
wrangler flagship flags evaluate <APP_ID> premium-banner \
	-C plan=enterprise \
	-C country=US \
	--targeting-key user-99
```

Context values are sent to the evaluation endpoint as strings. Use the same attribute names that your targeting rules expect.

Evaluation output includes:

| Field   | Description                                                                |
| ------- | -------------------------------------------------------------------------- |
| value   | The flag value returned for the context.                                   |
| variant | The variation selected for the context.                                    |
| reason  | Why the value was returned: TARGETING\_MATCH, DEFAULT, DISABLED, or SPLIT. |

## Audit changes

Flagship records create, update, and delete events for each flag. View changelog history newest first:

```sh
wrangler flagship flags changelog <APP_ID> new-checkout
```

Use pagination controls for long histories:

```sh
wrangler flagship flags changelog <APP_ID> new-checkout --limit 10
wrangler flagship flags changelog <APP_ID> new-checkout --cursor <CURSOR>
wrangler flagship flags changelog <APP_ID> new-checkout --all
```

`wrangler flagship flags history` is an alias for `flags changelog`.

## Delete flags

```sh
wrangler flagship flags delete <APP_ID> coming-soon
```

Use `--force` or `-y` to skip the confirmation prompt. If you also use `--json`, you must pass `--force` so the confirmation prompt cannot appear in JSON output.

```sh
wrangler flagship flags delete <APP_ID> coming-soon --force
```

`wrangler flagship flags rm` is an alias for `flags delete`.

Delete multiple flags by passing the app ID followed by multiple keys:

```sh
wrangler flagship flags delete <APP_ID> coming-soon old-checkout temporary-banner --force
```

## Automate with JSON output

Every `wrangler flagship` command accepts `--json`. JSON output suppresses the Wrangler banner and is intended for scripts.

Delete commands require `--force` with `--json` to keep stdout valid JSON. `rollout` and `split` also require `--force` with `--json` if they would replace existing targeting rules that have conditions.

Bulk commands, such as `flags delete`, `flags enable`, and `flags disable`, continue processing remaining flags if one flag fails. In JSON mode, partial failures return a JSON error object containing successful `results` and per-flag `failures`.

Commands that can update `wrangler.json` or `wrangler.jsonc`, such as `apps create --binding`, do not prompt for or update configuration when `--json` is used.

Create an app, capture its ID, then create a flag:

```sh
APP_ID=$(wrangler flagship apps create checkout-service --json | jq -r '.id')

wrangler flagship flags create "$APP_ID" new-checkout --json
```

Delete several apps in a loop:

```sh
for app_id in <APP_ID_1> <APP_ID_2> <APP_ID_3>; do
	wrangler flagship apps delete "$app_id" --force
done
```

Or pass the app IDs directly:

```sh
wrangler flagship apps delete <APP_ID_1> <APP_ID_2> <APP_ID_3> --force
```

## Command reference

The following reference is generated from Wrangler's `flagship` command definitions.

## `flagship apps create`

Create a Flagship app

npmyarnpnpm

```
npx wrangler flagship apps create [NAME]
```

```
yarn wrangler flagship apps create [NAME]
```

```
pnpm wrangler flagship apps create [NAME]
```

* `[NAME]` `string` required  
The name of the app
* `--json` `boolean` default: false  
Return output as JSON
* `--use-remote` `boolean`  
Use a remote binding when adding the newly created resource to your config
* `--update-config` `boolean`  
Automatically update your config file with the newly added resource
* `--binding` `string`  
The binding name of this resource in your Worker

Global flags

* `--v` `boolean` alias: --version  
Show version number
* `--cwd` `string`  
Run as if Wrangler was started in the specified directory instead of the current working directory
* `--config` `string` alias: --c  
Path to Wrangler configuration file
* `--env` `string` alias: --e  
Environment to use for operations, and for selecting .env and .dev.vars files
* `--env-file` `string`  
Path to an .env file to load - can be specified multiple times - values from earlier files are overridden by values in later files
* `--experimental-provision` `boolean` aliases: --x-provisiondefault: true  
Experimental: Enable automatic resource provisioning
* `--experimental-auto-create` `boolean` alias: --x-auto-createdefault: true  
Automatically provision draft bindings with new resources
* `--install-skills` `boolean` default: false  
Install Cloudflare skills for detected AI coding agents before running the command
* `--profile` `string`  
Use a specific auth profile

## `flagship apps list`

List Flagship apps

npmyarnpnpm

```
npx wrangler flagship apps list
```

```
yarn wrangler flagship apps list
```

```
pnpm wrangler flagship apps list
```

* `--json` `boolean` default: false  
Return output as JSON

Global flags

* `--v` `boolean` alias: --version  
Show version number
* `--cwd` `string`  
Run as if Wrangler was started in the specified directory instead of the current working directory
* `--config` `string` alias: --c  
Path to Wrangler configuration file
* `--env` `string` alias: --e  
Environment to use for operations, and for selecting .env and .dev.vars files
* `--env-file` `string`  
Path to an .env file to load - can be specified multiple times - values from earlier files are overridden by values in later files
* `--experimental-provision` `boolean` aliases: --x-provisiondefault: true  
Experimental: Enable automatic resource provisioning
* `--experimental-auto-create` `boolean` alias: --x-auto-createdefault: true  
Automatically provision draft bindings with new resources
* `--install-skills` `boolean` default: false  
Install Cloudflare skills for detected AI coding agents before running the command
* `--profile` `string`  
Use a specific auth profile

## `flagship apps get`

Get a Flagship app

npmyarnpnpm

```
npx wrangler flagship apps get [APP-ID]
```

```
yarn wrangler flagship apps get [APP-ID]
```

```
pnpm wrangler flagship apps get [APP-ID]
```

* `[APP-ID]` `string` required  
The ID of the app
* `--json` `boolean` default: false  
Return output as JSON

Global flags

* `--v` `boolean` alias: --version  
Show version number
* `--cwd` `string`  
Run as if Wrangler was started in the specified directory instead of the current working directory
* `--config` `string` alias: --c  
Path to Wrangler configuration file
* `--env` `string` alias: --e  
Environment to use for operations, and for selecting .env and .dev.vars files
* `--env-file` `string`  
Path to an .env file to load - can be specified multiple times - values from earlier files are overridden by values in later files
* `--experimental-provision` `boolean` aliases: --x-provisiondefault: true  
Experimental: Enable automatic resource provisioning
* `--experimental-auto-create` `boolean` alias: --x-auto-createdefault: true  
Automatically provision draft bindings with new resources
* `--install-skills` `boolean` default: false  
Install Cloudflare skills for detected AI coding agents before running the command
* `--profile` `string`  
Use a specific auth profile

## `flagship apps update`

Update a Flagship app

npmyarnpnpm

```
npx wrangler flagship apps update [APP-ID]
```

```
yarn wrangler flagship apps update [APP-ID]
```

```
pnpm wrangler flagship apps update [APP-ID]
```

* `[APP-ID]` `string` required  
The ID of the app
* `--name` `string` required  
The new name of the app
* `--json` `boolean` default: false  
Return output as JSON

Global flags

* `--v` `boolean` alias: --version  
Show version number
* `--cwd` `string`  
Run as if Wrangler was started in the specified directory instead of the current working directory
* `--config` `string` alias: --c  
Path to Wrangler configuration file
* `--env` `string` alias: --e  
Environment to use for operations, and for selecting .env and .dev.vars files
* `--env-file` `string`  
Path to an .env file to load - can be specified multiple times - values from earlier files are overridden by values in later files
* `--experimental-provision` `boolean` aliases: --x-provisiondefault: true  
Experimental: Enable automatic resource provisioning
* `--experimental-auto-create` `boolean` alias: --x-auto-createdefault: true  
Automatically provision draft bindings with new resources
* `--install-skills` `boolean` default: false  
Install Cloudflare skills for detected AI coding agents before running the command
* `--profile` `string`  
Use a specific auth profile

## `flagship apps delete`

Delete a Flagship app

npmyarnpnpm

```
npx wrangler flagship apps delete [APP-ID]
```

```
yarn wrangler flagship apps delete [APP-ID]
```

```
pnpm wrangler flagship apps delete [APP-ID]
```

* `[APP-ID]` `string` required  
One or more app IDs to delete
* `--force` `boolean` alias: --ydefault: false  
Skip the confirmation prompt
* `--json` `boolean` default: false  
Return output as JSON

Global flags

* `--v` `boolean` alias: --version  
Show version number
* `--cwd` `string`  
Run as if Wrangler was started in the specified directory instead of the current working directory
* `--config` `string` alias: --c  
Path to Wrangler configuration file
* `--env` `string` alias: --e  
Environment to use for operations, and for selecting .env and .dev.vars files
* `--env-file` `string`  
Path to an .env file to load - can be specified multiple times - values from earlier files are overridden by values in later files
* `--experimental-provision` `boolean` aliases: --x-provisiondefault: true  
Experimental: Enable automatic resource provisioning
* `--experimental-auto-create` `boolean` alias: --x-auto-createdefault: true  
Automatically provision draft bindings with new resources
* `--install-skills` `boolean` default: false  
Install Cloudflare skills for detected AI coding agents before running the command
* `--profile` `string`  
Use a specific auth profile

## `flagship flags create`

Create a feature flag in a Flagship app

npmyarnpnpm

```
npx wrangler flagship flags create [APP-ID] [KEY]
```

```
yarn wrangler flagship flags create [APP-ID] [KEY]
```

```
pnpm wrangler flagship flags create [APP-ID] [KEY]
```

* `[APP-ID]` `string` required  
The ID of the app
* `[KEY]` `string` required  
The key of the flag
* `--variation` `string` alias: --V  
A flag variation, in the form "name=value" (repeatable)
* `--default-variation` `string` alias: --default  
The name of the variation to serve by default (defaults to off for boolean flags, otherwise the first variation)
* `--type` `string` alias: --t  
The variation value type (inferred when omitted)
* `--description` `string` alias: --d  
A description of the flag
* `--disabled` `boolean` default: false  
Create the flag in a disabled state
* `--rule` `string`  
A targeting rule, e.g. "serve=on; when=plan equals pro AND region in \[US,CA\]; rollout=30%@user\_id". Conditions support AND/OR; priority is optional and defaults to declaration order (repeatable)
* `--rule-json` `string`  
A targeting rule as a JSON object (repeatable)
* `--json` `boolean` default: false  
Return output as JSON

Global flags

* `--v` `boolean` alias: --version  
Show version number
* `--cwd` `string`  
Run as if Wrangler was started in the specified directory instead of the current working directory
* `--config` `string` alias: --c  
Path to Wrangler configuration file
* `--env` `string` alias: --e  
Environment to use for operations, and for selecting .env and .dev.vars files
* `--env-file` `string`  
Path to an .env file to load - can be specified multiple times - values from earlier files are overridden by values in later files
* `--experimental-provision` `boolean` aliases: --x-provisiondefault: true  
Experimental: Enable automatic resource provisioning
* `--experimental-auto-create` `boolean` alias: --x-auto-createdefault: true  
Automatically provision draft bindings with new resources
* `--install-skills` `boolean` default: false  
Install Cloudflare skills for detected AI coding agents before running the command
* `--profile` `string`  
Use a specific auth profile

## `flagship flags list`

List feature flags in a Flagship app

npmyarnpnpm

```
npx wrangler flagship flags list [APP-ID]
```

```
yarn wrangler flagship flags list [APP-ID]
```

```
pnpm wrangler flagship flags list [APP-ID]
```

* `[APP-ID]` `string` required  
The ID of the app
* `--limit` `number`  
The maximum number of flags to return (1-200)
* `--cursor` `string`  
The pagination cursor from a previous list call
* `--all` `boolean` default: false  
Fetch every flag, following pagination automatically
* `--json` `boolean` default: false  
Return output as JSON

Global flags

* `--v` `boolean` alias: --version  
Show version number
* `--cwd` `string`  
Run as if Wrangler was started in the specified directory instead of the current working directory
* `--config` `string` alias: --c  
Path to Wrangler configuration file
* `--env` `string` alias: --e  
Environment to use for operations, and for selecting .env and .dev.vars files
* `--env-file` `string`  
Path to an .env file to load - can be specified multiple times - values from earlier files are overridden by values in later files
* `--experimental-provision` `boolean` aliases: --x-provisiondefault: true  
Experimental: Enable automatic resource provisioning
* `--experimental-auto-create` `boolean` alias: --x-auto-createdefault: true  
Automatically provision draft bindings with new resources
* `--install-skills` `boolean` default: false  
Install Cloudflare skills for detected AI coding agents before running the command
* `--profile` `string`  
Use a specific auth profile

## `flagship flags get`

Get a feature flag from a Flagship app

npmyarnpnpm

```
npx wrangler flagship flags get [APP-ID] [KEY]
```

```
yarn wrangler flagship flags get [APP-ID] [KEY]
```

```
pnpm wrangler flagship flags get [APP-ID] [KEY]
```

* `[APP-ID]` `string` required  
The ID of the app
* `[KEY]` `string` required  
The key of the flag
* `--json` `boolean` default: false  
Return output as JSON

Global flags

* `--v` `boolean` alias: --version  
Show version number
* `--cwd` `string`  
Run as if Wrangler was started in the specified directory instead of the current working directory
* `--config` `string` alias: --c  
Path to Wrangler configuration file
* `--env` `string` alias: --e  
Environment to use for operations, and for selecting .env and .dev.vars files
* `--env-file` `string`  
Path to an .env file to load - can be specified multiple times - values from earlier files are overridden by values in later files
* `--experimental-provision` `boolean` aliases: --x-provisiondefault: true  
Experimental: Enable automatic resource provisioning
* `--experimental-auto-create` `boolean` alias: --x-auto-createdefault: true  
Automatically provision draft bindings with new resources
* `--install-skills` `boolean` default: false  
Install Cloudflare skills for detected AI coding agents before running the command
* `--profile` `string`  
Use a specific auth profile

## `flagship flags update`

Update a feature flag in a Flagship app

npmyarnpnpm

```
npx wrangler flagship flags update [APP-ID] [KEY]
```

```
yarn wrangler flagship flags update [APP-ID] [KEY]
```

```
pnpm wrangler flagship flags update [APP-ID] [KEY]
```

* `[APP-ID]` `string` required  
The ID of the app
* `[KEY]` `string` required  
The key of the flag
* `--enable` `boolean`  
Enable the flag
* `--disable` `boolean`  
Disable the flag
* `--description` `string` alias: --d  
A new description for the flag (pass "" to clear it)
* `--default-variation` `string` alias: --default  
The name of the variation to serve by default
* `--type` `string` alias: --t  
The value type used to coerce --set-variation values
* `--set-variation` `string`  
Add or replace a variation, in the form "name=value"
* `--remove-variation` `string`  
Remove a variation by name
* `--rule` `string`  
Replace the flag's targeting rules (repeatable)
* `--rule-json` `string`  
Replace the flag's targeting rules using JSON (repeatable)
* `--add-rule` `string`  
Append a targeting rule, keeping the existing rules (repeatable)
* `--add-rule-json` `string`  
Append a targeting rule using JSON, keeping the existing rules (repeatable)
* `--clear-rules` `boolean` default: false  
Remove all targeting rules
* `--json` `boolean` default: false  
Return output as JSON

Global flags

* `--v` `boolean` alias: --version  
Show version number
* `--cwd` `string`  
Run as if Wrangler was started in the specified directory instead of the current working directory
* `--config` `string` alias: --c  
Path to Wrangler configuration file
* `--env` `string` alias: --e  
Environment to use for operations, and for selecting .env and .dev.vars files
* `--env-file` `string`  
Path to an .env file to load - can be specified multiple times - values from earlier files are overridden by values in later files
* `--experimental-provision` `boolean` aliases: --x-provisiondefault: true  
Experimental: Enable automatic resource provisioning
* `--experimental-auto-create` `boolean` alias: --x-auto-createdefault: true  
Automatically provision draft bindings with new resources
* `--install-skills` `boolean` default: false  
Install Cloudflare skills for detected AI coding agents before running the command
* `--profile` `string`  
Use a specific auth profile

## `flagship flags set`

Set the default variation served by a feature flag

npmyarnpnpm

```
npx wrangler flagship flags set [APP-ID] [KEY]
```

```
yarn wrangler flagship flags set [APP-ID] [KEY]
```

```
pnpm wrangler flagship flags set [APP-ID] [KEY]
```

* `[APP-ID]` `string` required  
The ID of the app
* `[KEY]` `string` required  
The key of the flag
* `--variation` `string` aliases: --variant, --Vrequired  
The variation to serve by default
* `--clear-rules` `boolean` default: false  
Clear targeting rules so this variation is always served
* `--json` `boolean` default: false  
Return output as JSON

Global flags

* `--v` `boolean` alias: --version  
Show version number
* `--cwd` `string`  
Run as if Wrangler was started in the specified directory instead of the current working directory
* `--config` `string` alias: --c  
Path to Wrangler configuration file
* `--env` `string` alias: --e  
Environment to use for operations, and for selecting .env and .dev.vars files
* `--env-file` `string`  
Path to an .env file to load - can be specified multiple times - values from earlier files are overridden by values in later files
* `--experimental-provision` `boolean` aliases: --x-provisiondefault: true  
Experimental: Enable automatic resource provisioning
* `--experimental-auto-create` `boolean` alias: --x-auto-createdefault: true  
Automatically provision draft bindings with new resources
* `--install-skills` `boolean` default: false  
Install Cloudflare skills for detected AI coding agents before running the command
* `--profile` `string`  
Use a specific auth profile

## `flagship flags rules list`

List targeting rules for a feature flag

npmyarnpnpm

```
npx wrangler flagship flags rules list [APP-ID] [KEY]
```

```
yarn wrangler flagship flags rules list [APP-ID] [KEY]
```

```
pnpm wrangler flagship flags rules list [APP-ID] [KEY]
```

* `[APP-ID]` `string` required  
The ID of the app
* `[KEY]` `string` required  
The key of the flag
* `--json` `boolean` default: false  
Return output as JSON

Global flags

* `--v` `boolean` alias: --version  
Show version number
* `--cwd` `string`  
Run as if Wrangler was started in the specified directory instead of the current working directory
* `--config` `string` alias: --c  
Path to Wrangler configuration file
* `--env` `string` alias: --e  
Environment to use for operations, and for selecting .env and .dev.vars files
* `--env-file` `string`  
Path to an .env file to load - can be specified multiple times - values from earlier files are overridden by values in later files
* `--experimental-provision` `boolean` aliases: --x-provisiondefault: true  
Experimental: Enable automatic resource provisioning
* `--experimental-auto-create` `boolean` alias: --x-auto-createdefault: true  
Automatically provision draft bindings with new resources
* `--install-skills` `boolean` default: false  
Install Cloudflare skills for detected AI coding agents before running the command
* `--profile` `string`  
Use a specific auth profile

## `flagship flags rules update`

Update one targeting rule for a feature flag

npmyarnpnpm

```
npx wrangler flagship flags rules update [APP-ID] [KEY]
```

```
yarn wrangler flagship flags rules update [APP-ID] [KEY]
```

```
pnpm wrangler flagship flags rules update [APP-ID] [KEY]
```

* `[APP-ID]` `string` required  
The ID of the app
* `[KEY]` `string` required  
The key of the flag
* `--priority` `number` required  
The priority of the rule to update
* `--serve` `string`  
The variation to serve when this rule matches
* `--when` `string`  
The rule conditions, using the same syntax as --rule when=...
* `--clear-conditions` `boolean` default: false  
Remove conditions so the rule matches all contexts
* `--rollout` `string`  
The rollout, in the form "percentage" or "percentage%@attribute"
* `--clear-rollout` `boolean` default: false  
Remove the rollout from this rule
* `--json` `boolean` default: false  
Return output as JSON

Global flags

* `--v` `boolean` alias: --version  
Show version number
* `--cwd` `string`  
Run as if Wrangler was started in the specified directory instead of the current working directory
* `--config` `string` alias: --c  
Path to Wrangler configuration file
* `--env` `string` alias: --e  
Environment to use for operations, and for selecting .env and .dev.vars files
* `--env-file` `string`  
Path to an .env file to load - can be specified multiple times - values from earlier files are overridden by values in later files
* `--experimental-provision` `boolean` aliases: --x-provisiondefault: true  
Experimental: Enable automatic resource provisioning
* `--experimental-auto-create` `boolean` alias: --x-auto-createdefault: true  
Automatically provision draft bindings with new resources
* `--install-skills` `boolean` default: false  
Install Cloudflare skills for detected AI coding agents before running the command
* `--profile` `string`  
Use a specific auth profile

## `flagship flags rules delete`

Delete one targeting rule from a feature flag

npmyarnpnpm

```
npx wrangler flagship flags rules delete [APP-ID] [KEY]
```

```
yarn wrangler flagship flags rules delete [APP-ID] [KEY]
```

```
pnpm wrangler flagship flags rules delete [APP-ID] [KEY]
```

* `[APP-ID]` `string` required  
The ID of the app
* `[KEY]` `string` required  
The key of the flag
* `--priority` `number` required  
The priority of the rule to delete
* `--json` `boolean` default: false  
Return output as JSON

Global flags

* `--v` `boolean` alias: --version  
Show version number
* `--cwd` `string`  
Run as if Wrangler was started in the specified directory instead of the current working directory
* `--config` `string` alias: --c  
Path to Wrangler configuration file
* `--env` `string` alias: --e  
Environment to use for operations, and for selecting .env and .dev.vars files
* `--env-file` `string`  
Path to an .env file to load - can be specified multiple times - values from earlier files are overridden by values in later files
* `--experimental-provision` `boolean` aliases: --x-provisiondefault: true  
Experimental: Enable automatic resource provisioning
* `--experimental-auto-create` `boolean` alias: --x-auto-createdefault: true  
Automatically provision draft bindings with new resources
* `--install-skills` `boolean` default: false  
Install Cloudflare skills for detected AI coding agents before running the command
* `--profile` `string`  
Use a specific auth profile

## `flagship flags rules reorder`

Reorder targeting rules for a feature flag

npmyarnpnpm

```
npx wrangler flagship flags rules reorder [APP-ID] [KEY]
```

```
yarn wrangler flagship flags rules reorder [APP-ID] [KEY]
```

```
pnpm wrangler flagship flags rules reorder [APP-ID] [KEY]
```

* `[APP-ID]` `string` required  
The ID of the app
* `[KEY]` `string` required  
The key of the flag
* `--order` `string` required  
Comma-separated existing rule priorities in their new order, for example 2,1,3
* `--json` `boolean` default: false  
Return output as JSON

Global flags

* `--v` `boolean` alias: --version  
Show version number
* `--cwd` `string`  
Run as if Wrangler was started in the specified directory instead of the current working directory
* `--config` `string` alias: --c  
Path to Wrangler configuration file
* `--env` `string` alias: --e  
Environment to use for operations, and for selecting .env and .dev.vars files
* `--env-file` `string`  
Path to an .env file to load - can be specified multiple times - values from earlier files are overridden by values in later files
* `--experimental-provision` `boolean` aliases: --x-provisiondefault: true  
Experimental: Enable automatic resource provisioning
* `--experimental-auto-create` `boolean` alias: --x-auto-createdefault: true  
Automatically provision draft bindings with new resources
* `--install-skills` `boolean` default: false  
Install Cloudflare skills for detected AI coding agents before running the command
* `--profile` `string`  
Use a specific auth profile

## `flagship flags split`

Split traffic across variations by percentage

npmyarnpnpm

```
npx wrangler flagship flags split [APP-ID] [KEY]
```

```
yarn wrangler flagship flags split [APP-ID] [KEY]
```

```
pnpm wrangler flagship flags split [APP-ID] [KEY]
```

* `[APP-ID]` `string` required  
The ID of the app
* `[KEY]` `string` required  
The key of the flag
* `--weight` `string` alias: --w  
A variation weight, in the form "variation=weight" (repeatable)
* `--by` `string`  
Context attribute used for sticky bucketing
* `--default-variation` `string` alias: --default  
Fallback variation when bucketing cannot run
* `--force` `boolean` alias: --ydefault: false  
Skip the confirmation prompt when this split replaces existing targeting rules
* `--json` `boolean` default: false  
Return output as JSON

Global flags

* `--v` `boolean` alias: --version  
Show version number
* `--cwd` `string`  
Run as if Wrangler was started in the specified directory instead of the current working directory
* `--config` `string` alias: --c  
Path to Wrangler configuration file
* `--env` `string` alias: --e  
Environment to use for operations, and for selecting .env and .dev.vars files
* `--env-file` `string`  
Path to an .env file to load - can be specified multiple times - values from earlier files are overridden by values in later files
* `--experimental-provision` `boolean` aliases: --x-provisiondefault: true  
Experimental: Enable automatic resource provisioning
* `--experimental-auto-create` `boolean` alias: --x-auto-createdefault: true  
Automatically provision draft bindings with new resources
* `--install-skills` `boolean` default: false  
Install Cloudflare skills for detected AI coding agents before running the command
* `--profile` `string`  
Use a specific auth profile

## `flagship flags rollout`

Roll out one variation to a percentage of traffic

npmyarnpnpm

```
npx wrangler flagship flags rollout [APP-ID] [KEY]
```

```
yarn wrangler flagship flags rollout [APP-ID] [KEY]
```

```
pnpm wrangler flagship flags rollout [APP-ID] [KEY]
```

* `[APP-ID]` `string` required  
The ID of the app
* `[KEY]` `string` required  
The key of the flag
* `--to` `string` required  
Variation to roll out
* `--percentage` `number` required  
Percentage of traffic to serve the rollout variation (0-100)
* `--by` `string`  
Context attribute used for sticky bucketing
* `--from-variation` `string` alias: --from  
Fallback variation for the remaining traffic
* `--force` `boolean` alias: --ydefault: false  
Skip the confirmation prompt when this rollout replaces existing targeting rules
* `--json` `boolean` default: false  
Return output as JSON

Global flags

* `--v` `boolean` alias: --version  
Show version number
* `--cwd` `string`  
Run as if Wrangler was started in the specified directory instead of the current working directory
* `--config` `string` alias: --c  
Path to Wrangler configuration file
* `--env` `string` alias: --e  
Environment to use for operations, and for selecting .env and .dev.vars files
* `--env-file` `string`  
Path to an .env file to load - can be specified multiple times - values from earlier files are overridden by values in later files
* `--experimental-provision` `boolean` aliases: --x-provisiondefault: true  
Experimental: Enable automatic resource provisioning
* `--experimental-auto-create` `boolean` alias: --x-auto-createdefault: true  
Automatically provision draft bindings with new resources
* `--install-skills` `boolean` default: false  
Install Cloudflare skills for detected AI coding agents before running the command
* `--profile` `string`  
Use a specific auth profile

## `flagship flags enable`

Enable a feature flag

npmyarnpnpm

```
npx wrangler flagship flags enable [APP-ID] [KEY]
```

```
yarn wrangler flagship flags enable [APP-ID] [KEY]
```

```
pnpm wrangler flagship flags enable [APP-ID] [KEY]
```

* `[APP-ID]` `string` required  
The ID of the app
* `[KEY]` `string` required  
One or more flag keys to enable
* `--json` `boolean` default: false  
Return output as JSON

Global flags

* `--v` `boolean` alias: --version  
Show version number
* `--cwd` `string`  
Run as if Wrangler was started in the specified directory instead of the current working directory
* `--config` `string` alias: --c  
Path to Wrangler configuration file
* `--env` `string` alias: --e  
Environment to use for operations, and for selecting .env and .dev.vars files
* `--env-file` `string`  
Path to an .env file to load - can be specified multiple times - values from earlier files are overridden by values in later files
* `--experimental-provision` `boolean` aliases: --x-provisiondefault: true  
Experimental: Enable automatic resource provisioning
* `--experimental-auto-create` `boolean` alias: --x-auto-createdefault: true  
Automatically provision draft bindings with new resources
* `--install-skills` `boolean` default: false  
Install Cloudflare skills for detected AI coding agents before running the command
* `--profile` `string`  
Use a specific auth profile

## `flagship flags disable`

Disable a feature flag

npmyarnpnpm

```
npx wrangler flagship flags disable [APP-ID] [KEY]
```

```
yarn wrangler flagship flags disable [APP-ID] [KEY]
```

```
pnpm wrangler flagship flags disable [APP-ID] [KEY]
```

* `[APP-ID]` `string` required  
The ID of the app
* `[KEY]` `string` required  
One or more flag keys to disable
* `--json` `boolean` default: false  
Return output as JSON

Global flags

* `--v` `boolean` alias: --version  
Show version number
* `--cwd` `string`  
Run as if Wrangler was started in the specified directory instead of the current working directory
* `--config` `string` alias: --c  
Path to Wrangler configuration file
* `--env` `string` alias: --e  
Environment to use for operations, and for selecting .env and .dev.vars files
* `--env-file` `string`  
Path to an .env file to load - can be specified multiple times - values from earlier files are overridden by values in later files
* `--experimental-provision` `boolean` aliases: --x-provisiondefault: true  
Experimental: Enable automatic resource provisioning
* `--experimental-auto-create` `boolean` alias: --x-auto-createdefault: true  
Automatically provision draft bindings with new resources
* `--install-skills` `boolean` default: false  
Install Cloudflare skills for detected AI coding agents before running the command
* `--profile` `string`  
Use a specific auth profile

## `flagship flags evaluate`

Evaluate a feature flag with optional context

npmyarnpnpm

```
npx wrangler flagship flags evaluate [APP-ID] [KEY]
```

```
yarn wrangler flagship flags evaluate [APP-ID] [KEY]
```

```
pnpm wrangler flagship flags evaluate [APP-ID] [KEY]
```

* `[APP-ID]` `string` required  
The ID of the app
* `[KEY]` `string` required  
The key of the flag
* `--context` `string` aliases: --ctx, --C  
Evaluation context, in the form "name=value" (repeatable)
* `--targeting-key` `string`  
Stable bucketing key for percentage rollouts
* `--json` `boolean` default: false  
Return output as JSON

Global flags

* `--v` `boolean` alias: --version  
Show version number
* `--cwd` `string`  
Run as if Wrangler was started in the specified directory instead of the current working directory
* `--config` `string` alias: --c  
Path to Wrangler configuration file
* `--env` `string` alias: --e  
Environment to use for operations, and for selecting .env and .dev.vars files
* `--env-file` `string`  
Path to an .env file to load - can be specified multiple times - values from earlier files are overridden by values in later files
* `--experimental-provision` `boolean` aliases: --x-provisiondefault: true  
Experimental: Enable automatic resource provisioning
* `--experimental-auto-create` `boolean` alias: --x-auto-createdefault: true  
Automatically provision draft bindings with new resources
* `--install-skills` `boolean` default: false  
Install Cloudflare skills for detected AI coding agents before running the command
* `--profile` `string`  
Use a specific auth profile

## `flagship flags delete`

Delete a feature flag from a Flagship app

npmyarnpnpm

```
npx wrangler flagship flags delete [APP-ID] [KEY]
```

```
yarn wrangler flagship flags delete [APP-ID] [KEY]
```

```
pnpm wrangler flagship flags delete [APP-ID] [KEY]
```

* `[APP-ID]` `string` required  
The ID of the app
* `[KEY]` `string` required  
One or more flag keys to delete
* `--force` `boolean` alias: --ydefault: false  
Skip the confirmation prompt
* `--json` `boolean` default: false  
Return output as JSON

Global flags

* `--v` `boolean` alias: --version  
Show version number
* `--cwd` `string`  
Run as if Wrangler was started in the specified directory instead of the current working directory
* `--config` `string` alias: --c  
Path to Wrangler configuration file
* `--env` `string` alias: --e  
Environment to use for operations, and for selecting .env and .dev.vars files
* `--env-file` `string`  
Path to an .env file to load - can be specified multiple times - values from earlier files are overridden by values in later files
* `--experimental-provision` `boolean` aliases: --x-provisiondefault: true  
Experimental: Enable automatic resource provisioning
* `--experimental-auto-create` `boolean` alias: --x-auto-createdefault: true  
Automatically provision draft bindings with new resources
* `--install-skills` `boolean` default: false  
Install Cloudflare skills for detected AI coding agents before running the command
* `--profile` `string`  
Use a specific auth profile

## `flagship flags changelog`

Show the changelog for a feature flag

npmyarnpnpm

```
npx wrangler flagship flags changelog [APP-ID] [KEY]
```

```
yarn wrangler flagship flags changelog [APP-ID] [KEY]
```

```
pnpm wrangler flagship flags changelog [APP-ID] [KEY]
```

* `[APP-ID]` `string` required  
The ID of the app
* `[KEY]` `string` required  
The key of the flag
* `--limit` `number`  
The maximum number of entries to return (1-200)
* `--cursor` `string`  
The pagination cursor from a previous changelog call
* `--all` `boolean` default: false  
Fetch every entry, following pagination automatically
* `--json` `boolean` default: false  
Return output as JSON

Global flags

* `--v` `boolean` alias: --version  
Show version number
* `--cwd` `string`  
Run as if Wrangler was started in the specified directory instead of the current working directory
* `--config` `string` alias: --c  
Path to Wrangler configuration file
* `--env` `string` alias: --e  
Environment to use for operations, and for selecting .env and .dev.vars files
* `--env-file` `string`  
Path to an .env file to load - can be specified multiple times - values from earlier files are overridden by values in later files
* `--experimental-provision` `boolean` aliases: --x-provisiondefault: true  
Experimental: Enable automatic resource provisioning
* `--experimental-auto-create` `boolean` alias: --x-auto-createdefault: true  
Automatically provision draft bindings with new resources
* `--install-skills` `boolean` default: false  
Install Cloudflare skills for detected AI coding agents before running the command
* `--profile` `string`  
Use a specific auth profile

Was this helpful?

YesNo

## On this page

[![](https://developers.cloudflare.com/_astro/logo.te5VL_aD.svg)Docs](https://developers.cloudflare.com/)

```json
{"@context":"https://schema.org","@type":"TechArticle","@id":"https://developers.cloudflare.com/flagship/reference/wrangler-commands/#page","headline":"Wrangler commands · Cloudflare Flagship docs","description":"Use wrangler flagship to create apps, manage feature flags, configure targeting rules, run rollouts, evaluate flags, and inspect changelog history.","url":"https://developers.cloudflare.com/flagship/reference/wrangler-commands/","inLanguage":"en","image":"https://developers.cloudflare.com/og-docs.png","dateModified":"2026-07-16","publisher":{"@type":"Organization","name":"Cloudflare","description":"One platform for your apps, agents, and workforce. Build, secure, and scale without managing infrastructure","url":"https://www.cloudflare.com/","sameAs":["https://github.com/cloudflare","https://www.linkedin.com/company/cloudflare","https://x.com/cloudflare"],"logo":{"@type":"ImageObject","url":"https://developers.cloudflare.com/logo.svg"},"address":{"@type":"PostalAddress","streetAddress":"101 Townsend St","addressLocality":"San Francisco","addressRegion":"CA","postalCode":"94107","addressCountry":"US"},"contactPoint":[{"@type":"ContactPoint","contactType":"Customer Support","url":"https://support.cloudflare.com/","availableLanguage":["English"]},{"@type":"ContactPoint","contactType":"Sales","url":"https://www.cloudflare.com/contact/","availableLanguage":["English"]}]},"isPartOf":{"@type":"WebSite","@id":"https://developers.cloudflare.com/#website","name":"Cloudflare Docs","url":"https://developers.cloudflare.com/"}}
```
