Campaigns V2

Create Audience

Creates a new audience in a campaign, appended after the existing audiences. If no variants are supplied, a single HOLDOUT variant at 0% is created (matching the legacy createTriggerExperiment behaviour). Provide a structured rule_conditions rule to set targeting; omit it to match all users. Requires campaigns:write scope.

post/v2/campaigns/{id}/audiences

Path parameters

idstring required

Campaign ID

Campaign ID

Request body

enabledboolean

Whether this audience is enabled. Defaults to true

descriptionstring nullable

Human-readable description of the audience

Example request

{
  "rule_conditions": {
    "operator": "and",
    "conditions": [
      {
        "type": "condition",
        "lhs": {
          "type": "property",
          "value": "device.appVersion"
        },
        "operator": "gte",
        "rhs": {
          "type": "string",
          "value": "1.2.3"
        }
      }
    ]
  }
}

Response

Success

idstring required

Unique identifier for the audience

object'audience' required

Object type, always audience

enabledboolean required

Whether this audience is enabled

expressionstring nullable required

Compiled filter expression for matching users, or null for all users

{"stackTrail":"paths:/v2/campaigns/{id}/audiences:post:responses:200:content:application/json:schema:properties:rule_conditions","oasType":"schema","type":"unknown","title":"unknown","description":"Structured targeting rule (RuleConditions AST) when this audience uses the rule editor, or null for legacy raw-expression audiences. Returned as stored; send it back via the typed `rule_conditions` field on update."}
expression_celstring nullable required

The CEL expression evaluated by modern SDKs, derived from rule_conditions. Null when the audience has no structured rule.

expression_sqlstring nullable required

The dashboard-side SQL compilation of rule_conditions (for preview/copy). Null when the audience has no structured rule.

rankstring required

Priority rank of this audience within the campaign

descriptionstring nullable required

Human-readable description of the audience

Changes

No recorded changes to this endpoint across all 1 revision of this API.