> ## Documentation Index
> Fetch the complete documentation index at: https://launchdarkly-preview.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Create iteration

> > For the complete documentation index, see [llms.txt](https://launchdarkly-preview.mintlify.app/llms.txt). For the full documentation snapshot, see [llms-full.txt](https://launchdarkly-preview.mintlify.app/llms-full.txt).

Create an experiment iteration.

Experiment iterations let you record experiments in individual blocks of time. Initially, iterations are created with a status of `not_started` and appear in the `draftIteration` field of an experiment. To start or stop an iteration, [update the experiment](https://launchdarkly.com/docs/api/experiments/patch-experiment) with the `startIteration` or `stopIteration` instruction.

To learn more, read [Start experiment iterations](https://launchdarkly.com/docs/home/experimentation/create#start-an-experiment-iteration).




## OpenAPI

````yaml /openapi/launchdarkly-api.json post /api/v2/projects/{projectKey}/environments/{environmentKey}/experiments/{experimentKey}/iterations
openapi: 3.0.3
info:
  title: LaunchDarkly REST API
  description: >
    > For the complete documentation index, see
    https://launchdarkly-preview.mintlify.app/llms.txt.

    > For the full documentation snapshot, see
    https://launchdarkly-preview.mintlify.app/llms-full.txt.


    This is the LaunchDarkly REST API. It lets you build custom integrations,
    automate your workflow, and manage feature flags and other LaunchDarkly
    resources programmatically.


    For authentication, rate limits, pagination, versioning, JSON Patch and
    semantic patches, beta resources, and the full SDK End-of-Life table, read
    the [REST API overview](https://launchdarkly-preview.mintlify.app/api).


    To fetch the complete OpenAPI spec, use [Get OpenAPI
    spec](https://launchdarkly.com/docs/api/other/get-openapi-spec).
  contact:
    name: LaunchDarkly Technical Support Team
    url: https://support.launchdarkly.com
    email: support@launchdarkly.com
  license:
    name: Apache 2.0
    url: https://www.apache.org/licenses/LICENSE-2.0
  version: '2.0'
servers:
  - url: https://app.launchdarkly.com
    description: ' Default'
  - url: https://app.launchdarkly.us
    description: ' Federal'
security:
  - ApiKey:
      - read
      - write
tags:
  - name: Access tokens
    description: >-
      The access tokens API allows you to list, create, modify, and delete
      access tokens programmatically.
  - name: Account members
    description: >-
      The account members API allows you to invite new members to an account by
      making a `POST` request to `/api/v2/members`. When you invite a new member
      to an account, an invitation is sent to the email you provided.
  - name: Account usage (beta)
    description: >-
      > ### This feature is in beta > > To use this feature, pass in a header
      including the `LD-API-Version` key with value set to `beta`. Use this
      header with each call.
  - name: AI Configs
    description: >-
      The AI Configs API allows you to create, retrieve, and edit AI Configs, AI
      Config variations, and AI model configurations.
  - name: Announcements
    description: >-
      The announcements API lets you create and update a custom announcement
      banner that appears in the LaunchDarkly user interface for everyone in
      your organization.
  - name: Applications (beta)
    description: >-
      > ### This feature is in beta > > To use this feature, pass in a header
      including the `LD-API-Version` key with value set to `beta`. Use this
      header with each call.
  - name: Approvals
    description: >-
      An account member can request approval on changes to a flag or AI Config's
      targeting or variations, or to a segment's targeting. Members may be
      required to request approval depending on the settings in their
      LaunchDarkly project.
  - name: Approvals (beta)
    description: >-
      > ### This feature is in beta > > To use this feature, pass in a header
      including the `LD-API-Version` key with value set to `beta`. Use this
      header with each call.
  - name: Audit log
    description: >-
      LaunchDarkly maintains a record of all the changes made to any resource in
      the system. You can access this history using the audit log API, including
      filtering by timestamps, or using a custom policy to select which entries
      to receive.
  - name: Code references
    description: >-
      > ### Code references is an Enterprise feature > > Code references is
      available to customers on an Enterprise plan. To learn more, [read about
      our pricing](https://launchdarkly.com/pricing/).
  - name: Context settings
    description: >-
      You can use the context settings API to assign a context to a specific
      variation for any feature flag. To learn more, read [View and manage
      contexts](https://launchdarkly.com/docs/home/observability/context-attributes#view-and-manage-contexts).
  - name: Contexts
    description: >-
      Contexts are people, services, machines, or other resources that encounter
      feature flags in your product. Contexts are identified by their `kind`,
      which describes the type of resources encountering flags, and by their
      `key`.
  - name: Custom roles
    description: >-
      > ### Custom roles is an Enterprise feature > > Custom roles is available
      to customers on an Enterprise plan. To learn more, [read about our
      pricing](https://launchdarkly.com/pricing/).
  - name: Data Export destinations
    description: >-
      > ### Data Export is an add-on feature > > Data Export is available as an
      add-on for customers on a Foundation or Enterprise plan. To learn more,
      [read about our pricing](https://launchdarkly.com/pricing/).
  - name: Environments
    description: >-
      Environments allow you to maintain separate rollout rules in different
      contexts, from local development to QA, staging, and production. With the
      LaunchDarkly Environments API, you can programmatically list, create, and
      manage environments.
  - name: Experiments
    description: >-
      > ### Available for subscription customers > > Experimentation is
      available to all customers on a Developer, Foundation, or Enterprise
      subscription. If you're on an older Pro or Enterprise plan,
      Experimentation is available as an add-on.
  - name: Feature flags
    description: >-
      The feature flags API allows you to list, create, and modify feature flags
      and their targeting. For example, you can control percentage rollouts,
      target specific contexts, or even toggle off a feature flag
      programmatically.
  - name: Feature flags (beta)
    description: >-
      > ### This feature is in beta > > To use this feature, pass in a header
      including the `LD-API-Version` key with value set to `beta`. Use this
      header with each call.
  - name: Flag import configurations (beta)
    description: >-
      > ### This feature is in beta > > To use this feature, pass in a header
      including the `LD-API-Version` key with value set to `beta`. Use this
      header with each call.
  - name: Flag links (beta)
    description: >-
      > ### This feature is in beta > > To use this feature, pass in a header
      including the `LD-API-Version` key with value set to `beta`. Use this
      header with each call.
  - name: Flag triggers
    description: >-
      > ### Flag triggers is an Enterprise feature > > Flag triggers is
      available to customers on an Enterprise plan. To learn more, [read about
      our pricing](https://launchdarkly.com/pricing/).
  - name: Follow flags
    description: >-
      Follow flags to receive email updates about targeting changes to a flag in
      a project and environment.
  - name: Holdouts (beta)
    description: >-
      > ### Available for customers using Experimentation > > Holdouts are
      available to customers using
      [Experimentation](https://launchdarkly.com/docs/api/experiments).
  - name: Insights charts (beta)
    description: >-
      > ### This feature is in beta > > To use this feature, pass in a header
      including the `LD-API-Version` key with value set to `beta`. Use this
      header with each call.
  - name: Insights deployments (beta)
    description: >-
      > ### This feature is in beta > > To use this feature, pass in a header
      including the `LD-API-Version` key with value set to `beta`. Use this
      header with each call.
  - name: Insights flag events (beta)
    description: >-
      > ### This feature is in beta > > To use this feature, pass in a header
      including the `LD-API-Version` key with value set to `beta`. Use this
      header with each call.
  - name: Insights pull requests (beta)
    description: >-
      > ### This feature is in beta > > To use this feature, pass in a header
      including the `LD-API-Version` key with value set to `beta`. Use this
      header with each call.
  - name: Insights repositories (beta)
    description: >-
      > ### This feature is in beta > > To use this feature, pass in a header
      including the `LD-API-Version` key with value set to `beta`. Use this
      header with each call.
  - name: Insights scores (beta)
    description: >-
      > ### This feature is in beta > > To use this feature, pass in a header
      including the `LD-API-Version` key with value set to `beta`. Use this
      header with each call.
  - name: Integration audit log subscriptions
    description: >-
      Audit log integration subscriptions allow you to send audit log events
      hooks to one of dozens of external tools. For example, you can send flag
      change event webhooks to external third party software.
  - name: Integration delivery configurations (beta)
    description: >-
      > ### This feature is in beta > > To use this feature, pass in a header
      including the `LD-API-Version` key with value set to `beta`. Use this
      header with each call.
  - name: Integrations (beta)
    description: >-
      > ### This feature is in beta > > To use this feature, pass in a header
      including the `LD-API-Version` key with value set to `beta`. Use this
      header with each call.
  - name: Layers
    description: >-
      > ### Available for customers using Experimentation > > Layers are
      available to customers using
      [Experimentation](https://launchdarkly.com/docs/api/experiments).
  - name: Metrics
    description: >-
      Metrics track flag behavior over time when an experiment is running. The
      data generated from experiments gives you more insight into the impact of
      a particular flag.
  - name: Metrics (beta)
    description: >-
      > ### This feature is in beta > > To use this feature, pass in a header
      including the `LD-API-Version` key with value set to `beta`. Use this
      header with each call.
  - name: OAuth2 Clients
    description: >-
      The OAuth2 client API allows you to register a LaunchDarkly OAuth client
      for use in your own custom integrations.
  - name: Persistent store integrations (beta)
    description: >-
      > ### This feature is in beta > > To use this feature, pass in a header
      including the `LD-API-Version` key with value set to `beta`. Use this
      header with each call.
  - name: Projects
    description: >-
      Projects allow you to manage multiple different software projects under
      one LaunchDarkly account. Each project has its own unique set of
      environments and feature flags.
  - name: Relay Proxy configurations
    description: >-
      > ### Relay Proxy automatic configuration is an Enterprise feature > >
      Relay Proxy automatic configuration is available to customers on an
      Enterprise plan. To learn more, [read about our
      pricing](https://launchdarkly.com/pricing/).
  - name: Release pipelines (beta)
    description: >-
      > ### This feature is in beta > > To use this feature, pass in a header
      including the `LD-API-Version` key with value set to `beta`. Use this
      header with each call.
  - name: Release policies (beta)
    description: >-
      > ### This feature is in beta > > To use this feature, pass in a header
      including the `LD-API-Version` key with value set to `beta`. Use this
      header with each call.
  - name: Releases (beta)
    description: >-
      > ### This feature is in beta > > To use this feature, pass in a header
      including the `LD-API-Version` key with value set to `beta`. Use this
      header with each call.
  - name: Scheduled changes
    description: >-
      > ### Scheduled flag changes is an Enterprise feature > > Scheduled flag
      changes is available to customers on an Enterprise plan. To learn more,
      [read about our pricing](https://launchdarkly.com/pricing/).
  - name: Segments
    description: >-
      > ### Synced segments and larger list-based segments are an Enterprise
      feature > > This section documents endpoints for rule-based, list-based,
      and synced segments.
  - name: Tags
    description: >-
      Tags are simple strings that you can attach to most resources in
      LaunchDarkly. Tags are useful for grouping resources into a set that you
      can name in a resource specifier.
  - name: Teams
    description: >-
      > ### Teams is an Enterprise feature > > Teams is available to customers
      on an Enterprise plan. To learn more, [read about our
      pricing](https://launchdarkly.com/pricing/).
  - name: Teams (beta)
    description: >-
      > ### This feature is in beta > > To use this feature, pass in a header
      including the `LD-API-Version` key with value set to `beta`. Use this
      header with each call.
  - name: User settings
    description: >-
      > ### Contexts are now available > > After you have upgraded your
      LaunchDarkly SDK to use contexts instead of users, you should use
      [Contexts](https://launchdarkly.com/docs/api/contexts) instead of the user
      settings API.
  - name: Users
    description: >-
      > ### Contexts are now available > > After you have upgraded your
      LaunchDarkly SDK to use contexts instead of users, you should use
      [Contexts](https://launchdarkly.com/docs/api/contexts) instead of these
      endpoints.
  - name: Users (beta)
    description: >-
      > ### Contexts are now available > > After you have upgraded your
      LaunchDarkly SDK to use contexts instead of users, you should use
      [Contexts](https://launchdarkly.com/docs/api/contexts) instead of these
      endpoints.
  - name: Views (beta)
    description: >-
      > ### This feature is in beta > > To use this feature, pass in a header
      including the `LD-API-Version` key with value set to `beta`. Use this
      header with each call.
  - name: Webhooks
    description: >-
      The webhooks API lets you build your own integrations that subscribe to
      activities in LaunchDarkly. When you generate an activity in LaunchDarkly,
      such as when you change a flag or you create a project, LaunchDarkly sends
      an HTTP POST payload to the...
  - name: Workflow templates
    description: >-
      > ### Workflows are in maintenance mode > > The workflows feature is in
      maintenance mode, and is planned for future deprecation at a date not yet
      specified.
  - name: Workflows
    description: >-
      > ### Workflows are in maintenance mode > > The workflows feature is in
      maintenance mode, and is planned for future deprecation at a date not yet
      specified.
  - name: Other
    description: Other requests available in the LaunchDarkly API.
paths:
  /api/v2/projects/{projectKey}/environments/{environmentKey}/experiments/{experimentKey}/iterations:
    post:
      tags:
        - Experiments
      summary: Create iteration
      description: >
        > For the complete documentation index, see
        [llms.txt](https://launchdarkly-preview.mintlify.app/llms.txt). For the
        full documentation snapshot, see
        [llms-full.txt](https://launchdarkly-preview.mintlify.app/llms-full.txt).


        Create an experiment iteration.


        Experiment iterations let you record experiments in individual blocks of
        time. Initially, iterations are created with a status of `not_started`
        and appear in the `draftIteration` field of an experiment. To start or
        stop an iteration, [update the
        experiment](https://launchdarkly.com/docs/api/experiments/patch-experiment)
        with the `startIteration` or `stopIteration` instruction.


        To learn more, read [Start experiment
        iterations](https://launchdarkly.com/docs/home/experimentation/create#start-an-experiment-iteration).
      operationId: createIteration
      parameters:
        - name: projectKey
          in: path
          description: The project key
          required: true
          schema:
            type: string
            format: string
            description: The project key
        - name: environmentKey
          in: path
          description: The environment key
          required: true
          schema:
            type: string
            format: string
            description: The environment key
        - name: experimentKey
          in: path
          description: The experiment key
          required: true
          schema:
            type: string
            format: string
            description: The experiment key
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/IterationInput'
        required: true
      responses:
        '200':
          description: Iteration response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/IterationRep'
        '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'
      deprecated: true
components:
  schemas:
    IterationInput:
      type: object
      required:
        - hypothesis
        - metrics
        - treatments
        - flags
      properties:
        hypothesis:
          type: string
          description: The expected outcome of this experiment
          example: >-
            Example hypothesis, the new button placement will increase
            conversion
        canReshuffleTraffic:
          type: boolean
          description: >-
            Whether to allow the experiment to reassign traffic to different
            variations when you increase or decrease the traffic in your
            experiment audience (true) or keep all traffic assigned to its
            initial variation (false). Defaults to true.
          example: true
        metrics:
          $ref: '#/components/schemas/MetricsInput'
          description: Details on the metrics for this experiment
        primarySingleMetricKey:
          type: string
          description: >-
            The key of the primary metric for this experiment. Either
            <code>primarySingleMetricKey</code> or <code>primaryFunnelKey</code>
            must be present.
          example: metric-key-123abc
        primaryFunnelKey:
          type: string
          description: >-
            The key of the primary funnel group for this experiment. Either
            <code>primarySingleMetricKey</code> or <code>primaryFunnelKey</code>
            must be present.
          example: metric-group-key-123abc
        treatments:
          $ref: '#/components/schemas/TreatmentsInput'
          description: >-
            Details on the variations you are testing in the experiment. You
            establish these variations in feature flags, and then reuse them in
            experiments.
        flags:
          $ref: '#/components/schemas/FlagsInput'
          description: Details on the feature flag and targeting rules for this iteration
          example: >-
            {"example-flag-key": { "ruleId":
            "e432f62b-55f6-49dd-a02f-eb24acf39d05", "flagConfigVersion": 12,
            "notInExperimentVariationId": "e432f62b-55f6-49dd-a02f-eb24acf39d05"
            }}
        randomizationUnit:
          type: string
          description: The unit of randomization for this iteration. Defaults to user.
          example: user
        reallocationFrequencyMillis:
          type: integer
          description: The cadence (in milliseconds) to update the allocation.
          example: 3600000
        covariateId:
          type: string
          description: The ID of the covariate CSV
        attributes:
          type: array
          description: The attributes that this iteration's results can be sliced by
          items:
            type: string
          example:
            - country
            - device
            - os
    IterationRep:
      type: object
      required:
        - hypothesis
        - status
        - createdAt
      properties:
        _id:
          type: string
          description: The iteration ID
          example: 12ab3c45de678910fgh12345
        hypothesis:
          type: string
          description: The expected outcome of this experiment
          example: The new button placement will increase conversion
        status:
          type: string
          description: >-
            The status of the iteration: <code>not_started</code>,
            <code>running</code>, <code>stopped</code>
          example: running
          enum:
            - not_started
            - running
            - stopped
        createdAt:
          $ref: '#/components/schemas/UnixMillis'
          description: Timestamp of when the iteration was created
          example: '1654104600000'
        startedAt:
          $ref: '#/components/schemas/UnixMillis'
          description: Timestamp of when the iteration started
          example: '1655314200000'
        endedAt:
          $ref: '#/components/schemas/UnixMillis'
          description: Timestamp of when the iteration ended
          example: '1656610200000'
        winningTreatmentId:
          type: string
          description: The ID of the treatment chosen when the experiment stopped
          example: 122c9f3e-da26-4321-ba68-e0fc02eced58
        winningReason:
          type: string
          description: The reason you stopped the experiment
          example: >-
            We ran this iteration for two weeks and the winning variation was
            clear
        canReshuffleTraffic:
          type: boolean
          description: >-
            Whether the experiment may reassign traffic to different variations
            when the experiment audience changes (true) or must keep all traffic
            assigned to its initial variation (false).
          example: true
        flags:
          type: object
          additionalProperties:
            $ref: '#/components/schemas/FlagRep'
          description: Details on the flag used in this experiment
        reallocationFrequencyMillis:
          type: integer
          description: >-
            The cadence (in milliseconds) to update the allocation. Only present
            for multi-armed bandits.
          example: 3600000
        version:
          type: integer
          description: The current version that the iteration is on
          example: 0
        primaryMetric:
          $ref: '#/components/schemas/DependentMetricOrMetricGroupRep'
          description: >-
            Deprecated, use <code>primarySingleMetric</code> and
            <code>primaryFunnel</code> instead. Details on the primary metric
            for this experiment.
          deprecated: true
        primarySingleMetric:
          $ref: '#/components/schemas/MetricV2Rep'
          description: Details on the primary metric for this experiment
        primaryFunnel:
          $ref: '#/components/schemas/DependentMetricGroupRepWithMetrics'
          description: Details on the primary funnel group for this experiment
        randomizationUnit:
          type: string
          description: The unit of randomization for this iteration
          example: user
        attributes:
          type: array
          description: The available attribute filters for this iteration
          items:
            type: string
        treatments:
          type: array
          description: Details on the variations you are testing in the experiment
          items:
            $ref: '#/components/schemas/TreatmentRep'
        secondaryMetrics:
          type: array
          description: >-
            Deprecated, use <code>metrics</code> instead. Details on the
            secondary metrics for this experiment.
          items:
            $ref: '#/components/schemas/MetricV2Rep'
          deprecated: true
        metrics:
          type: array
          description: Details on the metrics for this experiment
          items:
            $ref: '#/components/schemas/DependentMetricOrMetricGroupRep'
        layerSnapshot:
          $ref: '#/components/schemas/LayerSnapshotRep'
          description: >-
            Snapshot of the layer state on iteration stop, if part of a layer.
            Otherwise omitted.
        covariateInfo:
          $ref: '#/components/schemas/CovariateInfoRep'
          description: Details of the covariate file for stratified sampling
    InvalidRequestErrorRep:
      type: object
      required:
        - code
        - message
      properties:
        code:
          type: string
          description: Specific error code encountered
          example: invalid_request
        message:
          type: string
          description: Description of the error
          example: Invalid request body
    UnauthorizedErrorRep:
      type: object
      required:
        - code
        - message
      properties:
        code:
          type: string
          description: Specific error code encountered
          example: unauthorized
        message:
          type: string
          description: Description of the error
          example: Invalid access token
    ForbiddenErrorRep:
      type: object
      required:
        - code
        - message
      properties:
        code:
          type: string
          description: Specific error code encountered
          example: forbidden
        message:
          type: string
          description: Description of the error
          example: Forbidden. Access to the requested resource was denied.
    NotFoundErrorRep:
      type: object
      required:
        - code
        - message
      properties:
        code:
          type: string
          description: Specific error code encountered
          example: not_found
        message:
          type: string
          description: Description of the error
          example: Invalid resource identifier
    RateLimitedErrorRep:
      type: object
      required:
        - code
        - message
      properties:
        code:
          type: string
          description: Specific error code encountered
          example: rate_limited
        message:
          type: string
          description: Description of the error
          example: You've exceeded the API rate limit. Try again later.
    MetricsInput:
      type: array
      items:
        $ref: '#/components/schemas/MetricInput'
    TreatmentsInput:
      type: array
      items:
        $ref: '#/components/schemas/TreatmentInput'
    FlagsInput:
      type: object
      additionalProperties:
        $ref: '#/components/schemas/FlagInput'
    UnixMillis:
      type: integer
      format: int64
    FlagRep:
      type: object
      required:
        - _links
      properties:
        targetingRule:
          type: string
          description: The targeting rule
          example: fallthrough
        targetingRuleDescription:
          type: string
          description: The rule description
          example: Customers who live in Canada
        targetingRuleClauses:
          type: array
          description: >-
            An array of clauses used for individual targeting based on
            attributes
          items: {}
        flagConfigVersion:
          type: integer
          description: The flag version
          example: 12
        notInExperimentVariationId:
          type: string
          description: >-
            The ID of the variation to route traffic not part of the experiment
            analysis to
          example: e432f62b-55f6-49dd-a02f-eb24acf39d05
        _links:
          type: object
          additionalProperties:
            $ref: '#/components/schemas/Link'
          description: The location and content type of related resources
          example:
            self:
              href: /api/v2/flags/my-project/my-flag
              type: application/json
    DependentMetricOrMetricGroupRep:
      type: object
      required:
        - key
        - _versionId
        - name
        - kind
        - _links
        - isGroup
      properties:
        key:
          type: string
          description: A unique key to reference the metric or metric group
          example: metric-key-123abc
        _versionId:
          type: string
          description: The version ID of the metric or metric group
        name:
          type: string
          description: A human-friendly name for the metric or metric group
          example: My metric
        kind:
          type: string
          description: >-
            If this is a metric, then it represents the kind of event the metric
            tracks. If this is a metric group, then it represents the group type
          example: custom
          enum:
            - pageview
            - click
            - custom
            - trace
            - funnel
            - standard
        isNumeric:
          type: boolean
          description: >-
            For custom and trace 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>).
          example: true
        eventKey:
          type: string
          description: >-
            The event key sent with the metric. Only relevant for custom
            metrics.
          example: event-key-123abc
        _links:
          type: object
          additionalProperties:
            $ref: '#/components/schemas/Link'
          description: The location and content type of related resources
          example:
            self:
              href: /api/v2/metrics/my-project/my-metric
              type: application/json
        isGroup:
          type: boolean
          description: Whether this is a metric group or a metric
        metrics:
          type: array
          description: An ordered list of the metrics in this metric group
          items:
            $ref: '#/components/schemas/MetricInGroupRep'
    MetricV2Rep:
      type: object
      required:
        - key
        - name
        - kind
        - _links
      properties:
        key:
          type: string
          description: The metric key
          example: metric-key-123abc
        _versionId:
          type: string
          description: The version ID of the metric
          example: version-id-123abc
        name:
          type: string
          description: The metric name
          example: Example metric
        kind:
          type: string
          description: The kind of event the metric tracks
          example: custom
          enum:
            - pageview
            - click
            - custom
            - trace
        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>).
          example: true
        unitAggregationType:
          type: string
          description: The type of unit aggregation to use for the metric
          example: sum
          enum:
            - sum
            - average
        eventKey:
          type: string
          description: >-
            The event key sent with the metric. Only relevant for custom
            metrics.
          example: event-key-123abc
        _links:
          type: object
          additionalProperties:
            $ref: '#/components/schemas/Link'
          description: The location and content type of related resources
          example:
            self:
              href: /api/v2/metrics/my-project/my-metric
              type: application/json
    DependentMetricGroupRepWithMetrics:
      type: object
      required:
        - key
        - name
        - kind
        - _links
      properties:
        key:
          type: string
          description: A unique key to reference the metric group
          example: metric-group-key-123abc
        name:
          type: string
          description: A human-friendly name for the metric group
          example: My metric group
        kind:
          type: string
          description: The type of the metric group
          example: funnel
          enum:
            - funnel
            - standard
        _links:
          type: object
          additionalProperties:
            $ref: '#/components/schemas/Link'
          description: The location and content type of related resources
          example:
            parent:
              href: /api/v2/projects/my-project
              type: application/json
            self:
              href: /api/v2/projects/my-project/metric-groups/my-metric-group
              type: application/json
        metrics:
          type: array
          description: The metrics in the metric group
          items:
            $ref: '#/components/schemas/MetricInGroupRep'
    TreatmentRep:
      type: object
      required:
        - name
        - allocationPercent
      properties:
        _id:
          type: string
          description: The treatment ID. This is the variation ID from the flag.
          example: 122c9f3e-da26-4321-ba68-e0fc02eced58
        name:
          type: string
          description: The treatment name. This is the variation name from the flag.
          example: Treatment 1
        allocationPercent:
          type: string
          description: >-
            The percentage of traffic allocated to this treatment during the
            iteration
          example: '10'
        baseline:
          type: boolean
          description: >-
            Whether this treatment is the baseline to compare other treatments
            against
          example: true
        parameters:
          type: array
          description: Details on the flag and variation used for this treatment
          items:
            $ref: '#/components/schemas/ParameterRep'
    LayerSnapshotRep:
      type: object
      required:
        - key
        - name
        - reservationPercent
        - otherReservationPercent
      properties:
        key:
          type: string
          description: Key of the layer the experiment was part of
          example: checkout-flow
        name:
          type: string
          description: Layer name at the time this experiment iteration was stopped
          example: Checkout Flow
        reservationPercent:
          type: integer
          description: >-
            Percent of layer traffic that was reserved in the layer for this
            experiment iteration
          example: 10
        otherReservationPercent:
          type: integer
          description: >-
            Percent of layer traffic that was reserved for other experiments in
            the same environment, when this experiment iteration was stopped
          example: 70
    CovariateInfoRep:
      type: object
      required:
        - id
        - fileName
        - createdAt
      properties:
        id:
          type: string
          description: The ID of the covariate matrix
          example: 74a49a2b-4834-4246-917e-5d85231d8c2a
        fileName:
          type: string
          description: The file name of the uploaded covariate matrix
          example: covariate.csv
        createdAt:
          $ref: '#/components/schemas/UnixMillis'
          description: Timestamp of when the covariate was uploaded
          example: '1654104600000'
    MetricInput:
      type: object
      required:
        - key
      properties:
        key:
          type: string
          description: The metric key
          example: metric-key-123abc
        isGroup:
          type: boolean
          description: >-
            Whether this is a metric group (true) or a metric (false). Defaults
            to false
          example: true
        primary:
          type: boolean
          description: >-
            Deprecated, use <code>primarySingleMetricKey</code> and
            <code>primaryFunnelKey</code>. Whether this is a primary metric
            (true) or a secondary metric (false)
          example: true
          deprecated: true
    TreatmentInput:
      type: object
      required:
        - name
        - baseline
        - allocationPercent
        - parameters
      properties:
        name:
          type: string
          description: The treatment name
          example: Treatment 1
        baseline:
          type: boolean
          description: >-
            Whether this treatment is the baseline to compare other treatments
            against
          example: true
        allocationPercent:
          type: string
          description: >-
            The percentage of traffic allocated to this treatment during the
            iteration
          example: '10'
        parameters:
          type: array
          description: Details on the flag and variation to use for this treatment
          items:
            $ref: '#/components/schemas/TreatmentParameterInput'
    FlagInput:
      type: object
      required:
        - ruleId
        - flagConfigVersion
      properties:
        ruleId:
          type: string
          description: >-
            The ID of the variation or rollout of the flag to use. Use
            "fallthrough" for the default targeting behavior when the flag is
            on.
          example: e432f62b-55f6-49dd-a02f-eb24acf39d05
        flagConfigVersion:
          type: integer
          description: The flag version
          example: 12
        notInExperimentVariationId:
          type: string
          description: >-
            The ID of the variation to route traffic not part of the experiment
            analysis to. Defaults to variation ID of baseline treatment, if set.
          example: e432f62b-55f6-49dd-a02f-eb24acf39d05
    Link:
      type: object
      properties:
        href:
          type: string
        type:
          type: string
    MetricInGroupRep:
      type: object
      required:
        - key
        - name
        - kind
        - _links
      properties:
        key:
          type: string
          description: The metric key
          example: metric-key-123abc
        _versionId:
          type: string
          description: The version ID of the metric
          example: version-id-123abc
        name:
          type: string
          description: The metric name
          example: Example metric
        kind:
          type: string
          description: The kind of event the metric tracks
          example: custom
          enum:
            - pageview
            - click
            - custom
            - trace
        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>).
          example: true
        unitAggregationType:
          type: string
          description: The type of unit aggregation to use for the metric
          example: sum
          enum:
            - sum
            - average
        eventKey:
          type: string
          description: >-
            The event key sent with the metric. Only relevant for custom
            metrics.
          example: event-key-123abc
        _links:
          type: object
          additionalProperties:
            $ref: '#/components/schemas/Link'
          description: The location and content type of related resources
          example:
            self:
              href: /api/v2/metrics/my-project/my-metric
              type: application/json
        nameInGroup:
          type: string
          description: >-
            Name of the metric when used within the associated metric group. Can
            be different from the original name of the metric. Required if and
            only if the metric group is a <code>funnel</code>.
          example: Step 1
        randomizationUnits:
          type: array
          description: The randomization units for the metric
          items:
            type: string
          example:
            - user
    ParameterRep:
      type: object
      properties:
        variationId:
          type: string
        flagKey:
          type: string
    TreatmentParameterInput:
      type: object
      required:
        - flagKey
        - variationId
      properties:
        flagKey:
          type: string
          description: The flag key
          example: example-flag-for-experiment
        variationId:
          type: string
          description: The ID of the flag variation
          example: e432f62b-55f6-49dd-a02f-eb24acf39d05
  securitySchemes:
    ApiKey:
      type: apiKey
      in: header
      name: Authorization

````