---
title: "Update Audience Weights"
method: PUT
path: "/v2/campaigns/{id}/audiences/{audience_id}/weights"
tags: ["Campaigns V2"]
---

# Update Audience Weights

`PUT /v2/campaigns/{id}/audiences/{audience_id}/weights`

Bulk-updates treatment-variant traffic percentages in place (preserving variant identity). Every treatment must be present, with no duplicate IDs; the HOLDOUT variant (if any) is auto-balanced to (100 - sum). Requires campaigns:write scope.

## Path parameters

- `id` string, required — Campaign ID
- `audience_id` string, required — Audience ID

## Request body

- object
  - `weights` object[], required — Treatment-variant weights. The HOLDOUT variant (if any) is auto-balanced to (100 - sum).
    - `variant_id` string, required — a string to be decoded into a number
    - `percentage` number, required

## Response `200`

Success

- object
  - `id` string, required — Unique identifier for the audience
  - `object` 'audience', required — Object type, always `audience`
  - `enabled` boolean, required — Whether this audience is enabled
  - `expression` string, nullable, required — Compiled filter expression for matching users, or null for all users
  - `rule_conditions` unknown, required
  - `expression_cel` string, nullable, required — The CEL expression evaluated by modern SDKs, derived from `rule_conditions`. Null when the audience has no structured rule.
  - `expression_sql` string, nullable, required — The dashboard-side SQL compilation of `rule_conditions` (for preview/copy). Null when the audience has no structured rule.
  - `rank` string, required — Priority rank of this audience within the campaign
  - `description` string, nullable, required — Human-readable description of the audience
  - `variant_optimization` union, required — Optimization strategy for variant allocation
    - 'none' — No optimization, use fixed percentages
    - 'ucb1_bandit' — UCB1 multi-armed bandit optimization
  - `variants` object[], required — List of variants in this audience
    - `id` string, required — Unique identifier for the variant
    - `object` 'variant', required — Object type, always `variant`
    - `type` union, required — Whether this is a treatment or holdout variant
      - 'treatment' — Treatment variant that shows a paywall
      - 'holdout' — Holdout variant that does not show a paywall
    - `paywall` string, nullable, required — a string to be decoded into a number
    - `percentage` number, required — Traffic percentage allocated to this variant (0-100)
    - `created_at` string, required — ISO 8601 timestamp of when the variant was created
  - `frequency_limit` object, nullable, required — How often each user can be matched into this audience
    - `occurrences` integer, required — an integer
    - `interval` union, required — Time window for a frequency limit
      - object
        - `type` 'infinity', required
      - object
        - `type` 'minutes', required
        - `minutes` integer, required — an integer

## Other responses

- `400` — The request did not match the expected schema
- `401` — No API key was provided in the request
- `403` — The API key does not have permission to perform this action
- `404` — The requested resource was not found
- `429` — Too many requests have been made in a short period
- `500` — A required post-operation side effect failed

---

[API](https://skmtc.dev/superwall/apis/superwall-api-v2.md) · [All operations](https://skmtc.dev/superwall/apis/superwall-api-v2/llms.txt) · [OpenAPI document](https://skmtc-service-production.skmtc.workers.dev/v1/apis/superwall/superwall-api-v2/revisions/13937437c787/schema)
