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

# List Flag

> List all flags optionally filtered by state. The flags are ordered by
 `updateTime`.



## OpenAPI

````yaml /api/flags/api/flag.openapi.json get /v1/flags
openapi: 3.1.0
info:
  title: Confidence Flag API
  version: 1.0.0
  description: API documentation for flag
servers: []
security: []
paths:
  /v1/flags:
    get:
      summary: List Flag
      description: |-
        List all flags optionally filtered by state. The flags are ordered by
         `updateTime`.
      operationId: Flag.list
      parameters:
        - name: pageSize
          in: query
          required: false
          description: The maximum number of flags to fetch.
          schema:
            type: object
        - name: pageToken
          in: query
          required: false
          description: Token used for pagination.
          schema:
            type: string
        - name: filter
          in: query
          required: false
          description: >-
            Filter to apply to the flags. This follows the lucene query string
            format
          schema:
            type: string
        - name: orderBy
          in: query
          required: false
          description: Sort each column of the flags table.
          schema:
            type: string
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                type: object
                properties:
                  flags:
                    type: array
                    items:
                      $ref: '#/components/schemas/confidence.flags.admin.v1.Flag'
                    description: '[Flag](/api-reference/schemas/flag): List of flags.'
                  nextPageToken:
                    type: string
                    description: >-
                      A token that can be used to fetch more flags, empty if no
                      more flags
                       are available.
                required:
                  - flags
      security:
        - admin: []
      servers:
        - url: https://flags.eu.confidence.dev
        - url: https://flags.us.confidence.dev
        - url: https://flags.confidence.dev
components:
  schemas:
    confidence.flags.admin.v1.Flag:
      title: Flag
      type: object
      description: A flag controlling how entities are assigned variants.
      properties:
        name:
          type: string
          description: |-
            The resource name of the flag.
             For example:
             `flags/my-flag`
        displayName:
          type: string
          description: |-
            The display name of the flag.
             For example:
             `my-flag`
        description:
          type: string
          description: A description for the flag.
        schema:
          type: object
          properties:
            schema:
              type: array
              items:
                type: object
                additionalProperties:
                  $ref: '#/components/schemas/confidence.flags.types.v1.FlagSchema'
              description: Map of field name to the schema for the field
          description: Schema for the value of each variant.
        variants:
          type: array
          items:
            $ref: '#/components/schemas/confidence.flags.admin.v1.Flag.Variant'
          description: >-
            [Flag.Variant](/api-reference/schemas/flag-variant): List of
            variants for this flag. When a client resolves this flag, it will
             be assigned exactly one of the variants in this list along with its value.
             
        state:
          type: string
          enum:
            - STATE_UNSPECIFIED
            - ACTIVE
            - ARCHIVED
          description: The current state of the flag.
        rules:
          type: array
          items:
            $ref: '#/components/schemas/confidence.flags.admin.v1.Flag.Rule'
          description: >-
            [Flag.Rule](/api-reference/schemas/flag-rule): List of ordered rules
            that determines how entities are assigned to
             variants. When a client resolves this flag, each rule will be tried in
             order, the first rule that match, will provide a variant assignment. If
             not rule matches, no variant will be assigned.
             
        clients:
          type: array
          items:
            type: string
          description: List of clients that this flag is enabled for.
        createTime:
          type: object
          description: Time when the flag was first created.
        updateTime:
          type: object
          description: Time when the flag was last updated.
        archiveTime:
          type: object
          description: Time when the flag was archived.
        creator:
          type: string
          description: Reference to the identity that created this flag.
        updater:
          type: string
          description: Reference to the identity that last updated this flag.
        labels:
          type: array
          items:
            type: object
            additionalProperties:
              type: string
          description: General labels for this flag.
        usageMetadata:
          type: object
          properties:
            resolveCount:
              type: integer
              description: The total number of resolves of this flag.
            lastResolveTime:
              type: object
              description: The last time this flag was resolved.
            lastApplyTime:
              type: object
              description: The last time this flag was applied.
          description: Semi-realtime usage statistics for the flag.
        owner:
          type: string
          description: The owner of the resource. If not set will default to the creator.
      required:
        - displayName
        - state
        - createTime
        - updateTime
        - creator
        - updater
    confidence.flags.types.v1.FlagSchema:
      title: FlagSchema
      type: object
      description: |-
        Schema for the value of a flag.

         The value of a flag is always a struct with one or more nested fields.
         Example of a struct schema with two fields, `color` (a string) and `len` (an int):

         ```
         {
           "schema": {
             "color": {
               "stringSchema": {}
             },
             "len": {
               "intSchema": {}
             }
           }
         }
         ```
      properties:
        structSchema:
          type: object
          properties:
            schema:
              type: array
              items:
                type: object
                additionalProperties:
                  $ref: '#/components/schemas/confidence.flags.types.v1.FlagSchema'
              description: Map of field name to the schema for the field
          description: Schema if this is a struct
        listSchema:
          type: object
          properties:
            elementSchema:
              $ref: '#/components/schemas/confidence.flags.types.v1.FlagSchema'
              description: The schema for the elements in the list
          description: Schema if this is a list
        intSchema:
          type: object
          description: Schema if this is an int
        doubleSchema:
          type: object
          description: Schema if this is a double
        stringSchema:
          type: object
          description: Schema if this is a string
        boolSchema:
          type: object
          description: Schema if this is a bool
    confidence.flags.admin.v1.Flag.Variant:
      title: Flag.Variant
      type: object
      description: A possible named value the flag can assign.
      properties:
        name:
          type: string
          description: |-
            The resource name of the variant.
             For example:
             `flags/my-flag/variants/control`
        value:
          type: object
          description: >-
            The value that this variant represents. A possibly nested json
            object.
        labels:
          type: array
          items:
            type: object
            additionalProperties:
              type: string
          description: General set of labels for this resource.
        description:
          type: string
          description: A human-friendly description of the variant.
        imageUri:
          type: string
          description: An image URL or path for the variant.
        createTime:
          type: object
          description: Time when the flag was first created.
        updateTime:
          type: object
          description: Time when the flag was last updated.
        creator:
          type: string
          description: Reference to the identity that created this variant.
        updater:
          type: string
          description: Reference to the identity that last updated this variant.
      required:
        - name
        - value
        - createTime
        - updateTime
        - creator
        - updater
    confidence.flags.admin.v1.Flag.Rule:
      title: Flag.Rule
      type: object
      description: A rule that decides how a subset of the flags variants are assigned.
      properties:
        name:
          type: string
          description: |-
            The resource name of the rule.
             For example:
             `flags/my-flag/rules/1bhq4c2zqigdzqg6ufni`
        description:
          type: string
          description: A description for the rule.
        segment:
          type: string
          description: |-
            A reference to the segment that this rule uses to specify entities
             that are eligible.
        assignmentSpec:
          type: object
          properties:
            bucketCount:
              type: object
              description: The total number of buckets to consider when randomizing.
            assignments:
              type: array
              items:
                type: object
                properties:
                  assignmentId:
                    type: string
                    description: Opaque identifier of this assignment.
                  variant:
                    type: object
                    properties:
                      variant:
                        type: string
                        description: >-
                          Reference to a variant in the flag. Note: the variant
                          must be located
                           in the same flag.
                    required:
                      - variant
                    description: Assign a value from a variant.
                  fallthrough:
                    type: object
                    description: >-
                      Assign a value from the first rule after this one that
                      matches.
                  clientDefault:
                    type: object
                    description: Assign the default values in the client.
                  bucketRanges:
                    type: array
                    items:
                      type: object
                      properties:
                        lower:
                          type: object
                          description: The start bucket (inclusive).
                        upper:
                          type: object
                          description: The end bucket (exclusive).
                      required:
                        - lower
                        - upper
                    description: The range of buckets that the variant occupies.
              description: A list that divides the total buckets into assignments
          description: >-
            Specification of how an entity should be randomly assigned to
            values.
        usageMetadata:
          type: object
          properties:
            resolveCount:
              type: integer
              description: The total number of resolves of this rule.
            applyCount:
              type: integer
              description: Total number of applies to this rule.
            lastResolveTime:
              type: object
              description: The last time this rule was resolved.
            lastApplyTime:
              type: object
              description: The last time this rule was applied.
            assignmentUsageMetadata:
              type: array
              items:
                type: object
                properties:
                  assignmentId:
                    type: string
                    description: >-
                      The assignment id, empty means no assignment id was
                      passed.
                  resolveCount:
                    type: integer
                    description: Total number of resolves.
                  applyCount:
                    type: integer
                    description: Total number of applies.
                  lastApplyTime:
                    type: object
                    description: The last time this rule was applied.
                  emptyTargetingKeyCount:
                    type: integer
                    description: Total number of applies with empty targeting key.
              description: Usage statistics for each assignment.
          description: Metadata about how the flag has been resolved.
        targetingKeySelector:
          type: string
          description: |-
            Selector of what key to randomize on from the evaluation context.
             "targeting_key" is the default if not specified
        enabled:
          type: boolean
          description: Decides if the rule should be enabled for resolve or not.
        environments:
          type: array
          items:
            type: string
          description: >-
            List of environments this rule is enabled for. If this list is
            empty, the rule
             is enabled for all environments.
        createTime:
          type: object
          description: Time when the rule was first created.
        updateTime:
          type: object
          description: Time when the flag was last updated.
        creator:
          type: string
          description: Reference to the identity that created this rule.
        updater:
          type: string
          description: Reference to the identity that last updated this rule.
        labels:
          type: array
          items:
            type: object
            additionalProperties:
              type: string
          description: General set of labels for this resource.
        materializationSpec:
          type: object
          properties:
            writeMaterialization:
              type: string
              description: Feeds assignments into materialization
            readMaterialization:
              type: string
              description: Reads assignments from materialization
            mode:
              type: object
              properties:
                materializationMustMatch:
                  type: boolean
                  description: >-
                    If the materialization must match, only units in the
                    materialization will be in the rule, all other units
                     will skip this rule (also known as paused intake). If this is set to false units will match if they are in
                     the materialization or if they match the segment.
                segmentTargetingCanBeIgnored:
                  type: boolean
                  description: >-
                    By default materialization will only be seen as a match of
                    the targeting of the segment that the rule
                     references also matches. Depending on the type of targeting, this may or may not be the wanted behaviour.
                     Setting this to true will mean that any unit in the materialization will match the rule no matter if
                     they match the targeting. Irrespective if this is set to false or true the segment allocation
                     proportion/bucketing is ignored for any unit in the materialization.
              description: How materialization reads should be treated
          description: Specifies if materializations are written to/read from
      required:
        - segment
        - assignmentSpec
        - usageMetadata
        - enabled
        - createTime
        - updateTime
        - creator
        - updater
  securitySchemes:
    admin:
      type: http
      scheme: bearer

````