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

# Create an A/B test



## OpenAPI

````yaml /openapi.yaml post /v1/ab_tests
openapi: 3.1.0
info:
  title: VTurb API
  version: v1
  description: |
    Public REST API for VTurb. Dev-first and agents-first: every documented
    response is recorded from the API's real behavior.
  contact:
    name: VTurb API
    url: https://vturb.com
servers:
  - url: https://api.vturb.com
security:
  - bearerAuth: []
paths:
  /v1/ab_tests:
    post:
      tags:
        - A/B tests
      summary: Create an A/B test
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                name:
                  type: string
                folder_id:
                  type: string
                variants:
                  type: array
                  items:
                    type: object
                    properties:
                      video_id:
                        type: string
                      traffic_percentage:
                        type: number
                        format: float
                      locked:
                        type: boolean
                    required:
                      - video_id
                      - traffic_percentage
              required:
                - name
                - variants
            example:
              name: Home page test
              folder_id: 66a0c1d2e3f4a5b6c7d8e9f0
              variants:
                - video_id: 68c1f0a00000000000000e01
                  traffic_percentage: 60.5
                  locked: false
                - video_id: 68c1f0a00000000000000e02
                  traffic_percentage: 39.5
                  locked: true
      responses:
        '201':
          description: >-
            The created A/B test, as a draft: it splits no traffic until it is
            started. A test carries 2 to 10 variants, whose traffic_percentage
            must sum to 100. folder_id and each variant's locked are optional;
            an omitted folder leaves the test at the root.
          content:
            application/json:
              schema:
                type: object
                properties:
                  id:
                    type: string
                  status:
                    type: string
                  name:
                    type: string
                  folder_id:
                    type:
                      - string
                      - 'null'
                  started_at:
                    type:
                      - string
                      - 'null'
                  created_at:
                    type: string
                  updated_at:
                    type: string
                  variants:
                    type: array
                    items:
                      type: object
                      properties:
                        video_id:
                          type: string
                        traffic_percentage:
                          type: number
                          format: float
                        locked:
                          type: boolean
                        started_at:
                          type:
                            - string
                            - 'null'
                      required:
                        - video_id
                        - traffic_percentage
                        - locked
                        - started_at
                required:
                  - id
                  - status
                  - name
                  - folder_id
                  - started_at
                  - created_at
                  - updated_at
                  - variants
              example:
                id: 68c1f0a0000000000000ab01
                status: draft
                name: Home page test
                folder_id: null
                started_at: null
                created_at: '2026-09-01T12:00:00.000Z'
                updated_at: '2026-09-02T12:00:00.000Z'
                variants:
                  - video_id: 68c1f0a00000000000000e01
                    traffic_percentage: 60
                    locked: false
                    started_at: null
                  - video_id: 68c1f0a00000000000000e02
                    traffic_percentage: 40
                    locked: false
                    started_at: null
        '400':
          description: started_at is set by POST /v1/ab_tests/:id/run, never by the create.
          content:
            application/problem+json:
              schema:
                type: object
                properties:
                  type:
                    type: string
                  code:
                    type: string
                  message:
                    type: string
                  field:
                    type: string
                  request_id:
                    type: string
                required:
                  - type
                  - code
                  - message
                  - field
                  - request_id
              example:
                type: https://docs.vturb.com/errors/bad_request
                code: bad_request
                message: The request includes fields this endpoint does not accept.
                field: started_at
                request_id: 00000000-0000-0000-0000-000000000000
        '401':
          description: Missing API credential.
          content:
            application/problem+json:
              schema:
                type: object
                properties:
                  type:
                    type: string
                  code:
                    type: string
                  message:
                    type: string
                  request_id:
                    type: string
                required:
                  - type
                  - code
                  - message
                  - request_id
              example:
                type: https://docs.vturb.com/errors/unauthorized
                code: unauthorized
                message: >-
                  Missing or invalid API credential. Send a vt_ token in the
                  Authorization header.
                request_id: 00000000-0000-0000-0000-000000000000
        '403':
          description: The credential is missing the ab_tests:write scope.
          content:
            application/problem+json:
              schema:
                type: object
                properties:
                  type:
                    type: string
                  code:
                    type: string
                  message:
                    type: string
                  request_id:
                    type: string
                required:
                  - type
                  - code
                  - message
                  - request_id
              example:
                type: https://docs.vturb.com/errors/forbidden
                code: forbidden
                message: The credential is missing the scope this action requires.
                request_id: 00000000-0000-0000-0000-000000000000
        '422':
          description: variants must be an array of objects.
          content:
            application/problem+json:
              schema:
                type: object
                properties:
                  type:
                    type: string
                  code:
                    type: string
                  message:
                    type: string
                  request_id:
                    type: string
                  errors:
                    type: array
                    items:
                      type: object
                      properties:
                        field:
                          type: string
                        message:
                          type: string
                      required:
                        - field
                        - message
                required:
                  - type
                  - code
                  - message
                  - request_id
                  - errors
              example:
                type: https://docs.vturb.com/errors/unprocessable_content
                code: unprocessable_content
                message: The request is invalid. See errors for the fields that failed.
                request_id: 00000000-0000-0000-0000-000000000000
                errors:
                  - field: variants
                    message: must be an array
        '503':
          description: The service is temporarily unavailable; retry shortly.
          content:
            application/problem+json:
              schema:
                type: object
                properties:
                  type:
                    type: string
                  code:
                    type: string
                  message:
                    type: string
                  request_id:
                    type: string
                required:
                  - type
                  - code
                  - message
                  - request_id
              example:
                type: https://docs.vturb.com/errors/service_unavailable
                code: service_unavailable
                message: The service is temporarily unavailable. Retry shortly.
                request_id: 00000000-0000-0000-0000-000000000000
components:
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: >-
        Paste your VTurb API token (vt_...). Sent as `Authorization: Bearer
        <token>`.

````