Skip to main content
Version: 6.1.0

SysCreateCampaign

Creates a new campaign. The campaign code must be unique for the app. The control scenario ("_") is created automatically alongside the campaign with a weight of 100, so all traffic sees the baseline experience until you add variant scenarios and redistribute the weights.

New campaigns are created disabled by default. Pass "enabled": true in configJson to activate the campaign immediately.

ServiceOperation
campaignSYS_CREATE_CAMPAIGN

Method Parameters​

ParameterDescription
campaignCodeUnique code for the new campaign. Must be 1–15 characters, using only uppercase letters, digits, underscores (_) and hyphens (-).
configJsonThe campaign configuration. See the table below for the supported fields. scenarios cannot be specified — the control scenario is created automatically.

configJson Fields​

FieldRequiredDescription
nameYesDisplay name of the campaign.
startAtYesStart of the campaign window, in UTC epoch milliseconds. Must be before endAt.
endAtYesEnd of the campaign window, in UTC epoch milliseconds. Cannot be in the past. The campaign duration cannot exceed the app's maximum campaign length (90 days by default).
triggerYesWhen players are evaluated for enrollment: LOGIN (every login during the campaign window) or REGISTRATION (first registration only).
targetYesWhich players are eligible. { "type": "ALL" } targets all players. { "type": "SEGMENT", "segmentCode": "..." } targets a specific player segment, which must already exist.
purposeNoA description of what the campaign is evaluating.
categoryNoFree-form category used to organize campaigns.
enabledNoWhether the campaign is active. Defaults to false.
campaignJsonNoFree-form custom payload returned to every player enrolled in the campaign. Maximum serialized size is governed by an application property (50 KB by default).
abGoalTypeNoThe overall goal of the A/B test. One of revenue, engagement, retention or conversion.
abConfidenceNoConfidence level used for A/B significance testing. One of 80, 85, 90, 95 or 99. Defaults to 95 when not set.
notesNoDeveloper assessment notes (markdown). Maximum 16,384 characters.

Usage​

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

Status Codes​

CodeNameDescription
40358MISSING_REQUIRED_PARAMETERcampaignCode or configJson was not specified.
40660INVALID_PARAMETER_VALUEThe campaign configuration is invalid — for example, a campaign with this campaignCode already exists, the code is badly formatted, a required field is missing, startAt/endAt are invalid, the target segment does not exist, or scenarios was specified. The error message describes the specific problem.
41064CAMPAIGN_JSON_TOO_LARGEThe serialized campaignJson exceeds the maximum size allowed for the app.
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.