Skip to content
Start here

List flags

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

Lists an app’s flags ordered by key. Pass cursor from result_info to page forward; a null cursor indicates the last page.

Security
API Token

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

Example:Authorization: Bearer Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY
API Email + API Key

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

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

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

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

Cloudflare account ID that owns the Flagship app.

app_id: string

Flagship app ID returned when the app was created.

Query ParametersExpand Collapse
cursor: optional string

Pagination cursor from a previous response.

limit: optional number

Max items to return (1–200).

maximum200
minimum1
ReturnsExpand Collapse
errors: array of object { message }
message: string
messages: array of object { message }
message: string
result: array of object { default_variation, enabled, key, 7 more }
default_variation: string

Variation the API serves when the flag is off, or when it’s on but no rule matches the context. Must be a key in variations.

minLength1
enabled: boolean

When false, the flag bypasses all rules and always serves default_variation.

key: string

Unique identifier for the flag within an app. Used in all evaluation and SDK calls.

maxLength64
minLength1
rules: array of object { conditions, priority, serve_variation, rollout }

Targeting rules evaluated in ascending priority; the first matching rule wins. An empty array means the flag always serves default_variation.

conditions: array of object { attribute, operator, value } or object { clauses, logical_operator }

Conditions the context must satisfy for this rule to match. An empty array matches all contexts.

One of the following:
FlagshipBaseCondition object { attribute, operator, value }
attribute: string
maxLength64
minLength1
operator: "equals" or "not_equals" or "greater_than" or 10 more
One of the following:
"equals"
"not_equals"
"greater_than"
"less_than"
"greater_than_or_equals"
"less_than_or_equals"
"contains"
"starts_with"
"ends_with"
"in"
"not_in"
"has"
"not_has"
value: string or number or boolean or 2 more
One of the following:
string
number
boolean
map[unknown]
array of unknown
FlagshipLogicalCondition object { clauses, logical_operator }
clauses: array of object { attribute, operator, value } or object { clauses, logical_operator }
One of the following:
FlagshipBaseCondition object { attribute, operator, value }
attribute: string
maxLength64
minLength1
operator: "equals" or "not_equals" or "greater_than" or 10 more
One of the following:
"equals"
"not_equals"
"greater_than"
"less_than"
"greater_than_or_equals"
"less_than_or_equals"
"contains"
"starts_with"
"ends_with"
"in"
"not_in"
"has"
"not_has"
value: string or number or boolean or 2 more
One of the following:
string
number
boolean
map[unknown]
array of unknown
FlagshipLogicalCondition1 object { clauses, logical_operator }
clauses: array of object { attribute, operator, value } or object { clauses, logical_operator }
One of the following:
FlagshipBaseCondition object { attribute, operator, value }
attribute: string
maxLength64
minLength1
operator: "equals" or "not_equals" or "greater_than" or 10 more
One of the following:
"equals"
"not_equals"
"greater_than"
"less_than"
"greater_than_or_equals"
"less_than_or_equals"
"contains"
"starts_with"
"ends_with"
"in"
"not_in"
"has"
"not_has"
value: string or number or boolean or 2 more
One of the following:
string
number
boolean
map[unknown]
array of unknown
FlagshipLogicalCondition2 object { clauses, logical_operator }
clauses: array of object { attribute, operator, value } or object { clauses, logical_operator }
One of the following:
FlagshipBaseCondition object { attribute, operator, value }
attribute: string
maxLength64
minLength1
operator: "equals" or "not_equals" or "greater_than" or 10 more
One of the following:
"equals"
"not_equals"
"greater_than"
"less_than"
"greater_than_or_equals"
"less_than_or_equals"
"contains"
"starts_with"
"ends_with"
"in"
"not_in"
"has"
"not_has"
value: string or number or boolean or 2 more
One of the following:
string
number
boolean
map[unknown]
array of unknown
FlagshipLogicalCondition3 object { clauses, logical_operator }
clauses: array of object { attribute, operator, value } or object { clauses, logical_operator }
One of the following:
FlagshipBaseCondition object { attribute, operator, value }
attribute: string
maxLength64
minLength1
operator: "equals" or "not_equals" or "greater_than" or 10 more
One of the following:
"equals"
"not_equals"
"greater_than"
"less_than"
"greater_than_or_equals"
"less_than_or_equals"
"contains"
"starts_with"
"ends_with"
"in"
"not_in"
"has"
"not_has"
value: string or number or boolean or 2 more
One of the following:
string
number
boolean
map[unknown]
array of unknown
FlagshipLogicalCondition4 object { clauses, logical_operator }
clauses: array of object { attribute, operator, value }
attribute: string
maxLength64
minLength1
operator: "equals" or "not_equals" or "greater_than" or 10 more
One of the following:
"equals"
"not_equals"
"greater_than"
"less_than"
"greater_than_or_equals"
"less_than_or_equals"
"contains"
"starts_with"
"ends_with"
"in"
"not_in"
"has"
"not_has"
value: string or number or boolean or 2 more
One of the following:
string
number
boolean
map[unknown]
array of unknown
logical_operator: "AND" or "OR"
One of the following:
"AND"
"OR"
logical_operator: "AND" or "OR"
One of the following:
"AND"
"OR"
logical_operator: "AND" or "OR"
One of the following:
"AND"
"OR"
logical_operator: "AND" or "OR"
One of the following:
"AND"
"OR"
logical_operator: "AND" or "OR"
One of the following:
"AND"
"OR"
priority: number

Evaluation order: the API evaluates rules with lower numbers first. Must be unique across the flag’s rules.

minimum1
serve_variation: string

Variation the API serves when this rule matches. Must be a key in variations.

minLength1
rollout: optional object { percentage, attribute }
percentage: number

Percentage of matching traffic (0–100, up to 2 decimal places) served this variation. For multi-way splits, use cumulative upper bounds across rules (e.g. 30, 70, 100).

maximum100
minimum0
multipleOf0.01
attribute: optional string

Context attribute used for sticky bucketing. Defaults to targetingKey. If absent at evaluation time, bucketing is random per request.

maxLength64
minLength1
type: "boolean" or "string" or "number" or "json"

Server-inferred value type shared by all of the flag’s variations.

One of the following:
"boolean"
"string"
"number"
"json"
variations: map[string or number or boolean or 2 more]

Map of variation name to value. All values share the same type (boolean, string, number, or JSON object/array), and each serialized value stays within 10KB.

One of the following:
string
number
boolean
map[unknown]
array of unknown
description: optional string

Optional operator-facing description. It does not affect flag evaluation.

maxLength512
metadata: optional map[boolean or string or number]

Key-value metadata associated with the flag. Returned only when the flag has metadata.

One of the following:
boolean
string
number
updated_at: optional string
updated_by: optional string
result_info: object { count, cursor }
count: number

Number of items returned in this page.

minimum0
cursor: string

Cursor to pass back to fetch the next page, or null when this is the last page.

success: boolean

List flags

curl https://api.cloudflare.com/client/v4/accounts/$ACCOUNT_ID/flagship/apps/$APP_ID/flags \
    -H "Authorization: Bearer $CLOUDFLARE_API_TOKEN"
{
  "errors": [
    {
      "message": "message"
    }
  ],
  "messages": [
    {
      "message": "message"
    }
  ],
  "result": [
    {
      "default_variation": "x",
      "enabled": true,
      "key": "x",
      "rules": [
        {
          "conditions": [
            {
              "attribute": "x",
              "operator": "equals",
              "value": "string"
            }
          ],
          "priority": 1,
          "serve_variation": "x",
          "rollout": {
            "percentage": 0,
            "attribute": "x"
          }
        }
      ],
      "type": "boolean",
      "variations": {
        "foo": "string"
      },
      "description": "description",
      "metadata": {
        "foo": true
      },
      "updated_at": "updated_at",
      "updated_by": "updated_by"
    }
  ],
  "result_info": {
    "count": 0,
    "cursor": "cursor"
  },
  "success": true
}
Returns Examples
{
  "errors": [
    {
      "message": "message"
    }
  ],
  "messages": [
    {
      "message": "message"
    }
  ],
  "result": [
    {
      "default_variation": "x",
      "enabled": true,
      "key": "x",
      "rules": [
        {
          "conditions": [
            {
              "attribute": "x",
              "operator": "equals",
              "value": "string"
            }
          ],
          "priority": 1,
          "serve_variation": "x",
          "rollout": {
            "percentage": 0,
            "attribute": "x"
          }
        }
      ],
      "type": "boolean",
      "variations": {
        "foo": "string"
      },
      "description": "description",
      "metadata": {
        "foo": true
      },
      "updated_at": "updated_at",
      "updated_by": "updated_by"
    }
  ],
  "result_info": {
    "count": 0,
    "cursor": "cursor"
  },
  "success": true
}