Campaigns V2

Updates an audience's enabled status, description, targeting rule, variant optimization, or variants. Provide a structured rule_conditions rule to update targeting: it is compiled into the audience's expression and drives expression_cel for modern SDKs, and the audience is switched to the rule editor so it stays in sync with the dashboard. The legacy raw expression field is no longer accepted. When variants are provided they replace the existing set. Requires campaigns:write scope.

patch/v2/campaigns/{id}/audiences/{audience_id}

Request

  • Base URL
    https://api.superwall.com
  • URL
    https://api.superwall.com/v2/campaigns/{id}/audiences/{audience_id}
  • Auth
    • HTTP bearer
    • or API key in cookie accounts_superwall_token
    • or HTTP bearer

Path parameters

idstring required
audience_idstring required

Request body

enabledboolean

Whether this audience is enabled

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
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

rule_conditionsunknown required
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

    • warning

      added the new credentials_missing enum value to the / response property for the response status

    • warning

      added the new credentials_missing enum value to the / response property for the response status

    • warning

      added the new credentials_missing enum value to the / response property for the response status

    • warning

      added the new credentials_missing enum value to the / response property for the response status

    • info

      added subschema #1 subschema #2 to the response body anyOf list for the response status

    • info

      added subschema #1 subschema #2 subschema #3 subschema #4 subschema #5 to the response body anyOf list for the response status

    • info

      added subschema #2 subschema #3 subschema #4 to the response body anyOf list for the response status

    • info

      removed subschema #1 subschema #2 from the response body anyOf list for the response status

    • info

      removed subschema #1 subschema #2 subschema #3 subschema #4 subschema #5 from the response body anyOf list for the response status

    • info

      removed subschema #2 subschema #3 subschema #4 from the response body anyOf list for the response status

    • breaking

      request property /// list-of-types was narrowed by removing types number from media type application/json

    • breaking

      the //// request property type changed from number to integer