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

# Update Experiment

> Updates an existing experiment for a title.

Allowed entity token types: title

## Error codes

This operation may return the following PlayFab errors:

| Error | Code |
| --- | --- |
| ExperimentationExclusionGroupInsufficientCapacity | 7019 |
| ExperimentationExclusionGroupInvalidTrafficAllocation | 7021 |
| ExperimentationExclusionGroupNotFound | 7018 |
| ExperimentationExperimentNotFound | 7002 |
| ExperimentationExperimentRunning | 7001 |
| ExperimentationExperimentStopped | 7000 |
| ExperimentationInvalidDuration | 7012 |
| ExperimentationInvalidEndDate | 7015 |
| ExperimentationInvalidStartDate | 7016 |
| ExperimentationLegacyExperimentInvalidOperation | 7023 |
| ExperimentationMaxDurationExceeded | 7017 |
| FeatureNotConfiguredForTitle | 1177 |
| ProductDisabledForTitle | 1609 |
| SegmentNotFound | 1220 |




## OpenAPI

````yaml /services/playfab/api-references/rest/experimentation/experimentation.openapi.json post /Experimentation/UpdateExperiment
openapi: 3.0.0
info:
  version: '260922'
  title: PlayFab Experimentation API
  description: APIs for managing experiments.
  termsOfService: https://playfab.com/terms/
  contact:
    url: https://community.playfab.com/index.html
  license:
    name: Apache 2.0
    url: https://github.com/PlayFab/API_Specs/blob/master/LICENSE
servers:
  - url: https://{titleId}.playfabapi.com
    description: PlayFab title endpoint
    variables:
      titleId:
        default: your_title_id
        description: Your PlayFab title ID (hex).
security: []
tags:
  - name: Experimentation
    description: ''
paths:
  /Experimentation/UpdateExperiment:
    post:
      tags:
        - Experimentation
      summary: Update Experiment
      description: |
        Updates an existing experiment for a title.

        Allowed entity token types: title

        ## Error codes

        This operation may return the following PlayFab errors:

        | Error | Code |
        | --- | --- |
        | ExperimentationExclusionGroupInsufficientCapacity | 7019 |
        | ExperimentationExclusionGroupInvalidTrafficAllocation | 7021 |
        | ExperimentationExclusionGroupNotFound | 7018 |
        | ExperimentationExperimentNotFound | 7002 |
        | ExperimentationExperimentRunning | 7001 |
        | ExperimentationExperimentStopped | 7000 |
        | ExperimentationInvalidDuration | 7012 |
        | ExperimentationInvalidEndDate | 7015 |
        | ExperimentationInvalidStartDate | 7016 |
        | ExperimentationLegacyExperimentInvalidOperation | 7023 |
        | ExperimentationMaxDurationExceeded | 7017 |
        | FeatureNotConfiguredForTitle | 1177 |
        | ProductDisabledForTitle | 1609 |
        | SegmentNotFound | 1220 |
      operationId: UpdateExperiment
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/UpdateExperimentRequest'
        description: >-
          Given a title entity token and experiment details, this API updates
          the experiment. If an experiment is already running, only the
          description and duration properties can be updated.
      responses:
        '200':
          $ref: '#/components/responses/EmptyResponse'
        '400':
          $ref: '#/components/responses/ApiErrorWrapper'
      security:
        - EntityToken: []
components:
  schemas:
    UpdateExperimentRequest:
      description: >-
        Given a title entity token and experiment details, this API updates the
        experiment. If an experiment is already running, only the description
        and duration properties can be updated.
      type: object
      properties:
        CustomTags:
          description: >-
            The optional custom tags associated with the request (e.g. build
            number, external trace identifiers, etc.).
          type: object
        Description:
          description: Description of the experiment.
          type: string
        EndDate:
          description: When experiment should end.
          type: string
        ExclusionGroupId:
          description: Id of the exclusion group.
          type: string
        ExclusionGroupTrafficAllocation:
          description: Percentage of exclusion group traffic that will see this experiment.
          type: number
          x-actualtype: uint32
        ExperimentType:
          allOf:
            - $ref: '#/components/schemas/ExperimentType'
          description: Type of experiment.
        Id:
          description: Id of the experiment.
          type: string
        Name:
          description: Friendly name of the experiment.
          type: string
        SegmentId:
          description: >-
            Id of the segment to which this experiment applies. Defaults to the
            'All Players' segment.
          type: string
        StartDate:
          description: When experiment should start.
          type: string
        TitlePlayerAccountTestIds:
          description: >-
            List of title player account IDs that automatically receive
            treatments in the experiment, but are not included when calculating
            experiment metrics.
          type: array
          items:
            type: string
        Variants:
          description: List of variants for the experiment.
          type: array
          items:
            $ref: '#/components/schemas/Variant'
          x-isclass: true
      required:
        - Name
        - Id
        - StartDate
        - Variants
      example:
        Name: BackgroundColor Experiment
        Id: B9A90E90-A009-4254-80A4-46B5933E9D26
        Description: Tests whether a green background color increases revenue
        StartDate: '2019-10-25T20:37:00Z'
        EndDate: '2019-11-13T20:37:00Z'
        SegmentId: '0'
        Variants:
          - Name: Control
            Description: Control variant
            TrafficPercentage: 10
            Variables:
              - Name: BackgroundColor
                Value: White
            IsControl: true
          - Name: Treatment
            Description: Treatment variant
            TrafficPercentage: 90
            Variables:
              - Name: BackgroundColor
                Value: Green
    ExperimentType:
      type: string
      enum:
        - Active
        - Snapshot
    Variant:
      type: object
      properties:
        Description:
          description: Description of the variant.
          type: string
        Id:
          description: Id of the variant.
          type: string
        IsControl:
          description: Specifies if variant is control for experiment.
          type: boolean
        Name:
          description: Name of the variant.
          type: string
        TitleDataOverrideLabel:
          description: Id of the TitleDataOverride to use with this variant.
          type: string
        TrafficPercentage:
          description: Percentage of target audience traffic that will see this variant.
          type: number
          x-actualtype: uint32
        Variables:
          description: Variables returned by this variant.
          type: array
          items:
            $ref: '#/components/schemas/Variable'
          x-isclass: true
      required:
        - Name
        - TrafficPercentage
        - IsControl
    EmptyResponse:
      type: object
      properties: {}
    ApiErrorWrapper:
      description: The basic wrapper around every failed API response
      type: object
      properties:
        code:
          description: Numerical HTTP code
          type: integer
        status:
          description: String HTTP code
          type: string
        error:
          description: Playfab error code
          type: string
        errorCode:
          description: Numerical PlayFab error code
          type: integer
        errorMessage:
          description: Description for the PlayFab errorCode
          type: string
        errorDetails:
          description: Detailed description of individual issues with the request object
          type: object
      required:
        - code
        - errorCode
    Variable:
      type: object
      properties:
        Name:
          description: Name of the variable.
          type: string
        Value:
          description: Value of the variable.
          type: string
      required:
        - Name
  responses:
    EmptyResponse:
      description: ''
      content:
        application/json:
          schema:
            type: object
            properties:
              code:
                type: integer
                description: >-
                  The Http status code. If X-ReportErrorAsSuccess header is set
                  to true, this will report the actual http error code.
              status:
                type: string
                description: The Http status code as a string.
              data:
                $ref: '#/components/schemas/EmptyResponse'
    ApiErrorWrapper:
      description: This is the outer wrapper for all responses with errors
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ApiErrorWrapper'
  securitySchemes:
    EntityToken:
      type: apiKey
      in: header
      name: X-EntityToken
      description: >-
        This API requires an Entity Session Token, available from the Entity
        GetEntityToken method.

````

## Related topics

- [Update Experiment](/services/playfab/api-references/rest/experimentation/experimentation/update-experiment.md)
- [Experimentation APIs](/services/playfab/live-service-management/game-configuration/experiments/experimentation-apis.md)
- [Experiment](/services/playfab/api-references/events/data-types/experiment.md)
- [experiment_updated](/services/playfab/api-references/events/Experimentation/experiment-updated.md)
- [Experiments Quickstart](/services/playfab/live-service-management/game-configuration/experiments/quickstart.md)
