Delete a Journey verified

Delete a Journey in the Journey Builder in Salesforce Marketing Cloud.

REST API

var journeyId = "S0M3-GU1D-K3Y-G03SR1G4T-H3R3",
    versionNumber = 1;

var endpoint = restInstanceUrl + "interaction/v1/interactions/";

    endpoint += journeyId + "?versionNumber=" + versionNumber;

var request = new Script.Util.HttpRequest(endpoint);
    request.emptyContentHandling = 0;
    request.retries = 2;
    request.continueOnError = true;
    request.setHeader("Authorization", "Bearer " + accessToken);
    request.method = "DELETE";
    request.contentType = "application/json";
    request.encoding = "UTF-8";

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",
            versionNumber = 1;

        var endpoint = restInstanceUrl + "interaction/v1/interactions/";

            endpoint += journeyId + "?versionNumber=" + versionNumber;

        var request = new Script.Util.HttpRequest(endpoint);
            request.emptyContentHandling = 0;
            request.retries = 2;
            request.continueOnError = true;
            request.setHeader("Authorization", "Bearer " + accessToken);
            request.method = "DELETE";
            request.contentType = "application/json";
            request.encoding = "UTF-8";

        var results = request.send();

        var result = Platform.Function.ParseJSON(String(results.content));

        Write(Stringify(result));
		
	} catch(error) {
        Write(Stringify(error));
    }	

</script>
"\"S0M3-GU1D-K3Y-G03SR1G4T-H3R3\"" 

Reference

Ressources and references related to the current methods.

Official documentation

Last Updated: