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

# Create a website test

> Creates a test on one page with a control plus the variants you send. Each variant is a list of DOM operations (text, attributes, classes, inline style, hide, link targets) applied by the tag. Pass a `goal` to create one or `goal_id` to reuse one. With `start: true` the test begins immediately; otherwise it is saved as a draft.



## OpenAPI

````yaml /openapi.json post /v1/optimize/tests
openapi: 3.1.0
info:
  title: RevDesk v1 API
  version: 1.0.0
  description: >-
    Connect RevDesk calls, SMS, phone numbers, caller IDs, caller trust, agents,
    contacts, tasks, webhooks, and usage to the rest of your revenue workflow
    with organization-scoped permissions.
  contact:
    name: RevDesk
    email: support@revdesk.com
servers:
  - url: https://api.revdesk.com
security:
  - bearerAuth: []
tags:
  - name: Phone Numbers
  - name: Caller IDs
  - name: Enterprise Registration
  - name: Branded Calling
  - name: Calls
  - name: SMS
  - name: WebRTC
  - name: Reputation
  - name: Usage
  - name: Account
  - name: Agents
  - name: Appointments
  - name: Contacts
  - name: Documents
  - name: Notifications
  - name: Number Health
  - name: Number Registration
  - name: Optimize
  - name: Sandbox
  - name: Sub-entities
  - name: Tasks
  - name: Webhooks
externalDocs:
  description: RevDesk API versioning and deprecation policy
  url: https://docs.revdesk.com/api-reference/versioning-and-deprecation
paths:
  /v1/optimize/tests:
    post:
      tags:
        - Optimize
      summary: Create a website test
      description: >-
        Creates a test on one page with a control plus the variants you send.
        Each variant is a list of DOM operations (text, attributes, classes,
        inline style, hide, link targets) applied by the tag. Pass a `goal` to
        create one or `goal_id` to reuse one. With `start: true` the test begins
        immediately; otherwise it is saved as a draft.
      operationId: v1_optimize_tests_post
      parameters:
        - name: Idempotency-Key
          in: header
          required: false
          description: >-
            UUID — when present, deduplicates repeat submissions. See
            /api-reference/idempotency.
          schema:
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                property_id:
                  type: string
                  minLength: 1
                name:
                  type: string
                  minLength: 1
                  maxLength: 120
                page_url:
                  type: string
                  minLength: 1
                  maxLength: 2048
                url_match_type:
                  type: string
                  enum:
                    - exact
                    - prefix
                    - regex
                goal:
                  type: object
                  properties:
                    type:
                      type: string
                      enum:
                        - form_submit
                        - tel_click
                        - cta_click
                        - url_visit
                        - selector_click
                    selector:
                      type: string
                      minLength: 1
                      maxLength: 500
                    url_match_type:
                      type: string
                      enum:
                        - exact
                        - prefix
                        - regex
                    url_pattern:
                      type: string
                      minLength: 1
                      maxLength: 500
                  required:
                    - type
                  additionalProperties: false
                goal_id:
                  type: string
                  minLength: 1
                hypothesis:
                  type: string
                  maxLength: 400
                traffic_split:
                  type: number
                  minimum: 0.05
                  maximum: 1
                variants:
                  minItems: 1
                  maxItems: 5
                  type: array
                  items:
                    type: object
                    properties:
                      name:
                        type: string
                        minLength: 1
                        maxLength: 60
                      hypothesis:
                        type: string
                        maxLength: 400
                      ops:
                        maxItems: 40
                        type: array
                        items:
                          oneOf:
                            - type: object
                              properties:
                                selector:
                                  type: string
                                  minLength: 1
                                  maxLength: 500
                                nth:
                                  type: integer
                                  minimum: 0
                                  maximum: 9007199254740991
                                op:
                                  type: string
                                  const: setText
                                value:
                                  type: string
                                  maxLength: 5000
                              required:
                                - selector
                                - op
                                - value
                              additionalProperties: false
                            - type: object
                              properties:
                                selector:
                                  type: string
                                  minLength: 1
                                  maxLength: 500
                                nth:
                                  type: integer
                                  minimum: 0
                                  maximum: 9007199254740991
                                op:
                                  type: string
                                  const: setAttribute
                                name:
                                  type: string
                                  pattern: >-
                                    ^(?!on)(?!src$)(?!srcdoc$)(?!style$)(?!href$)[a-z][a-z0-9-]*$
                                value:
                                  type: string
                                  maxLength: 2000
                              required:
                                - selector
                                - op
                                - name
                                - value
                              additionalProperties: false
                            - type: object
                              properties:
                                selector:
                                  type: string
                                  minLength: 1
                                  maxLength: 500
                                nth:
                                  type: integer
                                  minimum: 0
                                  maximum: 9007199254740991
                                op:
                                  type: string
                                  const: addClass
                                value:
                                  type: string
                                  maxLength: 200
                                  pattern: ^[\w-]+(\s+[\w-]+)*$
                              required:
                                - selector
                                - op
                                - value
                              additionalProperties: false
                            - type: object
                              properties:
                                selector:
                                  type: string
                                  minLength: 1
                                  maxLength: 500
                                nth:
                                  type: integer
                                  minimum: 0
                                  maximum: 9007199254740991
                                op:
                                  type: string
                                  const: removeClass
                                value:
                                  type: string
                                  maxLength: 200
                                  pattern: ^[\w-]+(\s+[\w-]+)*$
                              required:
                                - selector
                                - op
                                - value
                              additionalProperties: false
                            - type: object
                              properties:
                                selector:
                                  type: string
                                  minLength: 1
                                  maxLength: 500
                                nth:
                                  type: integer
                                  minimum: 0
                                  maximum: 9007199254740991
                                op:
                                  type: string
                                  const: setStyle
                                styles:
                                  type: object
                                  propertyNames:
                                    type: string
                                    pattern: ^[a-z-]+$
                                  additionalProperties:
                                    type: string
                                    maxLength: 500
                              required:
                                - selector
                                - op
                                - styles
                              additionalProperties: false
                            - type: object
                              properties:
                                selector:
                                  type: string
                                  minLength: 1
                                  maxLength: 500
                                nth:
                                  type: integer
                                  minimum: 0
                                  maximum: 9007199254740991
                                op:
                                  type: string
                                  const: hide
                              required:
                                - selector
                                - op
                              additionalProperties: false
                            - type: object
                              properties:
                                selector:
                                  type: string
                                  minLength: 1
                                  maxLength: 500
                                nth:
                                  type: integer
                                  minimum: 0
                                  maximum: 9007199254740991
                                op:
                                  type: string
                                  const: replaceHref
                                value:
                                  type: string
                                  maxLength: 2000
                                  pattern: >-
                                    ^(https?:\/\/|tel:|mailto:|sms:|\/(?!\/)|#|\?)
                              required:
                                - selector
                                - op
                                - value
                              additionalProperties: false
                      weight:
                        type: number
                        minimum: 0
                        maximum: 10
                    required:
                      - name
                      - ops
                    additionalProperties: false
                start:
                  type: boolean
              required:
                - name
                - page_url
                - variants
              additionalProperties: false
      responses:
        '201':
          description: Success
          headers:
            RateLimit:
              $ref: '#/components/headers/RateLimit'
            RateLimit-Policy:
              $ref: '#/components/headers/RateLimitPolicy'
            X-RateLimit-Limit:
              $ref: '#/components/headers/XRateLimitLimit'
            X-RateLimit-Remaining:
              $ref: '#/components/headers/XRateLimitRemaining'
            X-RateLimit-Reset:
              $ref: '#/components/headers/XRateLimitReset'
          content:
            application/json:
              schema:
                type: object
                properties:
                  data:
                    type: object
                    properties:
                      id:
                        type: string
                      name:
                        type: string
                      hypothesis:
                        type:
                          - string
                          - 'null'
                      status:
                        type: string
                        enum:
                          - draft
                          - running
                          - paused
                          - completed
                          - shipped
                          - archived
                      kind:
                        type: string
                        enum:
                          - variation
                          - split_url
                      page_url:
                        type: string
                      url_match_type:
                        type: string
                        enum:
                          - exact
                          - prefix
                          - regex
                      goal:
                        anyOf:
                          - type: object
                            properties:
                              id:
                                type: string
                              type:
                                type: string
                                enum:
                                  - form_submit
                                  - tel_click
                                  - cta_click
                                  - url_visit
                                  - selector_click
                              selector:
                                type:
                                  - string
                                  - 'null'
                              url_pattern:
                                type:
                                  - string
                                  - 'null'
                            required:
                              - id
                              - type
                              - selector
                              - url_pattern
                            additionalProperties: false
                          - type: 'null'
                      traffic_split:
                        type: number
                      variants:
                        type: array
                        items:
                          type: object
                          properties:
                            id:
                              type: string
                            name:
                              type: string
                            is_control:
                              type: boolean
                            weight:
                              type: number
                            ops:
                              maxItems: 40
                              type: array
                              items:
                                oneOf:
                                  - type: object
                                    properties:
                                      selector:
                                        type: string
                                        minLength: 1
                                        maxLength: 500
                                      nth:
                                        type: integer
                                        minimum: 0
                                        maximum: 9007199254740991
                                      op:
                                        type: string
                                        const: setText
                                      value:
                                        type: string
                                        maxLength: 5000
                                    required:
                                      - selector
                                      - op
                                      - value
                                    additionalProperties: false
                                  - type: object
                                    properties:
                                      selector:
                                        type: string
                                        minLength: 1
                                        maxLength: 500
                                      nth:
                                        type: integer
                                        minimum: 0
                                        maximum: 9007199254740991
                                      op:
                                        type: string
                                        const: setAttribute
                                      name:
                                        type: string
                                        pattern: >-
                                          ^(?!on)(?!src$)(?!srcdoc$)(?!style$)(?!href$)[a-z][a-z0-9-]*$
                                      value:
                                        type: string
                                        maxLength: 2000
                                    required:
                                      - selector
                                      - op
                                      - name
                                      - value
                                    additionalProperties: false
                                  - type: object
                                    properties:
                                      selector:
                                        type: string
                                        minLength: 1
                                        maxLength: 500
                                      nth:
                                        type: integer
                                        minimum: 0
                                        maximum: 9007199254740991
                                      op:
                                        type: string
                                        const: addClass
                                      value:
                                        type: string
                                        maxLength: 200
                                        pattern: ^[\w-]+(\s+[\w-]+)*$
                                    required:
                                      - selector
                                      - op
                                      - value
                                    additionalProperties: false
                                  - type: object
                                    properties:
                                      selector:
                                        type: string
                                        minLength: 1
                                        maxLength: 500
                                      nth:
                                        type: integer
                                        minimum: 0
                                        maximum: 9007199254740991
                                      op:
                                        type: string
                                        const: removeClass
                                      value:
                                        type: string
                                        maxLength: 200
                                        pattern: ^[\w-]+(\s+[\w-]+)*$
                                    required:
                                      - selector
                                      - op
                                      - value
                                    additionalProperties: false
                                  - type: object
                                    properties:
                                      selector:
                                        type: string
                                        minLength: 1
                                        maxLength: 500
                                      nth:
                                        type: integer
                                        minimum: 0
                                        maximum: 9007199254740991
                                      op:
                                        type: string
                                        const: setStyle
                                      styles:
                                        type: object
                                        propertyNames:
                                          type: string
                                          pattern: ^[a-z-]+$
                                        additionalProperties:
                                          type: string
                                          maxLength: 500
                                    required:
                                      - selector
                                      - op
                                      - styles
                                    additionalProperties: false
                                  - type: object
                                    properties:
                                      selector:
                                        type: string
                                        minLength: 1
                                        maxLength: 500
                                      nth:
                                        type: integer
                                        minimum: 0
                                        maximum: 9007199254740991
                                      op:
                                        type: string
                                        const: hide
                                    required:
                                      - selector
                                      - op
                                    additionalProperties: false
                                  - type: object
                                    properties:
                                      selector:
                                        type: string
                                        minLength: 1
                                        maxLength: 500
                                      nth:
                                        type: integer
                                        minimum: 0
                                        maximum: 9007199254740991
                                      op:
                                        type: string
                                        const: replaceHref
                                      value:
                                        type: string
                                        maxLength: 2000
                                        pattern: >-
                                          ^(https?:\/\/|tel:|mailto:|sms:|\/(?!\/)|#|\?)
                                    required:
                                      - selector
                                      - op
                                      - value
                                    additionalProperties: false
                            redirect_url:
                              type:
                                - string
                                - 'null'
                          required:
                            - id
                            - name
                            - is_control
                            - weight
                            - ops
                            - redirect_url
                          additionalProperties: false
                      started_at:
                        type:
                          - string
                          - 'null'
                      completed_at:
                        type:
                          - string
                          - 'null'
                      shipped_at:
                        type:
                          - string
                          - 'null'
                      winner_variant_id:
                        type:
                          - string
                          - 'null'
                      created_at:
                        type: string
                    required:
                      - id
                      - name
                      - hypothesis
                      - status
                      - kind
                      - page_url
                      - url_match_type
                      - goal
                      - traffic_split
                      - variants
                      - started_at
                      - completed_at
                      - shipped_at
                      - winner_variant_id
                      - created_at
                    additionalProperties: false
                required:
                  - data
                additionalProperties: false
        '400':
          description: Validation error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorEnvelope'
        '401':
          description: Unauthorized
          headers:
            WWW-Authenticate:
              $ref: '#/components/headers/WWWAuthenticate'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorEnvelope'
        '403':
          description: Forbidden
          headers:
            WWW-Authenticate:
              $ref: '#/components/headers/WWWAuthenticate'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorEnvelope'
        '404':
          description: Not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorEnvelope'
        '409':
          description: Conflict (incl. idempotency conflicts)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorEnvelope'
        '429':
          description: Rate limited
          headers:
            RateLimit:
              $ref: '#/components/headers/RateLimit'
            RateLimit-Policy:
              $ref: '#/components/headers/RateLimitPolicy'
            X-RateLimit-Limit:
              $ref: '#/components/headers/XRateLimitLimit'
            X-RateLimit-Remaining:
              $ref: '#/components/headers/XRateLimitRemaining'
            X-RateLimit-Reset:
              $ref: '#/components/headers/XRateLimitReset'
            Retry-After:
              $ref: '#/components/headers/RetryAfter'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorEnvelope'
components:
  headers:
    RateLimit:
      description: >-
        Current quota remaining and seconds until reset, using the IETF
        RateLimit structured-field syntax.
      schema:
        type: string
        example: '"default";r=599;t=60'
    RateLimitPolicy:
      description: Named quota policy and one-minute window.
      schema:
        type: string
        example: '"default";q=600;w=60'
    XRateLimitLimit:
      description: Maximum requests allowed in the current one-minute window.
      schema:
        type: integer
    XRateLimitRemaining:
      description: Requests remaining in the current window.
      schema:
        type: integer
    XRateLimitReset:
      description: Unix timestamp in milliseconds when the current window resets.
      schema:
        type: integer
    WWWAuthenticate:
      description: >-
        Bearer challenge with RFC 9728 protected-resource metadata and, on scope
        failures, the required scope.
      schema:
        type: string
    RetryAfter:
      description: Seconds to wait before retrying a rate-limited request.
      schema:
        type: integer
        minimum: 0
  schemas:
    ErrorEnvelope:
      type: object
      properties:
        error:
          type: object
          required:
            - code
            - message
          properties:
            code:
              type: string
            message:
              type: string
            resolution_hint:
              type: string
            fields:
              type: object
              additionalProperties:
                type: string
            doc_url:
              type: string
              format: uri
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: RevDesk API key
      description: >-
        Organization-scoped RevDesk API key. Each operation declares its
        required permissions in x-required-scopes.
      x-scopes-supported:
        - account:read
        - agents:read
        - agents:write
        - bookings:read
        - brand:read
        - brand:write
        - caller_trust:read
        - caller_trust:write
        - calls:read
        - calls:write
        - contacts:read
        - contacts:write
        - jobs:read
        - jobs:write
        - notifications:write
        - phone_numbers:read
        - phone_numbers:write
        - optimize:read
        - optimize:write
        - sms:read
        - sms:write
        - sub_entities:read
        - sub_entities:write
        - tokens:mint
        - transcripts:read
        - usage:read
        - voice:read
        - voice:webrtc
        - voice:write
        - webhooks:read
        - webhooks:write

````