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

# Split new conversations between the base and the variants

> Replaces the whole traffic split: each variant named gets its percentage, any variant left out gets 0, and the rest stays on the base configuration. Send `baselinePercentage` with what you expect to stay on the base; if it does not match, the call answers 409 with the right number and saves nothing. Setting a variant to 0 pauses it. The split decides only what NEW conversations draw: a conversation keeps the variant it drew until it ends, so pausing a variant does not move the ones already running it. A variant you cannot edit can be kept at its current percentage, never changed.



## OpenAPI

````yaml /api-reference/specs/claudia/v1.json put /v1/projects/{project}/ab-test/traffic
openapi: 3.0.1
info:
  title: Claudia API
  version: 1.0.0
servers:
  - url: https://api.cloudhumans.com/claudia
    description: Production
  - url: https://api.cloudhumans.com/claudia/staging
    description: Staging
security:
  - bearerAuth: []
tags:
  - name: MCP Servers
    description: >-
      The MCP servers your agents can call tools on. Registering one here is
      what makes its tools selectable in an agent; the credentials it needs are
      stored encrypted and never read back.
  - name: Knowledge Base Content
    description: Read, search and edit the content that answers your customers.
  - name: Content Quality
    description: Rewrites proposed for content that is answering your customers badly.
  - name: Playground
    description: >-
      Talk to one of your agents as if you were a customer, without touching a
      real conversation.
  - name: Project Settings
    description: >-
      Read and change how a ClaudIA project behaves — the settings screens of
      the ClaudIA app, as an API.
  - name: Content Improvements
    description: Answers Claudia proposes for questions your content does not cover yet.
  - name: Knowledge Bases
    description: The knowledge bases your account can manage.
  - name: Content Sources
    description: The sites Claudia crawls to keep a knowledge base in sync.
  - name: Agents
    description: >-
      The AI agents (assistants) configured for your tenant: the orchestrator
      (supervisor) and its specialists (react). Reads answer the same
      passthrough shape the platform stores; creates land as DRAFTS a human
      reviews and publishes in the app.
  - name: Agent Tools
    description: >-
      The tool catalog your agents can be given, aggregated across every MCP
      server registered for the tenant. This is the same catalog an assistant's
      mcp_servers[].tools whitelist is validated against.
  - name: Conversations
    description: >-
      Read access to a conversation's lean investigation summary — messages,
      status and resolution — and the execution trace behind one of its
      processed messages, without the internal processing state the hub UI's
      full read carries.
paths:
  /v1/projects/{project}/ab-test/traffic:
    put:
      tags:
        - A/B Tests
      summary: Split new conversations between the base and the variants
      description: >-
        Replaces the whole traffic split: each variant named gets its
        percentage, any variant left out gets 0, and the rest stays on the base
        configuration. Send `baselinePercentage` with what you expect to stay on
        the base; if it does not match, the call answers 409 with the right
        number and saves nothing. Setting a variant to 0 pauses it. The split
        decides only what NEW conversations draw: a conversation keeps the
        variant it drew until it ends, so pausing a variant does not move the
        ones already running it. A variant you cannot edit can be kept at its
        current percentage, never changed.
      operationId: setAbTraffic
      parameters:
        - name: project
          in: path
          description: >-
            The ClaudIA project to act on, by name. Get the names from
            listMyClaudiaProjects — a project these credentials do not cover
            answers 404, indistinguishable from one that does not exist.
          required: true
          schema:
            type: string
        - name: accountId
          in: query
          description: >-
            The CloudChat account whose permissions decide what you may read and
            write here, e.g. `7`. It is permission context, not the resource:
            the project is named in the path. Only unique within an instance, so
            it is always read together with the `cloudchat-instance` header —
            get the pair from listMyCloudChatAccounts. An account your
            credentials hold no editing claim for answers 403.
          required: true
          schema:
            type: string
        - name: cloudchat-instance
          in: header
          description: >-
            The CloudChat instance the account lives in, e.g. `4`. Sent as a
            header, and required: with `accountId` it forms the pair that names
            exactly one account, which `accountId` alone does not.
            listMyCloudChatAccounts returns the value to send here alongside
            each accountId.
          required: true
          schema:
            type: string
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ProjectAbTraffic'
        required: true
      responses:
        '200':
          description: Saved. The whole A/B test is returned as it now stands.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ProjectAbTest'
        '400':
          description: >-
            A variant that does not exist, a percentage outside 0 to 100, or
            variants adding up to more than 100. Nothing was saved.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ProjectAbTestRefused'
        '401':
          description: Missing, expired or invalid credentials.
        '403':
          description: >-
            The split changes the traffic of a variant these credentials cannot
            edit. Nothing was saved.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ProjectAbTestRefused'
        '404':
          description: >-
            No such resource, or none these credentials can reach — the two are
            deliberately indistinguishable.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '409':
          description: >-
            `baselinePercentage` does not match what the split leaves on the
            base, and carries the right number; or (`concurrent_change`: someone
            else changed the A/B test since it was read. Nothing was saved; read
            it again with getProjectAbTest and redo the change on top of what is
            there now.)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ProjectAbTestRefused'
        '429':
          description: Rate limit applied by the API gateway. Back off and retry.
components:
  schemas:
    ProjectAbTraffic:
      required:
        - percentages
      type: object
      properties:
        percentages:
          type: object
          additionalProperties:
            type: integer
            description: >-
              Percent of new conversations for each variant, by key. Each
              between 0 and 100, summing to at most 100.
            format: int32
          description: >-
            Percent of new conversations for each variant, by key. Each between
            0 and 100, summing to at most 100.
          example:
            short_summary: 20
        baselinePercentage:
          type: integer
          description: >-
            What you expect to stay on the base configuration: 100 minus the sum
            of `percentages`. It is checked, not applied — a different number is
            refused with the right one and nothing is saved.
          format: int32
          example: 80
      description: >-
        The whole traffic split, sent at once. A variant left out receives no
        traffic.
    ProjectAbTest:
      required:
        - baselinePercentage
        - variants
      type: object
      properties:
        baselinePercentage:
          type: integer
          description: >-
            Share of new conversations that run the base configuration, in
            percent.
          format: int32
          example: 80
        variants:
          type: array
          description: >-
            Every variant this project declares, including the ones receiving no
            traffic.
          items:
            $ref: '#/components/schemas/ProjectAbVariant'
      description: >-
        How this project's conversations are split between its base
        configuration and each A/B variant. Every new conversation draws once
        and keeps the variant it drew until it ends, always running that
        variant's current settings.
    ProjectAbTestRefused:
      required:
        - error
        - reason
      type: object
      properties:
        error:
          type: string
          description: What went wrong.
          example: The base share does not match the variants' traffic
        reason:
          type: string
          description: >-
            Machine-readable cause: `invalid_key`, `unknown_variant`,
            `locked_variant`, `not_overridable`, `forbidden_fields`,
            `not_applicable`, `invalid_settings`, `percentage_out_of_range`,
            `traffic_over_100`, `baseline_mismatch`, `variant_live` or
            `concurrent_change`.
          example: baseline_mismatch
        keys:
          type: array
          description: >-
            The variant keys or dotted setting paths the refusal is about, when
            it names any.
          items:
            type: string
            description: >-
              The variant keys or dotted setting paths the refusal is about,
              when it names any.
        expectedBaselinePercentage:
          type: integer
          description: >-
            On `baseline_mismatch`: the base share these percentages actually
            leave.
          format: int32
          example: 80
        violations:
          type: array
          description: 'On `invalid_settings`: every rule the overrides broke.'
          items:
            $ref: '#/components/schemas/ProjectSettingsViolation'
      description: The change was refused and nothing was saved.
    Error:
      required:
        - error
      type: object
      properties:
        error:
          type: string
          description: What went wrong.
          example: 'Forbidden: token holds no claim for the requested account'
      description: Something the caller needs to fix.
    ProjectAbVariant:
      required:
        - editable
        - hiddenOverrideCount
        - key
        - overrides
        - percentage
      type: object
      properties:
        key:
          type: string
          description: Identifies the variant. Also what runPlayground takes as `abKey`.
          example: short_summary
        percentage:
          type: integer
          description: >-
            Share of new conversations that run this variant, in percent. 0
            means paused.
          format: int32
          example: 20
        editable:
          type: boolean
          description: >-
            Whether these credentials may change this variant: edit it, change
            its traffic or delete it. A variant is editable only by someone who
            may write every setting it overrides.
        overrides:
          type: object
          additionalProperties: true
          description: >-
            The settings this variant replaces, nested as in getProjectSettings,
            limited to the ones these credentials may read.
          example:
            summaryPrompt: Resuma em uma frase.
        hiddenOverrideCount:
          type: integer
          description: >-
            How many overridden settings were left out of `overrides` because
            these credentials cannot read them. Above 0 means the variant
            changes more than what is shown.
          format: int32
          example: 0
      description: 'One A/B variant: the settings it replaces and the traffic it receives.'
    ProjectSettingsViolation:
      required:
        - params
        - path
        - ruleId
      type: object
      properties:
        path:
          type: string
          description: The dotted path the rule applies to.
          example: splitLargeMessages.chunkSize
        ruleId:
          type: string
          description: Which rule was broken.
          example: value_out_of_range
        params:
          type: object
          additionalProperties:
            type: object
            description: The rule's bounds or expected values, when it has any.
            example:
              min: 1
              max: 4096
          description: The rule's bounds or expected values, when it has any.
          example:
            min: 1
            max: 4096
      description: One rule the patch broke.
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.