Campaigns V2

Creates a new campaign. placements and audiences are both optional — omit them (or send empty arrays) to create a campaign with just a name, as in the legacy dashboard, and configure it later; when no audiences are supplied the server creates a single default control audience (a 0% holdout). Audience targeting is set with a structured rule_conditions rule, which is compiled into the audience's expression and drives expression_cel for modern SDKs; omit it to match all users. The legacy raw expression field is no longer accepted. Requires campaigns:write scope.

post/v2/campaigns

Request

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

Request body

application_idstring required
descriptionstring required

Description of the campaign

notesstring nullable

Internal notes about the campaign

delivery_mode'EMBEDDED' | 'HOSTED'

Deprecated: delivery mode is a placement property. When set, it is the default delivery_mode for placements in this request that omit their own. Not stored on the campaign. Web applications only.

Example request

{
  "audiences": [
    {
      "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'campaign' required

Object type, always campaign

application_idstring required
descriptionstring required

Description of the campaign

notesstring nullable required

Internal notes about the campaign

is_legacyboolean required

Whether this is a legacy campaign

is_prioritizedboolean required

Whether this campaign is prioritized for config preloading. At most one campaign per application may be prioritized.

delivery_mode'EMBEDDED' | 'HOSTED' nullable required

Deprecated, always null. Delivery mode lives on each placement.

created_atstring required

ISO 8601 timestamp of when the campaign was created

updated_atstring required

ISO 8601 timestamp of when the campaign was last updated

archivedboolean required

Whether the campaign is archived

can_reset_assignmentsboolean

Whether the caller may reset audience assignments. Included on a retrieved campaign.

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 subschema #5 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 subschema #5 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