# Using Decision Points Merge and Duplicate Features From the REST API You can better personalize customer journeys using decision points. Enabling you to split or reconnect the journey path based on the decision point you choose. ## Creating a Decision Point You can personalize your customer’s journey experience by adding a decision point based on specific criteria. For instance, you can change or split the journey path based on whether or not they’ve responded to an email offer. You can add a maximum of two layers of decision points within a journey stage. Additionally, you can prioritize the decision points where a profile meets more than one path—the priority of the path depends on the order in which it is placed from top to bottom in the payload. 1. Use the PATCH method and the journey ID to add a decision point to an existing journey. In the following example, the journey ID is 2058. ```http PATCH https://api-cdp.treasuredata.com/entities/journeys/2058 ``` 1. In the payload, add the decision point and the paths it includes. The decision point describes the event or object and each decision point can have between two and six paths. You can also choose to capture the excluded profiles (that do not satisfy any decision path) by adding an excluded path to the decision point. You might consider developing a decision point for when a customer visits a specific product page, such as a car on a dealer's website followed by a path that might include filling out a form, which then splits based on the region of the visitor. If the profile satisfies a particular decision path, the profile then follows that path. In the following example, the decision points include both regions and gender. If, however, there is an "Excluded profiles" path in the decision point, the profiles that do not satisfy any of the decision paths will follow the "Excluded profiles" path. ```json { "type": "journey", "attributes": { "name": "Draft journey", "state": "draft", "audienceId": "57320", "description": "", "journeyStages": [ { "name": "StageA", "id": "4080", "entryCriteria": null, "exitCriterias": null, "milestone": null, "rootStep": "9ad15b6d-53e3-42fd-89bd-7c00adce4379", "steps": { "9ad15b6d-53e3-42fd-89bd-7c00adce4379": { "type": "DecisionPoint", "branches": [ { "uuid": "4f77161a-f7cb-41d0-bc43-31ee4c9ba394", "name": "North America", "description": "Customer lives in North America", "excludedPath": false, "segmentId": "1000", "next": "" }, { "uuid": "e8413329-551d-47a1-9e71-08927e8a2f30", "name": "Asia", "description": "Customer lives in Asia", "excludedPath": false, "segmentId": "1001", "next": "2969c02b-adb9-4f45-acfd-e1d006908522" }, { "uuid": "c47fe48e-fcbc-4f93-a75d-c6fd11ca8a20", "name": "Excluded profiles", "description": "comment", "excludedPath": true, "segmentId": null, "next": "" } ] }, "2969c02b-adb9-4f45-acfd-e1d006908522": { "type": "DecisionPoint", "branches": [ { "uuid": "7b6822a9-bb24-4e01-b8cc-76d31e32952d", "name": "Male", "description": "Customer is a male", "excludedPath": false, "segmentId": "1002", "next": "8e02f3e3-2f1f-4172-a793-57cc7d2db173" }, { "uuid": "55c38fad-b184-4152-82f3-4b9ca4cbb01f", "name": "Female", "description": "Customer is a female", "excludedPath": false, "segmentId": "1003", "next": "8e02f3e3-2f1f-4172-a793-57cc7d2db173" } ] }, "8e02f3e3-2f1f-4172-a793-57cc7d2db173": { "type": "Merge", "next": "" } } } ], "goal": null }, "relationships": { "parentFolder": { "data": { "id": "205977", "type": "folder-segment" } } }, "id": "2058" } ``` ## Editing a Decision Point You can edit the decision points you’ve created before launching your journey. For instance, you might need to do any of the following: * Rename a decision path * Edit a decision path * Delete a decision point path * Delete an entire decision point * Reorder the paths of a decision point*. The decision paths in a decision point can be re-ordered within the respective decision point. 1. Use the PATCH method and the journey ID to edit a decision point for an existing journey. ```http PATCH https://api-cdp.treasuredata.com/entities/journeys/2058 ``` 1. In the payload, modify the decision points for a specified journey. In the following example, the decision point has been edited to include customers from Europe. ```json { "type": "journey", "attributes": { "name": "Draft journey", "state": "draft", "audienceId": "57320", "description": "", "journeyStages": [ { "name": "StageA", "id": "4080", "entryCriteria": null, "exitCriterias": null, "milestone": null, "rootStep": "9ad15b6d-53e3-42fd-89bd-7c00adce4379", "steps": { "9ad15b6d-53e3-42fd-89bd-7c00adce4379": { "type": "DecisionPoint", "branches": [ { "uuid": "4f77161a-f7cb-41d0-bc43-31ee4c9ba394", "name": "North America", "description": "Customer lives in North America", "excludedPath": false, "segmentId": "1000", "next": "" }, { "uuid": "e8413329-551d-47a1-9e71-08927e8a2f30", "name": "Asia", "description": "Customer lives in Asia", "excludedPath": false, "segmentId": "1001", "next": "2969c02b-adb9-4f45-acfd-e1d006908522" }, { "uuid": "c47fe48e-fcbc-4f93-a75d-c6fd11ca8a20", "name": "Excluded profiles", "description": "comment", "excludedPath": true, "segmentId": null, "next": "" } ] }, "2969c02b-adb9-4f45-acfd-e1d006908522": { "type": "DecisionPoint", "branches": [ { "uuid": "7b6822a9-bb24-4e01-b8cc-76d31e32952d", "name": "Male", "description": "Customer is a male", "excludedPath": false, "segmentId": "1002", "next": "8e02f3e3-2f1f-4172-a793-57cc7d2db173" }, { "uuid": "55c38fad-b184-4152-82f3-4b9ca4cbb01f", "name": "Female", "description": "Customer is a female", "excludedPath": false, "segmentId": "1003", "next": "8e02f3e3-2f1f-4172-a793-57cc7d2db173" } ] }, "8e02f3e3-2f1f-4172-a793-57cc7d2db173": { "type": "Merge", "next": "" } } } ], "goal": null }, "relationships": { "parentFolder": { "data": { "id": "205977", "type": "folder-segment" } } }, "id": "2058" } ``` Decision points cannot be edited after a journey is launched. ## Merging a Decision Point You can merge decision points so that profiles follow the same journey path after a specified decision point. You can select paths to merge and designate specified points where a path should merge, you can delete a merge. 1. Use the PATCH method and the journey ID to add a merge point to an existing journey. In the following example, the customer paths are merged regardless of gender, which means that users continue along the same path until another split is designated or the journey is ended. ```http PATCH https://api-cdp.treasuredata.com/entities/journeys/2058 ``` 1. In the payload, add the merge point to the specified journey. ```json { "type": "journey", "attributes": { "name": "Draft journey", "state": "draft", "audienceId": "57320", "description": "", "journeyStages": [ { "name": "StageA", "id": "4080", "entryCriteria": null, "exitCriterias": null, "milestone": null, "rootStep": "9ad15b6d-53e3-42fd-89bd-7c00adce4379", "steps": { "9ad15b6d-53e3-42fd-89bd-7c00adce4379": { "type": "DecisionPoint", "branches": [ { "uuid": "4f77161a-f7cb-41d0-bc43-31ee4c9ba394", "name": "North America", "description": "Customer lives in North America", "excludedPath": false, "segmentId": "1000", "next": "" }, { "uuid": "e8413329-551d-47a1-9e71-08927e8a2f30", "name": "Asia", "description": "Customer lives in Asia", "excludedPath": false, "segmentId": "1001", "next": "2969c02b-adb9-4f45-acfd-e1d006908522" }, { "uuid": "c47fe48e-fcbc-4f93-a75d-c6fd11ca8a20", "name": "Excluded profiles", "description": "comment", "excludedPath": true, "segmentId": null, "next": "" } ] }, "2969c02b-adb9-4f45-acfd-e1d006908522": { "type": "DecisionPoint", "branches": [ { "uuid": "7b6822a9-bb24-4e01-b8cc-76d31e32952d", "name": "Male", "description": "Customer is a male", "excludedPath": false, "segmentId": "1002", "next": "8e02f3e3-2f1f-4172-a793-57cc7d2db173" }, { "uuid": "55c38fad-b184-4152-82f3-4b9ca4cbb01f", "name": "Female", "description": "Customer is a female", "excludedPath": false, "segmentId": "1003", "next": "8e02f3e3-2f1f-4172-a793-57cc7d2db173" } ] }, "8e02f3e3-2f1f-4172-a793-57cc7d2db173": { "type": "Merge", "next": "" } } } ], "goal": null }, "relationships": { "parentFolder": { "data": { "id": "205977", "type": "folder-segment" } } }, "id": "2058" } ``` ## Duplicating a Journey Although you cannot edit journeys after they’ve been launched, you can duplicate an existing journey for editing, while saving it as a draft within the same parent segment. This approach allows you to copy all configurations including the segments and activations of an existing, launched journey. You may also duplicate journeys that are in draft mode. 1. Use the POST method and the journey ID to duplicate an existing, launched journey. ```http POST https://api-cdp.treasuredata.com/entities/journeys/duplicate ``` 1. You can copy the journey as its dependent resources to a new journey as a draft. Your request body might look like the following example. In the following example, the journey being duplicated is 9957. ```json { "id": "9957", "type": "journey", "attributes": { "name": "Duplicated journey" }, "relationships": { "parentFolder": { "data": { "id": "7601", "type": "folder-segment" } } } } ``` ## Deleting a Decision Point You can delete the decision points you’ve created before launching your journey by removing the specified decision path. 1. Use the PATCH method and the journey ID to delete a decision point for an existing journey. ```http PATCH https://api-cdp.treasuredata.com/entities/journeys/2058 ``` 1. In the payload, modify the decision points for a specified journey. In the following example, the decision point 2969c02b-adb9-4f45-acfd-e1d006908522 that changes the path based on the gender of the profile and the corresponding merge are removed from the payload. If other conditions rely on the same merge, the merge can be retained in the payload. ```json { "type": "journey", "attributes": { "name": "Draft journey", "state": "draft", "audienceId": "57320", "description": "", "journeyStages": [ { "name": "StageA", "id": "4080", "entryCriteria": null, "exitCriterias": null, "milestone": null, "rootStep": "9ad15b6d-53e3-42fd-89bd-7c00adce4379", "steps": { "9ad15b6d-53e3-42fd-89bd-7c00adce4379": { "type": "DecisionPoint", "branches": [ { "uuid": "4f77161a-f7cb-41d0-bc43-31ee4c9ba394", "name": "North America", "description": "Customer lives in North America", "excludedPath": false, "segmentId": "1000", "next": "" }, { "uuid": "e8413329-551d-47a1-9e71-08927e8a2f30", "name": "Europe", "description": "Customer lives in Europe", "excludedPath": false, "segmentId": "1001", "next": "2969c02b-adb9-4f45-acfd-e1d006908522" }, { "uuid": "e8413329-551d-47a1-9e71-08927e8a2f30", "name": "Asia", "description": "Customer lives in Asia", "excludedPath": false, "segmentId": "1001", "next": "2969c02b-adb9-4f45-acfd-e1d006908522" }, { "uuid": "c47fe48e-fcbc-4f93-a75d-c6fd11ca8a20", "name": "Excluded profiles", "description": "comment", "excludedPath": true, "segmentId": null, "next": "" } ] } } } ], "goal": null }, "relationships": { "parentFolder": { "data": { "id": "205977", "type": "folder-segment" } } }, "id": "2058" } ```