Flagship supports two kinds of API tokens. Both use the same Create API 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.
API tokens are secrets. Do not put them in client-side or public-facing code.
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 before you can create an app-scoped token. The dashboard can only list apps that already exist.
Create an account-wide Flagship token ↗ 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:
-
In the Cloudflare dashboard, go to the Account API tokens page.
Go to Account API tokens ↗You can also create a user token from My Profile ↗ > API Tokens.
-
Select Create Token.
-
Select Create Custom Token > Get started.
-
Enter a token name.
-
Under Permission policies, leave the resource dropdown set to Entire Account.
-
Search for Flagship and select Flagship Evaluate, Flagship Read, or Flagship Write.
-
(Optional) Restrict the token with IP address filtering or a TTL.
-
Select Review token > Create Token.
-
Copy the token secret and store it securely.
Create an app-scoped Flagship token ↗ 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:
-
In the Cloudflare dashboard, go to the Account API tokens page.
Go to Account API tokens ↗You can also create a user token from My Profile ↗ > API Tokens.
-
Select Create Token.
-
Select Create Custom Token > Get started.
-
Enter a token name that describes where you will use it, such as
checkout-service-ci. -
Under Permission policies, open the resource dropdown (it defaults to Entire Account) and select Specified Flagship apps.
-
In Select Flagship apps, choose the app or apps this token should access.
-
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 -
(Optional) Restrict the token with IP address filtering or a TTL.
-
Select Review token > Create Token.
-
Copy the token secret and store it securely.
Pass the token to an OpenFeature SDK as authToken (TypeScript) or the equivalent option in Python and Go.
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. The binding authenticates automatically and does not need an API token.
- Set up the TypeScript Server SDK outside of Workers.
- Restrict token use with IP filtering or a TTL.