Skip to main content
Version: 6.1.0

SysUpdateCampaign

Updates an existing campaign. Only the fields present in configJson are changed — omitted fields keep their current values. The campaign must not have ended.

Scenario weights cannot be changed through this call; use SysUpdateCampaignScenarioWeights instead. If none of the supplied fields differ from the current values, the campaign is returned unchanged and its version is not incremented.

ServiceOperation
campaignSYS_UPDATE_CAMPAIGN

Method Parameters​

ParameterDescription
campaignCodeThe campaign code to update.
versionVersion of the campaign being updated. Pass -1 to update regardless of the current version.
configJsonFull or partial campaign configuration. Updatable fields are name, purpose, category, enabled, startAt, endAt, trigger, target, campaignJson, abGoalType, abConfidence and notes — see SysCreateCampaign for their meaning and allowed values. enabled, startAt and endAt cannot be set to null.

Usage​

http://localhost:3000
// Cloud Code only. To view example, switch to the Cloud Code tab
JSON Response
{
"data": {
"campaignCode": "SUMMER2026",
"name": "Summer Sale 2026",
"purpose": "Evaluating impact of themes and summer sale",
"category": null,
"enabled": false,
"startAt": 1811808000000,
"endAt": 1814227200000,
"trigger": "LOGIN",
"target": {
"type": "ALL"
},
"scenarios": [
{
"scenarioCode": "_",
"weight": 100
}
],
"campaignJson": {
"customFieldA": "summer",
"customFieldB": 1,
"customFieldC": true
},
"abGoalType": "revenue",
"abConfidence": null,
"notes": null,
"version": 2,
"createdAt": 1811721600000,
"updatedAt": 1811725200000
},
"status": 200
}

The returned version is the campaign's new version after the update. Feed it into your next call's version parameter if you want to detect a concurrent change rather than overwrite it.

Common Error Codes

Status Codes​

CodeNameDescription
40345MISSING_RECORDNo campaign exists for the specified campaignCode.
40001INVALID_REQUESTThe campaign has ended and can no longer be modified.
41062CAMPAIGN_VERSION_MISMATCHThe specified version no longer matches the campaign — it was updated by someone else. Re-read and retry.
40660INVALID_PARAMETER_VALUEThe updated configuration is invalid — for example, startAt is not before endAt, the target segment does not exist, or a non-nullable field was set to null. The error message describes the specific problem.
41064CAMPAIGN_JSON_TOO_LARGEThe serialized campaignJson exceeds the maximum size allowed for the app.
41054CAMPAIGN_UPDATE_ERRORThe campaign could not be updated.
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.