# List feature flags

GET https://app.launchdarkly.com/api/v2/flags/{projectKey}

Get a list of all feature flags in the given project. You can include information specific to different environments by adding `env` query parameter. For example, setting `env=production` adds configuration details about your production environment to the response. You can also filter feature flags by tag with the `tag` query parameter.

> #### Recommended use
>
> This endpoint can return a large amount of information. We recommend using some or all of these query parameters to decrease response time and overall payload size: `limit`, `env`, `query`, and `filter=creationDate`.

### Filtering flags

You can filter on certain fields using the `filter` query parameter. For example, setting `filter=query:dark-mode,tags:beta+test` matches flags with the string `dark-mode` in their key or name, ignoring case, which also have the tags `beta` and `test`.

The `filter` query parameter supports the following arguments:

| Filter argument       | Description | Example              |
|-----------------------|-------------|----------------------|
| `applicationEvaluated`  | A string. It filters the list to flags that are evaluated in the application with the given key. | `filter=applicationEvaluated:com.launchdarkly.cafe` |
| `archived`              | (deprecated) A boolean value. It filters the list to archived flags. | Use `filter=state:archived` instead |
| `contextKindsEvaluated` | A `+`-separated list of context kind keys. It filters the list to flags which have been evaluated in the past 30 days for all of the context kinds in the list. | `filter=contextKindsEvaluated:user+application` |
| `codeReferences.max`    | An integer value. Use `0` to return flags that do not have code references. | `filter=codeReferences.max:0` |
| `codeReferences.min`    | An integer value. Use `1` to return flags that do have code references. | `filter=codeReferences.min:1` |
| `creationDate`          | An object with an optional `before` field whose value is Unix time in milliseconds. It filters the list to flags created before the date. | `filter=creationDate:{"before":1690527600000}` |
| `evaluated`             | An object that contains a key of `after` and a value in Unix time in milliseconds. It filters the list to all flags that have been evaluated since the time you specify, in the environment provided. This filter requires the `filterEnv` filter. | `filter=evaluated:{"after":1690527600000},filterEnv:production` |
| `filterEnv`             | A valid environment key. You must use this field for filters that are environment-specific. If there are multiple environment-specific filters, you only need to include this field once. | `filter=evaluated:{"after": 1590768455282},filterEnv:production` |
| `guardedRollout` | A string, one of `any`, `monitoring`, `regressed`, `rolledBack`, `completed`, `archived`. It filters the list to flags that are part of guarded rollouts. | `filter=guardedRollout:monitoring` |
| `hasExperiment`         | A boolean value. It filters the list to flags that are used in an experiment. | `filter=hasExperiment:true` |
| `maintainerId`          | A valid member ID. It filters the list to flags that are maintained by this member. | `filter=maintainerId:12ab3c45de678910abc12345` |
| `maintainerTeamKey`     | A string. It filters the list to flags that are maintained by the team with this key. | `filter=maintainerTeamKey:example-team-key` |
| `query`                 | A string. It filters the list to flags that include the specified string in their key or name. It is not case sensitive. | `filter=query:example` |
| `releasePipeline`       | A release pipeline key. It filters the list to flags that are either currently active in the release pipeline or have completed the release pipeline. | `filter=releasePipeline:default-release-pipeline` |
| `state`                 | A string, either `live`, `deprecated`, or `archived`. It filters the list to flags in this state. | `filter=state:archived` |
| `sdkAvailability`       | A string, one of `client`, `mobile`, `anyClient`, `server`. Using `client` filters the list to flags whose client-side SDK availability is set to use the client-side ID. Using `mobile` filters to flags set to use the mobile key. Using `anyClient` filters to flags set to use either the client-side ID or the mobile key. Using `server` filters to flags set to use neither, that is, to flags only available in server-side SDKs.  | `filter=sdkAvailability:client` |
| `tags`                  | A `+`-separated list of tags. It filters the list to flags that have all of the tags in the list. | `filter=tags:beta+test` |
| `type`                  | A string, either `temporary` or `permanent`. It filters the list to flags with the specified type. | `filter=type:permanent` |

The documented values for the `filter` query are prior to URL encoding. For example, the `+` in `filter=tags:beta+test` must be encoded to `%2B`.

By default, this endpoint returns all flags. You can page through the list with the `limit` parameter and by following the `first`, `prev`, `next`, and `last` links in the returned `_links` field. These links will not be present if the pages they refer to don't exist. For example, the `first` and `prev` links will be missing from the response on the first page.

### Sorting flags

You can sort flags based on the following fields:

- `creationDate` sorts by the creation date of the flag.
- `key` sorts by the key of the flag.
- `maintainerId` sorts by the flag maintainer.
- `name` sorts by flag name.
- `tags` sorts by tags.
- `targetingModifiedDate` sorts by the date that the flag's targeting rules were last modified in a given environment. It must be used with `env` parameter and it can not be combined with any other sort. If multiple `env` values are provided, it will perform sort using the first one. For example, `sort=-targetingModifiedDate&env=production&env=staging` returns results sorted by `targetingModifiedDate` for the `production` environment.
- `type` sorts by flag type

All fields are sorted in ascending order by default. To sort in descending order, prefix the field with a dash ( - ). For example, `sort=-name` sorts the response by flag name in descending order.

### Expanding response

LaunchDarkly supports the `expand` query param to include additional fields in the response, with the following fields:

- `codeReferences` includes code references for the feature flag
- `evaluation` includes evaluation information within returned environments, including which context kinds the flag has been evaluated for in the past 30 days
- `migrationSettings` includes migration settings information within the flag and within returned environments. These settings are only included for migration flags, that is, where `purpose` is `migration`.

For example, `expand=evaluation` includes the `evaluation` field in the response.

### Migration flags
For migration flags, the cohort information is included in the `rules` property of a flag's response, and default cohort information is included in the `fallthrough` property of a flag's response.
To learn more, read [Migration Flags](https://launchdarkly.com/docs/home/flags/migration).


Reference: https://launchdarkly.com/docs/api/feature-flags/get-feature-flags

## OpenAPI Specification

```yaml
openapi: 3.1.0
info:
  title: LaunchDarkly REST API
  version: 1.0.0
paths:
  /api/v2/flags/{projectKey}:
    get:
      operationId: get-feature-flags
      summary: List feature flags
      description: >
        Get a list of all feature flags in the given project. You can include
        information specific to different environments by adding `env` query
        parameter. For example, setting `env=production` adds configuration
        details about your production environment to the response. You can also
        filter feature flags by tag with the `tag` query parameter.


        > #### Recommended use

        >

        > This endpoint can return a large amount of information. We recommend
        using some or all of these query parameters to decrease response time
        and overall payload size: `limit`, `env`, `query`, and
        `filter=creationDate`.


        ### Filtering flags


        You can filter on certain fields using the `filter` query parameter. For
        example, setting `filter=query:dark-mode,tags:beta+test` matches flags
        with the string `dark-mode` in their key or name, ignoring case, which
        also have the tags `beta` and `test`.


        The `filter` query parameter supports the following arguments:


        | Filter argument       | Description | Example              |

        |-----------------------|-------------|----------------------|

        | `applicationEvaluated`  | A string. It filters the list to flags that
        are evaluated in the application with the given key. |
        `filter=applicationEvaluated:com.launchdarkly.cafe` |

        | `archived`              | (deprecated) A boolean value. It filters the
        list to archived flags. | Use `filter=state:archived` instead |

        | `contextKindsEvaluated` | A `+`-separated list of context kind keys.
        It filters the list to flags which have been evaluated in the past 30
        days for all of the context kinds in the list. |
        `filter=contextKindsEvaluated:user+application` |

        | `codeReferences.max`    | An integer value. Use `0` to return flags
        that do not have code references. | `filter=codeReferences.max:0` |

        | `codeReferences.min`    | An integer value. Use `1` to return flags
        that do have code references. | `filter=codeReferences.min:1` |

        | `creationDate`          | An object with an optional `before` field
        whose value is Unix time in milliseconds. It filters the list to flags
        created before the date. |
        `filter=creationDate:{"before":1690527600000}` |

        | `evaluated`             | An object that contains a key of `after` and
        a value in Unix time in milliseconds. It filters the list to all flags
        that have been evaluated since the time you specify, in the environment
        provided. This filter requires the `filterEnv` filter. |
        `filter=evaluated:{"after":1690527600000},filterEnv:production` |

        | `filterEnv`             | A valid environment key. You must use this
        field for filters that are environment-specific. If there are multiple
        environment-specific filters, you only need to include this field once.
        | `filter=evaluated:{"after": 1590768455282},filterEnv:production` |

        | `guardedRollout` | A string, one of `any`, `monitoring`, `regressed`,
        `rolledBack`, `completed`, `archived`. It filters the list to flags that
        are part of guarded rollouts. | `filter=guardedRollout:monitoring` |

        | `hasExperiment`         | A boolean value. It filters the list to
        flags that are used in an experiment. | `filter=hasExperiment:true` |

        | `maintainerId`          | A valid member ID. It filters the list to
        flags that are maintained by this member. |
        `filter=maintainerId:12ab3c45de678910abc12345` |

        | `maintainerTeamKey`     | A string. It filters the list to flags that
        are maintained by the team with this key. |
        `filter=maintainerTeamKey:example-team-key` |

        | `query`                 | A string. It filters the list to flags that
        include the specified string in their key or name. It is not case
        sensitive. | `filter=query:example` |

        | `releasePipeline`       | A release pipeline key. It filters the list
        to flags that are either currently active in the release pipeline or
        have completed the release pipeline. |
        `filter=releasePipeline:default-release-pipeline` |

        | `state`                 | A string, either `live`, `deprecated`, or
        `archived`. It filters the list to flags in this state. |
        `filter=state:archived` |

        | `sdkAvailability`       | A string, one of `client`, `mobile`,
        `anyClient`, `server`. Using `client` filters the list to flags whose
        client-side SDK availability is set to use the client-side ID. Using
        `mobile` filters to flags set to use the mobile key. Using `anyClient`
        filters to flags set to use either the client-side ID or the mobile key.
        Using `server` filters to flags set to use neither, that is, to flags
        only available in server-side SDKs.  | `filter=sdkAvailability:client` |

        | `tags`                  | A `+`-separated list of tags. It filters the
        list to flags that have all of the tags in the list. |
        `filter=tags:beta+test` |

        | `type`                  | A string, either `temporary` or `permanent`.
        It filters the list to flags with the specified type. |
        `filter=type:permanent` |


        The documented values for the `filter` query are prior to URL encoding.
        For example, the `+` in `filter=tags:beta+test` must be encoded to
        `%2B`.


        By default, this endpoint returns all flags. You can page through the
        list with the `limit` parameter and by following the `first`, `prev`,
        `next`, and `last` links in the returned `_links` field. These links
        will not be present if the pages they refer to don't exist. For example,
        the `first` and `prev` links will be missing from the response on the
        first page.


        ### Sorting flags


        You can sort flags based on the following fields:


        - `creationDate` sorts by the creation date of the flag.

        - `key` sorts by the key of the flag.

        - `maintainerId` sorts by the flag maintainer.

        - `name` sorts by flag name.

        - `tags` sorts by tags.

        - `targetingModifiedDate` sorts by the date that the flag's targeting
        rules were last modified in a given environment. It must be used with
        `env` parameter and it can not be combined with any other sort. If
        multiple `env` values are provided, it will perform sort using the first
        one. For example,
        `sort=-targetingModifiedDate&env=production&env=staging` returns results
        sorted by `targetingModifiedDate` for the `production` environment.

        - `type` sorts by flag type


        All fields are sorted in ascending order by default. To sort in
        descending order, prefix the field with a dash ( - ). For example,
        `sort=-name` sorts the response by flag name in descending order.


        ### Expanding response


        LaunchDarkly supports the `expand` query param to include additional
        fields in the response, with the following fields:


        - `codeReferences` includes code references for the feature flag

        - `evaluation` includes evaluation information within returned
        environments, including which context kinds the flag has been evaluated
        for in the past 30 days

        - `migrationSettings` includes migration settings information within the
        flag and within returned environments. These settings are only included
        for migration flags, that is, where `purpose` is `migration`.


        For example, `expand=evaluation` includes the `evaluation` field in the
        response.


        ### Migration flags

        For migration flags, the cohort information is included in the `rules`
        property of a flag's response, and default cohort information is
        included in the `fallthrough` property of a flag's response.

        To learn more, read [Migration
        Flags](https://launchdarkly.com/docs/home/flags/migration).
      tags:
        - subpackage_featureFlags
      parameters:
        - name: projectKey
          in: path
          description: The project key
          required: true
          schema:
            type: string
            format: string
        - name: env
          in: query
          description: Filter configurations by environment
          required: false
          schema:
            type: string
            format: string
        - name: tag
          in: query
          description: Filter feature flags by tag
          required: false
          schema:
            type: string
            format: string
        - name: limit
          in: query
          description: The number of feature flags to return. Defaults to 20.
          required: false
          schema:
            type: integer
            format: int64
        - name: offset
          in: query
          description: >-
            Where to start in the list. Use this with pagination. For example,
            an offset of 10 skips the first ten items and then returns the next
            items in the list, up to the query `limit`.
          required: false
          schema:
            type: integer
            format: int64
        - name: archived
          in: query
          description: >-
            Deprecated, use `filter=archived:true` instead. A boolean to filter
            the list to archived flags. When this is absent, only unarchived
            flags will be returned
          required: false
          schema:
            type: boolean
        - name: summary
          in: query
          description: >-
            By default, flags do _not_ include their lists of prerequisites,
            targets, or rules for each environment. Set `summary=0` and include
            the `env` query parameter to include these fields for each flag
            returned.
          required: false
          schema:
            type: boolean
        - name: filter
          in: query
          description: >-
            A comma-separated list of filters. Each filter is of the form
            field:value. Read the endpoint description for a full list of
            available filter fields.
          required: false
          schema:
            type: string
            format: string
        - name: sort
          in: query
          description: >-
            A comma-separated list of fields to sort by. Fields prefixed by a
            dash ( - ) sort in descending order. Read the endpoint description
            for a full list of available sort fields.
          required: false
          schema:
            type: string
            format: string
        - name: compare
          in: query
          description: >-
            Deprecated, unavailable in API version `20240415`. A boolean to
            filter results by only flags that have differences between
            environments.
          required: false
          schema:
            type: boolean
        - name: expand
          in: query
          description: >-
            A comma-separated list of fields to expand in the response.
            Supported fields are explained above.
          required: false
          schema:
            type: string
            format: string
        - name: Authorization
          in: header
          required: true
          schema:
            type: string
      responses:
        '200':
          description: Global flags collection response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/FeatureFlags'
        '400':
          description: Invalid request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/InvalidRequestErrorRep'
        '401':
          description: Invalid access token
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/UnauthorizedErrorRep'
        '403':
          description: Forbidden
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ForbiddenErrorRep'
        '404':
          description: Invalid resource identifier
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/NotFoundErrorRep'
        '429':
          description: Rate limited
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/RateLimitedErrorRep'
servers:
  - url: https://app.launchdarkly.com
  - url: https://app.launchdarkly.us
components:
  schemas:
    FeatureFlagKind:
      type: string
      enum:
        - boolean
        - multivariate
      description: Kind of feature flag
      title: FeatureFlagKind
    UnixMillis:
      type: integer
      format: int64
      title: UnixMillis
    ClientSideAvailability:
      type: object
      properties:
        usingMobileKey:
          type: boolean
        usingEnvironmentId:
          type: boolean
      title: ClientSideAvailability
    Variation:
      type: object
      properties:
        _id:
          type: string
          description: The ID of the variation. Leave empty when you are creating a flag.
        value:
          description: >-
            The value of the variation. For boolean flags, this must be
            <code>true</code> or <code>false</code>. For multivariate flags,
            this may be a string, number, or JSON object.
        description:
          type: string
          description: >-
            Description of the variation. Defaults to an empty string, but is
            omitted from the response if not set.
        name:
          type: string
          description: >-
            A human-friendly name for the variation. Defaults to an empty
            string, but is omitted from the response if not set.
      required:
        - value
      title: Variation
    Link:
      type: object
      properties:
        href:
          type: string
          description: The URL of the link
        type:
          type: string
          description: The type of the link
      title: Link
    MemberSummary:
      type: object
      properties:
        _links:
          type: object
          additionalProperties:
            $ref: '#/components/schemas/Link'
          description: The location and content type of related resources
        _id:
          type: string
          description: The member's ID
        firstName:
          type: string
          description: The member's first name
        lastName:
          type: string
          description: The member's last name
        role:
          type: string
          description: >-
            The member's base role. If the member has no additional roles, this
            role will be in effect.
        email:
          type: string
          description: The member's email address
      required:
        - _links
        - _id
        - role
        - email
      title: MemberSummary
    MaintainerTeam:
      type: object
      properties:
        key:
          type: string
          description: The key of the maintainer team
        name:
          type: string
          description: A human-friendly name for the maintainer team
        _links:
          type: object
          additionalProperties:
            $ref: '#/components/schemas/Link'
          description: The location and content type of related resources
      required:
        - key
        - name
      title: MaintainerTeam
    MetricListingRepKind:
      type: string
      enum:
        - pageview
        - click
        - custom
      description: The kind of event the metric tracks
      title: MetricListingRepKind
    ActionIdentifier:
      type: string
      title: ActionIdentifier
    ActionSpecifier:
      type: string
      title: ActionSpecifier
    AccessDeniedReasonEffect:
      type: string
      enum:
        - allow
        - deny
      description: Whether this statement should allow or deny actions on the resources.
      title: AccessDeniedReasonEffect
    AccessDeniedReason:
      type: object
      properties:
        resources:
          type: array
          items:
            type: string
          description: Resource specifier strings
        notResources:
          type: array
          items:
            type: string
          description: >-
            Targeted resources are the resources NOT in this list. The
            <code>resources</code> and <code>notActions</code> fields must be
            empty to use this field.
        actions:
          type: array
          items:
            $ref: '#/components/schemas/ActionSpecifier'
          description: Actions to perform on a resource
        notActions:
          type: array
          items:
            $ref: '#/components/schemas/ActionSpecifier'
          description: >-
            Targeted actions are the actions NOT in this list. The
            <code>actions</code> and <code>notResources</code> fields must be
            empty to use this field.
        effect:
          $ref: '#/components/schemas/AccessDeniedReasonEffect'
          description: >-
            Whether this statement should allow or deny actions on the
            resources.
        role_name:
          type: string
      required:
        - effect
      title: AccessDeniedReason
    AccessDenied:
      type: object
      properties:
        action:
          $ref: '#/components/schemas/ActionIdentifier'
        reason:
          $ref: '#/components/schemas/AccessDeniedReason'
      required:
        - action
        - reason
      title: AccessDenied
    AccessAllowedReasonEffect:
      type: string
      enum:
        - allow
        - deny
      description: Whether this statement should allow or deny actions on the resources.
      title: AccessAllowedReasonEffect
    AccessAllowedReason:
      type: object
      properties:
        resources:
          type: array
          items:
            type: string
          description: Resource specifier strings
        notResources:
          type: array
          items:
            type: string
          description: >-
            Targeted resources are the resources NOT in this list. The
            <code>resources</code> and <code>notActions</code> fields must be
            empty to use this field.
        actions:
          type: array
          items:
            $ref: '#/components/schemas/ActionSpecifier'
          description: Actions to perform on a resource
        notActions:
          type: array
          items:
            $ref: '#/components/schemas/ActionSpecifier'
          description: >-
            Targeted actions are the actions NOT in this list. The
            <code>actions</code> and <code>notResources</code> fields must be
            empty to use this field.
        effect:
          $ref: '#/components/schemas/AccessAllowedReasonEffect'
          description: >-
            Whether this statement should allow or deny actions on the
            resources.
        role_name:
          type: string
      required:
        - effect
      title: AccessAllowedReason
    AccessAllowedRep:
      type: object
      properties:
        action:
          $ref: '#/components/schemas/ActionIdentifier'
        reason:
          $ref: '#/components/schemas/AccessAllowedReason'
      required:
        - action
        - reason
      title: AccessAllowedRep
    Access:
      type: object
      properties:
        denied:
          type: array
          items:
            $ref: '#/components/schemas/AccessDenied'
        allowed:
          type: array
          items:
            $ref: '#/components/schemas/AccessAllowedRep'
      required:
        - denied
        - allowed
      title: Access
    Modification:
      type: object
      properties:
        date:
          type: string
          format: date-time
      title: Modification
    MetricListingRepSuccessCriteria:
      type: string
      enum:
        - HigherThanBaseline
        - LowerThanBaseline
      description: For custom metrics, the success criteria
      title: MetricListingRepSuccessCriteria
    FilterType:
      type: string
      enum:
        - group
        - contextAttribute
        - eventProperty
      description: Filter type. One of [contextAttribute, eventProperty, group]
      title: FilterType
    Operator:
      type: string
      title: Operator
    Filter:
      type: object
      properties:
        type:
          $ref: '#/components/schemas/FilterType'
          description: Filter type. One of [contextAttribute, eventProperty, group]
        attribute:
          type: string
          description: >-
            If not a group node, the context attribute name or event property
            name to filter on
        op:
          $ref: '#/components/schemas/Operator'
          description: The function to perform
        values:
          type: array
          items:
            description: Any type
          description: The context attribute / event property values or group member nodes
        contextKind:
          type: string
          description: For context attribute filters, the context kind.
        negate:
          type: boolean
          description: >-
            If set, then take the inverse of the operator. 'in' becomes 'not
            in'.
      required:
        - type
        - op
        - values
        - negate
      title: Filter
    MetricListingRepUnitAggregationType:
      type: string
      enum:
        - average
        - sum
      description: The method by which multiple unit event values are aggregated
      title: MetricListingRepUnitAggregationType
    MetricListingRepAnalysisType:
      type: string
      enum:
        - mean
        - percentile
      description: The method for analyzing metric events
      title: MetricListingRepAnalysisType
    MetricEventDefaultRep:
      type: object
      properties:
        disabled:
          type: boolean
          description: >-
            Whether to disable defaulting missing unit events when calculating
            results. Defaults to false
        value:
          type: number
          format: double
          description: >-
            The default value applied to missing unit events. Set to 0 when
            <code>disabled</code> is false. No other values are currently
            supported.
      title: MetricEventDefaultRep
    MetricDataSourceRefRep:
      type: object
      properties:
        key:
          type: string
        environmentKey:
          type: string
        _name:
          type: string
        _integrationKey:
          type: string
      required:
        - key
      title: MetricDataSourceRefRep
    UrlMatcher:
      type: object
      additionalProperties:
        description: Any type
      title: UrlMatcher
    UrlMatchers:
      type: array
      items:
        $ref: '#/components/schemas/UrlMatcher'
      title: UrlMatchers
    MetricListingRep:
      type: object
      properties:
        experimentCount:
          type: integer
          description: The number of experiments using this metric
        metricGroupCount:
          type: integer
          description: The number of metric groups using this metric
        activeExperimentCount:
          type: integer
          description: The number of active experiments using this metric
        activeGuardedRolloutCount:
          type: integer
          description: The number of active guarded rollouts using this metric
        _id:
          type: string
          description: The ID of this metric
        _versionId:
          type: string
          description: The version ID of the metric
        _version:
          type: integer
          description: Version of the metric
        key:
          type: string
          description: A unique key to reference the metric
        name:
          type: string
          description: A human-friendly name for the metric
        kind:
          $ref: '#/components/schemas/MetricListingRepKind'
          description: The kind of event the metric tracks
        _attachedFlagCount:
          type: integer
          description: The number of feature flags currently attached to this metric
        _links:
          type: object
          additionalProperties:
            $ref: '#/components/schemas/Link'
          description: The location and content type of related resources
        _site:
          $ref: '#/components/schemas/Link'
          description: Details on how to access the metric in the LaunchDarkly UI
        _access:
          $ref: '#/components/schemas/Access'
          description: Details on the allowed and denied actions for this metric
        tags:
          type: array
          items:
            type: string
          description: Tags for the metric
        _creationDate:
          $ref: '#/components/schemas/UnixMillis'
          description: Timestamp of when the metric was created
        lastModified:
          $ref: '#/components/schemas/Modification'
        maintainerId:
          type: string
          description: The ID of the member who maintains this metric
        _maintainer:
          $ref: '#/components/schemas/MemberSummary'
          description: Details on the member who maintains this metric
        description:
          type: string
          description: Description of the metric
        category:
          type: string
          description: The category of the metric
        isNumeric:
          type: boolean
          description: >-
            For custom metrics, whether to track numeric changes in value
            against a baseline (<code>true</code>) or to track a conversion when
            an end user takes an action (<code>false</code>).
        successCriteria:
          $ref: '#/components/schemas/MetricListingRepSuccessCriteria'
          description: For custom metrics, the success criteria
        unit:
          type: string
          description: For numeric custom metrics, the unit of measure
        eventKey:
          type: string
          description: For custom metrics, the event key to use in your code
        randomizationUnits:
          type: array
          items:
            type: string
          description: An array of randomization units allowed for this metric
        filters:
          $ref: '#/components/schemas/Filter'
          description: >-
            The filters narrowing down the audience based on context attributes
            or event properties.
        unitAggregationType:
          $ref: '#/components/schemas/MetricListingRepUnitAggregationType'
          description: The method by which multiple unit event values are aggregated
        analysisType:
          $ref: '#/components/schemas/MetricListingRepAnalysisType'
          description: The method for analyzing metric events
        percentileValue:
          type: integer
          description: >-
            The percentile for the analysis method. An integer denoting the
            target percentile between 0 and 100. Required when
            <code>analysisType</code> is <code>percentile</code>.
        eventDefault:
          $ref: '#/components/schemas/MetricEventDefaultRep'
        dataSource:
          $ref: '#/components/schemas/MetricDataSourceRefRep'
        lastSeen:
          $ref: '#/components/schemas/UnixMillis'
          description: Timestamp of most recent data for this metric, at one-hour fidelity
        archived:
          type: boolean
          description: Whether the metric version is archived
        archivedAt:
          $ref: '#/components/schemas/UnixMillis'
          description: Timestamp when the metric version was archived
        selector:
          type: string
          description: For click metrics, the CSS selectors
        urls:
          $ref: '#/components/schemas/UrlMatchers'
          description: For click and pageview metrics, the target URLs
        windowStartOffset:
          type: integer
          format: int64
          description: >-
            Not yet implemented - The start of the measurement window, in
            milliseconds relative to the unit's first exposure to a flag
            variation
        windowEndOffset:
          type: integer
          format: int64
          description: >-
            Not yet implemented - The end of the measurement window, in
            milliseconds relative to the unit's first exposure to a flag
            variation
        traceQuery:
          type: string
          description: For trace metrics, the trace query to use for the metric.
        traceValueLocation:
          type: string
          description: >-
            For trace metrics, the location in the trace to use for numeric
            values.
      required:
        - _id
        - _versionId
        - key
        - name
        - kind
        - _links
        - tags
        - _creationDate
        - dataSource
      title: MetricListingRep
    ExperimentEnabledPeriodRep:
      type: object
      properties:
        startDate:
          $ref: '#/components/schemas/UnixMillis'
        stopDate:
          $ref: '#/components/schemas/UnixMillis'
      title: ExperimentEnabledPeriodRep
    ExperimentEnvironmentSettingRep:
      type: object
      properties:
        startDate:
          $ref: '#/components/schemas/UnixMillis'
        stopDate:
          $ref: '#/components/schemas/UnixMillis'
        enabledPeriods:
          type: array
          items:
            $ref: '#/components/schemas/ExperimentEnabledPeriodRep'
      title: ExperimentEnvironmentSettingRep
    LegacyExperimentRep:
      type: object
      properties:
        metricKey:
          type: string
        _metric:
          $ref: '#/components/schemas/MetricListingRep'
        environments:
          type: array
          items:
            type: string
        _environmentSettings:
          type: object
          additionalProperties:
            $ref: '#/components/schemas/ExperimentEnvironmentSettingRep'
      title: LegacyExperimentRep
    ExperimentInfoRep:
      type: object
      properties:
        baselineIdx:
          type: integer
        items:
          type: array
          items:
            $ref: '#/components/schemas/LegacyExperimentRep'
      required:
        - baselineIdx
        - items
      title: ExperimentInfoRep
    customProperty:
      type: object
      properties:
        name:
          type: string
          description: The name of the custom property of this type.
        value:
          type: array
          items:
            type: string
          description: >-
            An array of values for the custom property data to associate with
            this flag.
      required:
        - name
        - value
      title: customProperty
    CustomProperties:
      type: object
      additionalProperties:
        $ref: '#/components/schemas/customProperty'
      title: CustomProperties
    Defaults:
      type: object
      properties:
        onVariation:
          type: integer
          description: >-
            The index, from the array of variations for this flag, of the
            variation to serve by default when targeting is on.
        offVariation:
          type: integer
          description: >-
            The index, from the array of variations for this flag, of the
            variation to serve by default when targeting is off.
      required:
        - onVariation
        - offVariation
      title: Defaults
    FlagMigrationSettingsRep:
      type: object
      properties:
        contextKind:
          type: string
          description: >-
            The context kind targeted by this migration flag. Only applicable
            for six-stage migrations.
        stageCount:
          type: integer
          description: The number of stages for this migration flag
      title: FlagMigrationSettingsRep
    Target:
      type: object
      properties:
        values:
          type: array
          items:
            type: string
          description: >-
            A list of the keys for targets that will receive this variation
            because of individual targeting
        variation:
          type: integer
          description: >-
            The index, from the array of variations for this flag, of the
            variation to serve this list of targets
        contextKind:
          type: string
          description: The context kind of the individual target
      required:
        - values
        - variation
      title: Target
    WeightedVariation:
      type: object
      properties:
        variation:
          type: integer
        weight:
          type: integer
        _untracked:
          type: boolean
      required:
        - variation
        - weight
      title: WeightedVariation
    ExperimentAllocationRep:
      type: object
      properties:
        defaultVariation:
          type: integer
        canReshuffle:
          type: boolean
      required:
        - defaultVariation
        - canReshuffle
      title: ExperimentAllocationRep
    Rollout:
      type: object
      properties:
        variations:
          type: array
          items:
            $ref: '#/components/schemas/WeightedVariation'
        experimentAllocation:
          $ref: '#/components/schemas/ExperimentAllocationRep'
        seed:
          type: integer
        bucketBy:
          type: string
        contextKind:
          type: string
      required:
        - variations
      title: Rollout
    Clause:
      type: object
      properties:
        _id:
          type: string
        attribute:
          type: string
        op:
          $ref: '#/components/schemas/Operator'
        values:
          type: array
          items:
            description: Any type
        contextKind:
          type: string
        negate:
          type: boolean
      required:
        - attribute
        - op
        - values
        - negate
      title: Clause
    Rule:
      type: object
      properties:
        _id:
          type: string
          description: The flag rule ID
        disabled:
          type: boolean
          description: Whether the rule is disabled
        variation:
          type: integer
          description: >-
            The index of the variation, from the array of variations for this
            flag
        rollout:
          $ref: '#/components/schemas/Rollout'
          description: Details on the percentage rollout, if it exists
        clauses:
          type: array
          items:
            $ref: '#/components/schemas/Clause'
          description: >-
            An array of clauses used for individual targeting based on
            attributes
        trackEvents:
          type: boolean
          description: Whether LaunchDarkly tracks events for this rule
        description:
          type: string
          description: The rule description
        ref:
          type: string
      required:
        - clauses
        - trackEvents
      title: Rule
    VariationOrRolloutRep:
      type: object
      properties:
        variation:
          type: integer
          description: >-
            The index of the variation, from the array of variations for this
            flag
        rollout:
          $ref: '#/components/schemas/Rollout'
          description: Details on the percentage rollout, if it exists
      title: VariationOrRolloutRep
    Prerequisite:
      type: object
      properties:
        key:
          type: string
        variation:
          type: integer
      required:
        - key
        - variation
      title: Prerequisite
    VariationSummary:
      type: object
      properties:
        rules:
          type: integer
        nullRules:
          type: integer
        targets:
          type: integer
        contextTargets:
          type: integer
        isFallthrough:
          type: boolean
        isOff:
          type: boolean
        rollout:
          type: integer
        bucketBy:
          type: string
      required:
        - rules
        - nullRules
        - targets
        - contextTargets
      title: VariationSummary
    AllVariationsSummary:
      type: object
      additionalProperties:
        $ref: '#/components/schemas/VariationSummary'
      title: AllVariationsSummary
    FlagSummary:
      type: object
      properties:
        variations:
          $ref: '#/components/schemas/AllVariationsSummary'
          description: A summary of the variations for this flag
        prerequisites:
          type: integer
          description: The number of prerequisites for this flag
      required:
        - variations
        - prerequisites
      title: FlagSummary
    FlagConfigEvaluation:
      type: object
      properties:
        contextKinds:
          type: array
          items:
            type: string
      title: FlagConfigEvaluation
    FlagConfigMigrationSettingsRep:
      type: object
      properties:
        checkRatio:
          type: integer
      title: FlagConfigMigrationSettingsRep
    FeatureFlagConfig:
      type: object
      properties:
        'on':
          type: boolean
          description: Whether the flag is on
        archived:
          type: boolean
          description: Boolean indicating if the feature flag is archived
        salt:
          type: string
        sel:
          type: string
        lastModified:
          $ref: '#/components/schemas/UnixMillis'
          description: Timestamp of when the flag configuration was most recently modified
        version:
          type: integer
          description: Version of the feature flag
        targets:
          type: array
          items:
            $ref: '#/components/schemas/Target'
          description: >-
            An array of the individual targets that will receive a specific
            variation based on their key. Individual targets with a context kind
            of 'user' are included here.
        contextTargets:
          type: array
          items:
            $ref: '#/components/schemas/Target'
          description: >-
            An array of the individual targets that will receive a specific
            variation based on their key. Individual targets with context kinds
            other than 'user' are included here.
        rules:
          type: array
          items:
            $ref: '#/components/schemas/Rule'
          description: >-
            An array of the rules for how to serve a variation to specific
            targets based on their attributes
        fallthrough:
          $ref: '#/components/schemas/VariationOrRolloutRep'
          description: >-
            Details on the variation or rollout to serve as part of the flag's
            default rule
        offVariation:
          type: integer
          description: The ID of the variation to serve when the flag is off
        prerequisites:
          type: array
          items:
            $ref: '#/components/schemas/Prerequisite'
          description: >-
            An array of the prerequisite flags and their variations that are
            required before this flag takes effect
        _site:
          $ref: '#/components/schemas/Link'
          description: >-
            Details on how to access the flag configuration in the LaunchDarkly
            UI
        _access:
          $ref: '#/components/schemas/Access'
          description: Details on the allowed and denied actions for this flag
        _environmentName:
          type: string
          description: The environment name
        trackEvents:
          type: boolean
          description: >-
            Whether LaunchDarkly tracks events for the feature flag, for all
            rules
        trackEventsFallthrough:
          type: boolean
          description: >-
            Whether LaunchDarkly tracks events for the feature flag, for the
            default rule
        _debugEventsUntilDate:
          $ref: '#/components/schemas/UnixMillis'
        _summary:
          $ref: '#/components/schemas/FlagSummary'
          description: A summary of the prerequisites and variations for this flag
        evaluation:
          $ref: '#/components/schemas/FlagConfigEvaluation'
          description: Evaluation information for the flag
        migrationSettings:
          $ref: '#/components/schemas/FlagConfigMigrationSettingsRep'
          description: Migration-related settings for the flag configuration
      required:
        - 'on'
        - archived
        - salt
        - sel
        - lastModified
        - version
        - _site
        - _environmentName
        - trackEvents
        - trackEventsFallthrough
      title: FeatureFlagConfig
    FeatureFlag:
      type: object
      properties:
        name:
          type: string
          description: A human-friendly name for the feature flag
        kind:
          $ref: '#/components/schemas/FeatureFlagKind'
          description: Kind of feature flag
        description:
          type: string
          description: Description of the feature flag
        key:
          type: string
          description: A unique key used to reference the flag in your code
        _version:
          type: integer
          description: Version of the feature flag
        creationDate:
          $ref: '#/components/schemas/UnixMillis'
          description: Timestamp of flag creation date
        includeInSnippet:
          type: boolean
          description: >-
            Deprecated, use <code>clientSideAvailability</code>. Whether this
            flag should be made available to the client-side JavaScript SDK
        clientSideAvailability:
          $ref: '#/components/schemas/ClientSideAvailability'
          description: Which type of client-side SDKs the feature flag is available to
        variations:
          type: array
          items:
            $ref: '#/components/schemas/Variation'
          description: An array of possible variations for the flag
        temporary:
          type: boolean
          description: Whether the flag is a temporary flag
        tags:
          type: array
          items:
            type: string
          description: Tags for the feature flag
        _links:
          type: object
          additionalProperties:
            $ref: '#/components/schemas/Link'
          description: The location and content type of related resources
        maintainerId:
          type: string
          description: Associated maintainerId for the feature flag
        _maintainer:
          $ref: '#/components/schemas/MemberSummary'
          description: Associated maintainer member info for the feature flag
        maintainerTeamKey:
          type: string
          description: The key of the associated team that maintains this feature flag
        _maintainerTeam:
          $ref: '#/components/schemas/MaintainerTeam'
          description: Associated maintainer team info for the feature flag
        goalIds:
          type: array
          items:
            type: string
          description: Deprecated, use <code>experiments</code> instead
        experiments:
          $ref: '#/components/schemas/ExperimentInfoRep'
          description: Experimentation data for the feature flag
        customProperties:
          $ref: '#/components/schemas/CustomProperties'
          description: >-
            Metadata attached to the feature flag, in the form of the property
            key associated with a name and array of values for the metadata to
            associate with this flag. Typically used to store data related to an
            integration.
        archived:
          type: boolean
          description: Boolean indicating if the feature flag is archived
        archivedDate:
          $ref: '#/components/schemas/UnixMillis'
          description: If archived is true, date of archive
        deprecated:
          type: boolean
          description: Boolean indicating if the feature flag is deprecated
        deprecatedDate:
          $ref: '#/components/schemas/UnixMillis'
          description: If deprecated is true, date of deprecation
        defaults:
          $ref: '#/components/schemas/Defaults'
          description: >-
            The indices, from the array of variations, for the variations to
            serve by default when targeting is on and when targeting is off.
            These variations will be used for this flag in new environments. If
            omitted, the first and last variation will be used.
        _purpose:
          type: string
        migrationSettings:
          $ref: '#/components/schemas/FlagMigrationSettingsRep'
          description: Migration-related settings for the flag
        environments:
          type: object
          additionalProperties:
            $ref: '#/components/schemas/FeatureFlagConfig'
          description: >-
            Details on the environments for this flag. Only returned if the
            request is filtered by environment, using the <code>filterEnv</code>
            query parameter.
      required:
        - name
        - kind
        - key
        - _version
        - creationDate
        - variations
        - temporary
        - tags
        - _links
        - experiments
        - customProperties
        - archived
      title: FeatureFlag
    FeatureFlags:
      type: object
      properties:
        items:
          type: array
          items:
            $ref: '#/components/schemas/FeatureFlag'
          description: An array of feature flags
        _links:
          type: object
          additionalProperties:
            $ref: '#/components/schemas/Link'
          description: The location and content type of related resources
        totalCount:
          type: integer
          description: The total number of flags
        totalCountWithDifferences:
          type: integer
          description: >-
            The number of flags that have differences between environments. Only
            shown when query parameter <code>compare</code> is
            <code>true</code>.
      required:
        - items
        - _links
      title: FeatureFlags
    InvalidRequestErrorRep:
      type: object
      properties:
        code:
          type: string
          description: Specific error code encountered
        message:
          type: string
          description: Description of the error
      required:
        - code
        - message
      title: InvalidRequestErrorRep
    UnauthorizedErrorRep:
      type: object
      properties:
        code:
          type: string
          description: Specific error code encountered
        message:
          type: string
          description: Description of the error
      required:
        - code
        - message
      title: UnauthorizedErrorRep
    ForbiddenErrorRep:
      type: object
      properties:
        code:
          type: string
          description: Specific error code encountered
        message:
          type: string
          description: Description of the error
      required:
        - code
        - message
      title: ForbiddenErrorRep
    NotFoundErrorRep:
      type: object
      properties:
        code:
          type: string
          description: Specific error code encountered
        message:
          type: string
          description: Description of the error
      required:
        - code
        - message
      title: NotFoundErrorRep
    RateLimitedErrorRep:
      type: object
      properties:
        code:
          type: string
          description: Specific error code encountered
        message:
          type: string
          description: Description of the error
      required:
        - code
        - message
      title: RateLimitedErrorRep
  securitySchemes:
    ApiKey:
      type: apiKey
      in: header
      name: Authorization

```

## SDK Code Examples

```python
import requests

url = "https://app.launchdarkly.com/api/v2/flags/projectKey"

headers = {"Authorization": "<apiKey>"}

response = requests.get(url, headers=headers)

print(response.json())
```

```javascript
const url = 'https://app.launchdarkly.com/api/v2/flags/projectKey';
const options = {method: 'GET', headers: {Authorization: '<apiKey>'}};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go
package main

import (
	"fmt"
	"net/http"
	"io"
)

func main() {

	url := "https://app.launchdarkly.com/api/v2/flags/projectKey"

	req, _ := http.NewRequest("GET", url, nil)

	req.Header.Add("Authorization", "<apiKey>")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby
require 'uri'
require 'net/http'

url = URI("https://app.launchdarkly.com/api/v2/flags/projectKey")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Get.new(url)
request["Authorization"] = '<apiKey>'

response = http.request(request)
puts response.read_body
```

```java
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.get("https://app.launchdarkly.com/api/v2/flags/projectKey")
  .header("Authorization", "<apiKey>")
  .asString();
```

```php
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('GET', 'https://app.launchdarkly.com/api/v2/flags/projectKey', [
  'headers' => [
    'Authorization' => '<apiKey>',
  ],
]);

echo $response->getBody();
```

```csharp
using RestSharp;

var client = new RestClient("https://app.launchdarkly.com/api/v2/flags/projectKey");
var request = new RestRequest(Method.GET);
request.AddHeader("Authorization", "<apiKey>");
IRestResponse response = client.Execute(request);
```

```swift
import Foundation

let headers = ["Authorization": "<apiKey>"]

let request = NSMutableURLRequest(url: NSURL(string: "https://app.launchdarkly.com/api/v2/flags/projectKey")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "GET"
request.allHTTPHeaderFields = headers

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```