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

# Add Variant to Step

> Adds a new message variant to a step. Multiple variants enable A/B testing

## Overview

Adds a new message variant to a step, enabling A/B testing of different message approaches. Variants are only applicable to `message` and `screener` type steps.

## What are Variants?

Variants are different versions of the same message that WaLead rotates through to test which performs better. Each variant:

* Has its own message template
* Can be enabled or disabled independently
* Can have custom ICP (Ideal Customer Profile) targeting
* Includes AI tool configurations for personalization

## Request Body

The request body is optional. You can create an empty variant and update it later:

```json theme={null}
{
  "body": "Hi {{firstName}}, I noticed you work at {{companyName}}..."
}
```

Or create without a body (empty variant):

```json theme={null}
{}
```

## Variant Rotation

WaLead automatically rotates through enabled variants to distribute tests evenly:

* Each lead is assigned a variant based on the order
* Disabled variants are skipped
* Performance metrics are tracked per variant

## Use Cases

### A/B Testing Different Approaches

```json theme={null}
// Variant 1: Direct value proposition
{
  "body": "Hi {{firstName}}, I help companies like {{companyName}} reduce costs by 30%..."
}

// Variant 2: Question-based approach
{
  "body": "Hi {{firstName}}, are you looking for ways to optimize your team's workflow?"
}

// Variant 3: Social proof
{
  "body": "Hi {{firstName}}, we've helped 100+ companies in your industry..."
}
```

### ICP-Specific Messages

Use the `icpDefinitionRaw` field (via update variant) to target specific lead profiles with different messages.

## Response

Returns the complete array of variants for the step, including the newly created one with its assigned ID and order.

## Next Steps

After creating a variant:

1. Update its message body if you created it empty
2. Configure ICP targeting if needed
3. Ensure at least one variant remains enabled


## OpenAPI

````yaml POST /v1/campaigns/{id}/steps/{stepId}/variants
openapi: 3.1.0
info:
  title: WaLead API
  description: >-
    WaLead Public API for managing LinkedIn outreach campaigns, leads, and
    analytics
  version: 1.0.0
  contact:
    name: WaLead Support
    url: https://walead.ai
servers:
  - url: https://app-api.walead.ai/api
    description: Production server
security:
  - apiKeyAuth: []
paths:
  /v1/campaigns/{id}/steps/{stepId}/variants:
    post:
      summary: Add Variant to Step
      description: >-
        Adds a new message variant to a step. Multiple variants enable A/B
        testing
      parameters:
        - name: id
          in: path
          description: Campaign ID
          required: true
          schema:
            type: string
        - name: stepId
          in: path
          description: Step ID
          required: true
          schema:
            type: string
      requestBody:
        description: Variant content (optional)
        content:
          application/json:
            schema:
              type: object
              properties:
                body:
                  type: string
                  description: Message template body
      responses:
        '200':
          description: Variant added successfully
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                  message:
                    type: string
                  variants:
                    type: array
                    items:
                      $ref: '#/components/schemas/StepVariant'
        '401':
          description: Unauthorized - Invalid API Key
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '404':
          description: Campaign or step not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
components:
  schemas:
    StepVariant:
      type: object
      properties:
        id:
          type: string
          description: Unique variant identifier
        body:
          type: string
          description: Message template content
        order:
          type: integer
          description: Variant order for rotation
        isDisabled:
          type: boolean
          description: Whether this variant is disabled
        icpDefinitionRaw:
          type: string
          nullable: true
          description: ICP (Ideal Customer Profile) definition for targeting
        stepId:
          type: string
          description: Associated step ID
        aiTools:
          type: array
          items:
            $ref: '#/components/schemas/AITool'
          description: AI tools enabled for this variant
    Error:
      type: object
      required:
        - statusCode
        - message
      properties:
        statusCode:
          type: integer
          description: HTTP status code
        message:
          type: string
          description: Error message
    AITool:
      type: object
      properties:
        name:
          type: string
          description: AI tool name
        key:
          type: string
          description: AI tool unique key
  securitySchemes:
    apiKeyAuth:
      type: apiKey
      in: header
      name: x-api-key
      description: API key for authentication. Generate from your WaLead dashboard.

````