---
title: "Set the traffic split across variants"
method: PATCH
path: "/api/v1/campaigns/{id}/traffic_split"
tags: ["Campaigns"]
---

# Set the traffic split across variants

`PATCH /api/v1/campaigns/{id}/traffic_split`

## Request

- Base URL: `https://app.convertflow.co`
- URL: `https://app.convertflow.co/api/v1/campaigns/{id}/traffic_split`
- Auth: HTTP bearer

Sets each variant's traffic percentage; omitted variants keep their current value and the total must be exactly 100. A variant at 0% is excluded from the live script. A republish is queued. Requires campaigns:write.

## Request body

- object
  - `percentages` object, required: variant id → percentage

## Response `200`

traffic split updated

- object
  - `id` integer
  - `name` string
  - `cta_type` string: Campaign format
  - `format_type` string, nullable: Campaign sub-format. Null for page and bar campaigns, which have none.
  - `archived` boolean
  - `live` boolean: Whether visitors can reach the campaign: the live toggle for popups, hooks, bars and embeds; not archived for landing pages.
  - `building` boolean
  - `build_failed` boolean
  - `test_type` string
  - `page_path` string
  - `domain_id` unknown
  - `meta_title` unknown
  - `meta_description` unknown
  - `open_graph_title` unknown
  - `open_graph_description` unknown
  - `open_graph_image` unknown
  - `seo_index` unknown
  - `experiment_start_date` unknown
  - `experiment_end_date` unknown
  - `experiment_metric` unknown
  - `remix` object
  - `published_at` unknown
  - `variants` object[]
    - `id` integer
    - `name` string, nullable
    - `variation` string
    - `percentage` integer, nullable
  - `created_at` string, date-time
  - `updated_at` string, date-time

## Other responses

- `422`: keys are not variant ids

---

[API](https://skmtc.dev/convertflow/apis/convertflow-api.md) - [All operations](https://skmtc.dev/convertflow/apis/convertflow-api/llms.txt) - [OpenAPI document](https://skmtc.dev/convertflow/apis/convertflow-api/revisions/9a45e0736b68?raw)
