Skip to main content
Version: 6.1.0

SysUpdateCampaignScenarioWeights

Sets the traffic split between a campaign's scenarios. The list you pass replaces the current weight distribution. The campaign must not have ended.

The list must include the control scenario (_), every scenario in it must already exist, and the weights must be integers that add up to exactly 100. A scenario you leave out gets no traffic.

ServiceOperation
campaignSYS_UPDATE_CAMPAIGN_SCENARIO_WEIGHTS

Method Parameters​

ParameterDescription
campaignCodeThe campaign code whose scenario weights are being updated.
versionVersion of the campaign being updated. Pass -1 to update regardless of the current version.
scenariosArray of objects, each with a scenarioCode (string) and a weight (integer, 0–100).

Usage​

http://localhost:3000
// Cloud Code only. To view example, switch to the Cloud Code tab
JSON Response
{
"data": {
"campaignCode": "SUMMER2026",
"scenarios": [
{
"scenarioCode": "_",
"weight": 30
},
{
"scenarioCode": "A",
"weight": 35
},
{
"scenarioCode": "B",
"weight": 35
}
],
"version": 3,
"updatedAt": 1811732400000
},
"status": 200
}

The returned version is the campaign's new version after the update.

Common Error Codes

Status Codes​

CodeNameDescription
40345MISSING_RECORDNo campaign exists for the specified campaignCode.
40345MISSING_RECORDNo scenario exists for the specified campaignCode and scenarioCode.
40001INVALID_REQUESTThe campaign has ended, the control scenario (_) is missing from scenarios, or the weights do not add up to 100.
40332UPDATE_FAILEDThe weights could not be saved. This includes the case where version no longer matches the campaign — re-read and retry.
40616CLOUD_CODE_ONLY_METHODThe method was called from a client. It can only be called from Cloud Code or S2S.
40731FEATURE_NOT_SUPPORTED_BY_BILLING_PLANBilling plan does not include the Campaign feature. Requires a plan that includes Enterprise features.