# create\_variation

Create a variation on an experiment, including its traffic share. Requires mcp:write. Adding a variation to a running experiment is rejected.

Create a variation on an experiment, including its traffic share. Requires mcp:write. Adding a variation to a running experiment is rejected.

## Permissions

```json
{
  "scope": "mcp:read and mcp:write",
  "role": "The existing entity create/update policy must allow this user; the mcp:write scope alone is insufficient.",
  "plan": "The billing account must have the MCP entitlement. Writes also require a writable billing mode and applicable entity limits.",
  "team": "The OAuth connection is approved for exactly one Team. Other team_id values cannot change the tenant."
}
```

## Input

```json
{
  "properties": {
    "experiment_id": {
      "description": "Experiment ID in the authenticated team",
      "type": "integer"
    },
    "name": {
      "description": "Variation name",
      "maxLength": 255,
      "type": "string"
    },
    "traffic_percentage": {
      "description": "Traffic share from 0 to 1. Omit or use 0 when the experiment is already fully allocated; update_variation rebalances the split.",
      "minimum": 0,
      "maximum": 1,
      "type": "number"
    },
    "traffic_locked": {
      "description": "Optional lock that keeps this variation out of automatic rebalancing",
      "type": "boolean"
    },
    "is_baseline": {
      "description": "Optional baseline flag. An experiment can have only one baseline.",
      "type": "boolean"
    },
    "project_id": {
      "description": "Optional project ID. It must match the experiment and is filled from the experiment when omitted.",
      "type": "integer"
    }
  },
  "type": "object",
  "required": [
    "experiment_id",
    "name"
  ]
}
```

## Output

```json
{
  "type": "object",
  "properties": {
    "created": {
      "type": "boolean",
      "const": true
    },
    "data": {
      "type": "object",
      "properties": {
        "id": {
          "type": "integer"
        },
        "project_id": {
          "type": [
            "integer",
            "null"
          ]
        },
        "experiment_id": {
          "type": "integer"
        },
        "name": {
          "type": "string"
        },
        "traffic_percentage": {
          "type": "number"
        },
        "traffic_locked": {
          "type": "boolean"
        },
        "is_baseline": {
          "type": "boolean"
        }
      },
      "required": [
        "id",
        "project_id",
        "experiment_id",
        "name",
        "traffic_percentage",
        "traffic_locked",
        "is_baseline"
      ]
    }
  },
  "required": [
    "created",
    "data"
  ]
}
```

## Examples

### Request arguments

```json
{
  "experiment_id": 101,
  "name": "Estimate above the button"
}
```

### Result

```json
{
  "created": true,
  "data": {
    "id": 101,
    "project_id": 1,
    "experiment_id": 101,
    "name": "Estimate above the button",
    "traffic_percentage": 0.5,
    "traffic_locked": false,
    "is_baseline": true
  }
}
```

## Errors

```json
[
  {
    "status": 401,
    "description": "Missing, expired, or revoked OAuth access token."
  },
  {
    "status": 403,
    "description": "Missing MCP scope, team membership, plan entitlement, or user permission."
  },
  {
    "status": 404,
    "description": "The MCP server is disabled."
  },
  {
    "status": 429,
    "description": "Rate limited; honor Retry-After before retrying."
  },
  {
    "description": "Tool execution or validation failures are MCP error results. Inspect isError; a successful HTTP status alone does not indicate a successful tool call."
  }
]
```

An expired or revoked OAuth connection cannot connect. A missing scope, role, feature entitlement, or team access prevents the operation. See [MCP setup](https://conversionlab.app/docs/developer/mcp-setup).
