verified
Pause a JourneyPause a Journey in the Journey Builder in Salesforce Marketing Cloud.
REST API
var journeyId = "S0M3-GU1D-K3Y-G03SR1G4T-H3R3";
var endpoint = restInstanceUrl + "interaction/v1/interactions/pause/";
endpoint += journeyId + "?versionNumber=1&allVersions=false";
var payload = {
"ExtendWaitEndDates": false,
"PausedDays": 15,
"ProcessWaitUntilEvents": true,
"GuardrailAction": "Resume",
"RetainContactInjectionWhileJourneyPaused": true,
"id": journeyId
}
var request = new Script.Util.HttpRequest(endpoint);
request.emptyContentHandling = 0;
request.retries = 2;
request.continueOnError = true;
request.setHeader("Authorization", "Bearer " + accessToken);
request.method = "POST";
request.contentType = "application/json";
request.encoding = "UTF-8";
request.postData = Stringify(payload);
var results = request.send();
var result = Platform.Function.ParseJSON(String(results.content));
Write(Stringify(result));
<script runat="server">
Platform.Load("core", "1");
var restInstanceUrl = "https://YOUR_SUBDOMAIN.rest.marketingcloudapis.com/",
accessToken = "YOUR_REST_API_TOKEN";
try {
var journeyId = "S0M3-GU1D-K3Y-G03SR1G4T-H3R3";
var endpoint = restInstanceUrl + "interaction/v1/interactions/pause/";
endpoint += journeyId + "?versionNumber=1&allVersions=false";
var payload = {
"ExtendWaitEndDates": false,
"PausedDays": 15,
"ProcessWaitUntilEvents": true,
"GuardrailAction": "Resume",
"RetainContactInjectionWhileJourneyPaused": true,
"id": journeyId
}
var request = new Script.Util.HttpRequest(endpoint);
request.emptyContentHandling = 0;
request.retries = 2;
request.continueOnError = true;
request.setHeader("Authorization", "Bearer " + accessToken);
request.method = "POST";
request.contentType = "application/json";
request.encoding = "UTF-8";
request.postData = Stringify(payload);
var results = request.send();
var result = Platform.Function.ParseJSON(String(results.content));
Write(Stringify(result));
} catch(error) {
Write(Stringify(error));
}
</script>
{
"status": "Accepted"
}
Payload parameters
Name | Type | Example | Description |
---|---|---|---|
ExtendWaitEndDates | Boolean | true | Indicates whether to extend waits for all Wait by Duration activities while the journey is paused. This parameter applies only to Wait By Duration wait types. If the value is true, the wait end date is extended by the pause period. If the value is false, the wait end date isn't extended. If you don't use this parameter, the default value is false. |
PausedDays | Number | 1 | Number of days to pause the journey. Default is 14 days. |
GuardrailAction | String | "Resume" | Indicates whether to resume or stop the journey after the pause duration (PausedDays). Allowed values are "Stop" and "Resume". If you don't use this parameter, the default value is false. |
RetainContactInjection WhileJourneyPaused | Boolean | false | Indicates how new contact injections are treated (for entry sources that support this option) while the journey is paused. Choose whether to ignore new contacts (false) or to queue and process them when the journey resumes (true). If you don't use this parameter, the default value is false. |
id | String | "S0M3-GU1D-K3Y-G03SR1G4T-H3R3" | ID of the journey to be paused. |
Version | String | 1 | Version of the journey to be paused. |
TIP
In order to pause a Journey using the Journey's Key instead of ID, please use
/key:{journeyKey} in the URL of the request.
WARNING
When versionNumber parameter is missing, allVersions parameter is required.
Reference
Ressources and references related to the current methods.
Official documentation