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

# Create an A/B experiment

> Creates a managed control/variant split across two to 20 deployments under the same endpoint. Exactly one member is the control, member percentages must add up to 100, and the split applies only to traffic that the endpoint would otherwise send to the control.



## OpenAPI

````yaml POST /projects/{projectId}/endpoints/{endpointId}/abExperiments
openapi: 3.1.0
info:
  title: Together APIs
  description: The Together REST API. See https://docs.together.ai for more details.
  version: 2.0.0
  termsOfService: https://www.together.ai/terms-of-service
  contact:
    name: Together Support
    url: https://www.together.ai/contact
  license:
    name: MIT
    url: https://github.com/togethercomputer/openapi/blob/main/LICENSE
servers:
  - url: https://api.together.ai/v1
    description: Default environment for APIs
  - url: https://api-inference.together.ai/v2
    description: Optimized environment for inference
security:
  - bearerAuth: []
paths:
  /projects/{projectId}/endpoints/{endpointId}/abExperiments:
    post:
      tags:
        - ABExperimentService
      summary: Create an A/B experiment
      description: >-
        Creates a managed control/variant split across two to 20 deployments
        under the same endpoint. Exactly one member is the control, member
        percentages must add up to 100, and the split applies only to traffic
        that the endpoint would otherwise send to the control.
      operationId: ABExperimentService_CreateABExperiment
      parameters:
        - name: projectId
          in: path
          required: true
          schema:
            description: Project identifier.
            type: string
        - name: endpointId
          in: path
          required: true
          schema:
            description: Endpoint identifier.
            type: string
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/DE.CreateABExperimentRequest'
        required: true
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/DE.ABExperiment'
        default:
          description: Default error response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorData'
      servers:
        - url: https://api.together.ai/v2
components:
  schemas:
    DE.CreateABExperimentRequest:
      type: object
      description: >-
        Configuration for a managed live-traffic split across deployments under
        one endpoint.
      required:
        - name
        - members
      properties:
        name:
          type: string
          description: Human-readable A/B experiment name, unique within the endpoint.
        description:
          type: string
          description: Optional free-form description.
        members:
          type: array
          items:
            $ref: '#/components/schemas/DE.ABExperimentMember'
          description: >-
            Two to 20 participating deployments with exactly one control.
            Integer traffic percentages across all members must add up to 100.
    DE.ABExperiment:
      type: object
      required:
        - name
        - members
        - id
        - projectId
        - endpointId
        - createdAt
        - createdBy
        - updatedAt
        - etag
      properties:
        id:
          type: string
          description: Output only. Unique A/B experiment identifier.
        projectId:
          type: string
          description: Output only. Project that owns the parent endpoint.
        endpointId:
          type: string
          description: Output only. Endpoint this A/B experiment belongs to.
        name:
          type: string
          description: Human-readable A/B experiment name, unique within the endpoint.
        description:
          type: string
          description: Optional free-form description.
        members:
          type: array
          items:
            $ref: '#/components/schemas/DE.ABExperimentMember'
          description: >-
            Two to 20 participating deployments with exactly one control and
            percentages that add up to 100.
        createdBy:
          type: string
          description: >-
            Output only. Identifier of the principal that created the A/B
            experiment.
        createdAt:
          type: string
          description: Output only. Timestamp when the A/B experiment was created.
          format: date-time
        updatedAt:
          type: string
          description: Output only. Timestamp when the A/B experiment was last updated.
          format: date-time
        etag:
          type: string
          description: Optional opaque version tag for optimistic concurrency control.
      description: >-
        Managed cohort split that subdivides a control deployment's live traffic
        among the control and one or more variants.
    ErrorData:
      type: object
      required:
        - error
      properties:
        error:
          type: object
          properties:
            message:
              type: string
              nullable: false
            type:
              type: string
              nullable: false
            param:
              type: string
              nullable: true
              default: null
            code:
              type: string
              nullable: true
              default: null
          required:
            - type
            - message
    DE.ABExperimentMember:
      type: object
      properties:
        deploymentId:
          type: string
          description: Deployment under the parent endpoint.
        role:
          enum:
            - AB_EXPERIMENT_MEMBER_ROLE_CONTROL
            - AB_EXPERIMENT_MEMBER_ROLE_VARIANT
          type: string
          description: Role of this deployment within the A/B experiment.
        percent:
          type: integer
          description: >-
            Integer traffic percent in [1, 100]. Percentages across all members
            must sum to 100.
      description: Deployment participating in an A/B experiment.
      required:
        - deploymentId
        - role
        - percent
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      x-bearer-format: bearer
      x-default: default

````