Treasure Data Journey Orchestration using the REST API

You can manage interactions with customers using Treasure Data Journey Orchestration. Journey Orchestration allows you to drive your key performance indicators and increase the usage of your product. By manipulating customer journeys via the REST API, you can modify journey entities and backend workflows, which can be used to update the state of profiles in the journey workflow.

Learn how to create, update, or delete a journey, manage its stages, and view and extract profiles in various stages.

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.

This article contains:

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.
    Copy
    Copied
    PATCH https://api-cdp.treasuredata.com/entities/journeys/2058
  2. 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.
    Sample Payload
    Copy
    Copied
    {
      "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.
    info

    The decision paths in a decision point can be re-ordered within the respective decision point.

  • Use the PATCH method and the journey ID to edit a decision point for an existing journey.
    Copy
    Copied
    PATCH https://api-cdp.treasuredata.com/entities/journeys/2058
  • 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.
    Sample Payload
    Copy
    Copied
    {
      "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": "e8413329-551d-47a1-9e71-08927e8a2f30",
                    "name": "Europe",
                    "description": "Customer lives in Europe",
                    "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"
    }
info

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.
    Copy
    Copied
    PATCH https://api-cdp.treasuredata.com/entities/journeys/2058
  2. In the payload, add the merge point to the specified journey.
    Sample Payload
    Copy
    Copied
    {
      "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.
    Copy
    Copied
    POST https://api-cdp.treasuredata.com/entities/journeys/duplicate
  2. 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.
    Copy
    Copied
    {
      "id": "9957",  // Source journey ID
      "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.
    Copy
    Copied
    PATCH https://api-cdp.treasuredata.com/entities/journeys/2058
  2. 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.
    Sample Payload
    Copy
    Copied
    {
      "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"
    }  

Pausing and Resuming a Journey using the REST API

You might encounter a situation where you need to pause a live campaign to either pause and begin again due to circumstances outside your control, or to take corrective measures if the journey isn't producing results you expect.

info
  • Pausing impacts the journey state update, activation, and WaitStep count. For instance, a 3-day WaitStep count is ignored if a journey is paused and WaitStep timing continues when the journey is resumed.
  • You can change the name, description, and activations for the paused journey, but you cannot edit the activations schedule while a journey is in a paused state. Any attempts to do so will result in an error.

Pause a Journey

When you need to pause a journey, you can stop the schedule of journey or activation workflows by setting the paused value to true. Only live journeys can be paused. Schedule configurations for an activation cannot be modified during the pause period. Users without edit permissions will get a 403 error.

  1. Use the PATCH method and the journey ID to pause an existing journey. In the following example, the journey ID is 63050.

Sample Request

Copy
Copied
{{baseUrl}}entities/journeys/63050/pause
Sample Response
Copy
Copied
{
    "data": {
        "id": "63050",
        "type": "journey",
        "attributes": {
            "audienceId": "127517",
            "name": "activation test",
            "description": "",
            "state": "launched",
            "goal": null,
            "createdAt": "2023-01-11T19:37:43.136Z",
            "updatedAt": "2023-01-11T21:13:30.109Z",
            "launchedAt": "2023-01-11T19:56:58.768Z",
            "paused": true,
            "pausedAt": "2023-01-11T21:13:30.059Z",
            "journeyStages": [
                {
                    "id": "78147",
                    "name": "S1",
                    "description": null,
                    "steps": {
                        "30f11333-1e8c-4f1f-b443-81911dae831d": {
                            "type": "Activation",
                            "name": "Act1_S1_63050",
                            "journeyActivationStepId": "90262",
                            "next": "5ddb010d-51f0-4b97-a025-204e0e4dd214"
                        },
                        "5ddb010d-51f0-4b97-a025-204e0e4dd214": {
                            "type": "Activation",
                            "name": "Act2_S1_63050",
                            "journeyActivationStepId": "90263",
                            "next": ""
                        }
                    },
                    "rootStep": "30f11333-1e8c-4f1f-b443-81911dae831d",
                    "entryCriteria": {
                        "name": "entry_1",
                        "segmentId": "552283",
                        "description": ""
                    },
                    "milestone": {
                        "name": "entry_2",
                        "segmentId": "552285",
                        "description": "Profile has more than one item in its wishlist."
                    },
                    "exitCriterias": null
                },
                {
                    "id": "78149",
                    "name": "S2",
                    "description": null,
                    "steps": {
                        "2cc6bd60-b66e-4a3a-b7ec-f3c41a36f384": {
                            "type": "DecisionPoint",
                            "branches": [
                                {
                                    "id": "9c92bf31-3eb2-47f3-ab2c-5dddf4ed29e5",
                                    "name": "US/Canada/UK",
                                    "description": "",
                                    "segmentId": "552286",
                                    "excludedPath": false,
                                    "next": "e3438506-794b-4464-b9bf-6305ea7a2b45"
                                },
                                {
                                    "id": "8f611b2a-e8ad-41f3-9142-bba3041d09b0",
                                    "name": "France/Japan/India",
                                    "description": "",
                                    "segmentId": "552287",
                                    "excludedPath": false,
                                    "next": "172193bd-8093-42d0-8055-d019ba61d018"
                                },
                                {
                                    "id": "af6ae62e-4b76-4eb1-afe8-d65a3283b146",
                                    "name": null,
                                    "description": null,
                                    "segmentId": "552288",
                                    "excludedPath": true,
                                    "next": "a6b04e15-60a5-4369-ab3d-dfacadee91b9"
                                }
                            ]
                        },
                        "e3438506-794b-4464-b9bf-6305ea7a2b45": {
                            "type": "Activation",
                            "name": "Act1_S2_63050",
                            "journeyActivationStepId": "90264",
                            "next": "f08c2e01-e937-4f04-8759-1f19d960a87c"
                        },
                        "f08c2e01-e937-4f04-8759-1f19d960a87c": {
                            "type": "Activation",
                            "name": "Act2_S2_63050",
                            "journeyActivationStepId": "90265",
                            "next": ""
                        },
                        "172193bd-8093-42d0-8055-d019ba61d018": {
                            "type": "Merge",
                            "next": "8e4e7681-d75f-40e2-a334-bfacdff54eb8"
                        },
                        "8e4e7681-d75f-40e2-a334-bfacdff54eb8": {
                            "type": "Activation",
                            "name": "Act5_S2_63050",
                            "journeyActivationStepId": "90268",
                            "next": "d2c74c0b-4f6b-488f-8532-391e75d26ebc"
                        },
                        "d2c74c0b-4f6b-488f-8532-391e75d26ebc": {
                            "type": "Activation",
                            "name": "Act5_S2_63050",
                            "journeyActivationStepId": "90269",
                            "next": ""
                        },
                        "a6b04e15-60a5-4369-ab3d-dfacadee91b9": {
                            "type": "Activation",
                            "name": "Act3_S2_63050",
                            "journeyActivationStepId": "90266",
                            "next": "de72fc02-0499-4cde-9476-3c0354a7fbff"
                        },
                        "de72fc02-0499-4cde-9476-3c0354a7fbff": {
                            "type": "Activation",
                            "name": "Act4_S2_63050",
                            "journeyActivationStepId": "90267",
                            "next": "172193bd-8093-42d0-8055-d019ba61d018"
                        }
                    },
                    "rootStep": "2cc6bd60-b66e-4a3a-b7ec-f3c41a36f384",
                    "entryCriteria": {
                        "name": "entry_2",
                        "segmentId": "552285",
                        "description": "Profile has more than one item in its wishlist."
                    },
                    "milestone": null,
                    "exitCriterias": null
                }
            ]
        },
        "relationships": {
            "parentFolder": {
                "data": {
                    "id": "360172",
                    "type": "folder-segment"
                }
            },
            "createdBy": {
                "data": {
                    "id": "1350",
                    "type": "user"
                }
            },
            "updatedBy": {
                "data": {
                    "id": "1350",
                    "type": "user"
                }
            }
        }
    }
 }

Resume a Journey

When you need to resume a journey, you can restart the schedule of journey or activation workflows by setting the paused value to false. The pause period is recorded as an RDS event. Users without edit permissions will get a 403 error.

  1. Use the PATCH method and the journey ID to resume an existing journey. In the following example, the journey ID is 63050.

Sample Request

Copy
Copied
{{baseUrl}}entities/journeys/63050/resume

Sample Response

Copy
Copied
{
    "data": {
        "id": "63050",
        "type": "journey",
        "attributes": {
            "audienceId": "127517",
            "name": "activation test",
            "description": "",
            "state": "launched",
            "goal": null,
            "createdAt": "2023-01-11T19:37:43.136Z",
            "updatedAt": "2023-01-11T21:13:30.109Z",
            "launchedAt": "2023-01-11T19:56:58.768Z",
            "paused": false,
            "pausedAt": "2023-01-11T21:13:30.059Z",
             ...,
             "relationships": {
             }
           }
      }
}

Creating, Updating, and Deleting Journeys using the REST API

You can create, modify, and delete customer journeys using the API. Your folder permissions might affect your ability to retrieve a list of customer profiles or create, modify, and delete journeys.

  • Full Control Folder Permission : A user can create, modify or delete any Journeys in selected folders or child folders. Additionally, a user can get a list of profiles as well as customers' endpoints.
  • View Folder Permission: : A user can view Journeys in selected folders or child folders.

Create a Journey

During the journey creation, you need to name and create dependent resources, including segments and activations. The following attributes can be updated through the endpoint only while in draft mode.

info

Objects listed in italics are required to create a journey. An asterisk beside an attribute indicates that, if the attribute is not specified, the value should be passed as null.

  • Journey
    • name
    • description
    • state (draft or launched)
    • goal *

  • JourneyStages
    • name
    • description
    • entryCriteria
    • milestone
    • exitCriterias *
    • steps *
    • rootStep *

You cannot change these attributes of the journey after the journey is launched.

In the following example, the user has identified the name, state, goal, and several stages of the journey, including entry criteria, milestone, exit criteria, wait step, activation, and end. A journey_id is designated upon the creation of a journey.

Sample Request
Copy
Copied
curl -i -X POST \
  https://api-cdp.treasuredata.com/entities/journeys \
  -H 'AUTHORIZATION: TD1 1/1234567891234567891234000891234567891234'
 
{
  "type": "journeys",
  "relationships": {
    "parentFolder": {
      "data": {
        "id": 3456,
        "type": "folder-segment"
      }
    },
    "createdBy": {
      "data": {
        "id": 65,
        "type": "user"
      }
    }
    "updatedBy": {
      "data": {
        "id": 12,
        "type": "user"
      }     
    }
  }
  "attributes": {
    "name": "My First Journey",
    "description": "Customer participating in a journey",
    "lastUpdatedAt": ... The time when last successful execution of the workflow completes ...,
    "state": "launched",
    "audienceId": ... Audience ID this journey belongs to ...,
    "journey_stages": [
      {
        "name": "Awareness",
        "entry_criteria": {
          "name": "Visit website",
          "description": "Customer visits website for the first time",
          "segment_id": "78954"
        },
        "milestone": {
          "name": "Register",
          "description": "Customer signs up",
          "segment_id": "98543"
        },
        "exit_criterias": [
          {
            "name": "Do not open email",
            "segment_id": "94322"
          },
          {
            "name": "Stale over 30 days",
            "exitAfter": 30,
            "unit": "days"
          }
        ],
        "steps": {
          "a49a0aa3-6991-4dd8-a4af-c5d36fe9dd93": {
            "type": "WaitStep",
            "waitStep": 3,
            "waitStepUnit": "day",
            "next": "2b38f1e5-97d5-45ae-b165-b1c3288721cb",
          },
          "2b38f1e5-97d5-45ae-b165-b1c3288721cb": {
            "type": "Activation",
            "journeyActivationStepId": ...,
            "next": "b722a160-73d3-4565-a6da-702f7019d3db"
          },
          "b722a160-73d3-4565-a6da-702f7019d3db": {
            "type": "End"
          }
        },
        "root_step": "a49a0aa3-6991-4dd8-a4af-c5d36fe9dd93"
      }       
    ],
    "goal": {
      "name": "customers that met goal",
      "description": "customers met all milestones to acheive goal",
      "segment_id": "54321",
    }
  }
}

Define WaitStep for a Stage

You can define wait steps for a stage by updating the steps section of the API request payload and by defining the WaitStep type. For example, in the "type" position of the payload sample below, the duration and unit for the waitStep is three days---indicated by "waitStep": 3 and "waitStepUnit": "day".

Copy
Copied
"steps": {
          "a49a0aa3-6991-4dd8-a4af-c5d36fe9dd93": {
            "type": "WaitStep",
            "waitStep": 3,
            "waitStepUnit": "day",
            "next": "2b38f1e5-97d5-45ae-b165-b1c3288721cb",

View a Journey

You can view a journey and all its stages and activations. In the example below, the journey ID is 12345.

Copy
Copied
curl -i -X GET \
  https://api-cdp.treasuredata.com/entities/journeys/12345 \
  -H 'AUTHORIZATION: TD1 1/1234567891234567891234560001234567891234'

Update a Journey

You can update a specified journey while it is in draft mode. In the example below, the journey ID is 12345. After the journey state is changed to "launched", attributes cannot be changed. Unlike the UI, where you can add exit criteria, goal, and wait steps individually while journey is in draft state, there are no separate calls for these in the API. To update the values of resources, such as entry criteria, exit criteria, wait steps, milestones, activations, or goals, you can use the PATCH method.

Sample Request
Copy
Copied
curl -i -X PATCH \
  https://api-cdp.treasuredata.com/entities/journeys/12345 \
  -H 'AUTHORIZATION: TD1 1/1234567891234567891234560001234567891234'
 
{
  "type": "journeys",
  "relationships": {
    "parentFolder": {
      "data": {
        "id": ...,
        "type": "folder-segment"
      }
    },
    "createdBy": {
      "data": {
        "id": ...,
        "type": "user"
      }
    }
    "updatedBy": {
      "data": {
        "id": ...,
        "type": "user"
      }     
    }
  }
  "attributes": {
    "name": "My Updated Journey",
    "description": ...,
    "state": "launched",
    "audienceId": ... Audience ID this journey belongs to ...,
    "journey_stages": [
      {
        "name": "Awareness",
        "entry_criteria": {
          "name": "Visit website",
          "description": ...,
          "segment_id": ...
        },
        "milestone": {
          "name": "Register",
          "description": ...,
          "segment_id": ...
        },
        "exit_criterias": [
          {
            "name": "Do not open email",
            "segment_id": ...
          }
        ],
        "steps": {
          "a49a0aa3-6991-4dd8-a4af-c5d36fe9dd93": {
            "type": "WaitStep",
            "wait_step": 3,
            "wait_step_unit": "day",
            "next": "2b38f1e5-97d5-45ae-b165-b1c3288721cb",
          },
          "2b38f1e5-97d5-45ae-b165-b1c3288721cb": {
            "type": "Activation",
            "activation_id": ...,
            "next": "b722a160-73d3-4565-a6da-702f7019d3db"
          },
          "b722a160-73d3-4565-a6da-702f7019d3db": {
            "type": "End"
          }
        },
        "root_step": "a49a0aa3-6991-4dd8-a4af-c5d36fe9dd93"
      }       
    ],
    "goal": {
      "name": ...,
      "description": ...,
      "segment_id": ...,
    }
  }
}

Delete a Journey

You can delete a journey using the specified journey ID. In the example below, the journey ID is 12345.

Copy
Copied
curl -i -X DELETE \
  https://api-cdp.treasuredata.com/entities/journeys/12345 \
  -H 'AUTHORIZATION: TD1 1/1234567891234567891234560001234567891234'

Managing Activations Inside a Journey Using the REST API

Similar to the UI, you can set up activations in the REST API. In addition to creating, viewing, and updating activations inside a journey, you can use the API to verify objects and view customer journeys and profiles.

Create an Activation Inside a Journey

You can create an activation in the specified journey. In the example below, the journey ID is 12345.

Sample Request
Copy
Copied
curl -i -X POST \
  https://api-cdp.treasuredata.com/entities/journeys/12345/syndications \
  -H 'AUTHORIZATION: TD1 1/1234567891234567891234560001234567891234'
 
{
  "type": "journeyActivationStep",
  "attributes": {
    "syndication_params": {
      "scheduleType": "hourly",
      "scheduleOption": "00:00,
      "timezone": "UTC",
      "connectorConfig": {
        "useKey": false,
        "spreadsheetTitle": "xxxx",
        "sheetTitle": "From Activation",
        "mode": "replace",
        "range": "A1",
        "rowsThreshold": 5000,
        "valueInputOption": "RAW",
        "setNilForDoubleNan": true
      },
      "connectionId": "135593",
      "name": "My Activation",
      "description": "",
      "columns": [],
      "allColumns": true,
      "emailRecipients": [],
      "notifyOn": []
    }
  },
  "relationships": {
    "journey": {
      "data": {
        "id": ...,
        "type": "journey"
      }
    },
    "createdBy": {
      "data": {
        "id": ...,
        "type": "user"
      }
    }
    "updatedBy": {
      "data": {
        "id": ...,
        "type": "user"
      }     
    }   
  } 
}

Update a Specified Activation Inside a Journey

You can update a specific activation in the specified journey. Unlike other objects inside a journey, activations may be updated even after the specified journey is launched. In the example below, the journey ID is 12345 and the activation ID is 678.

Sample Request
Copy
Copied
curl -i -X PATCH \
  https://api-cdp.treasuredata.com/entities/journeys/12345/syndications/678 \
  -H 'AUTHORIZATION: TD1 1/1234567891234567891234560001234567891234'
 
 
{
  "type": "journeyActivationStep",
  "attributes": {
    "syndication_params": {
      "scheduleType": "hourly",
      "scheduleOption": "00:00,
      "timezone": "UTC",
      "connectorConfig": {
        "useKey": false,
        "spreadsheetTitle": "xxxx",
        "sheetTitle": "From Activation",
        "mode": "replace",
        "range": "A1",
        "rowsThreshold": 5000,
        "valueInputOption": "RAW",
        "setNilForDoubleNan": true
      },
      "connectionId": "135593",
      "name": "My Activation",
      "description": "",
      "columns": [],
      "allColumns": true,
      "emailRecipients": [],
      "notifyOn": []
    }
  }
}

View an Activation Inside a Journey

You can view a specific activation in the specified journey. In the example below, the journey ID is 12345 and the activation ID is 678.

Sample Request

Copy
Copied
curl -i -X GET \
  https://api-cdp.treasuredata.com/entities/journeys/12345/syndications/678 \
  -H 'AUTHORIZATION: TD1 1/1234567891234567891234560001234567891234'

Verifying Objects in a Folder

Similar to objects in the UI, you can view entities in the API. The following call will return all the entities inside the folder, including, segments predictive scoring models, and other folders inside a folder.

You can verify that your journey is created inside your desired folder. In the following example, the folder ID is 295432. You can also view any nested folders by designating the depth you want to view. The depth below is indicated as 30 describes how deeply you want to search inside the folder. Up to 32 levels of child folders are viewable.

Sample Request

Copy
Copied
curl -i -X GET \
  https://api-cdp.treasuredata.com/entities/by-folder/295432?depth=30
  -H 'AUTHORIZATION: TD1 1/1234567891234567891234560001234567891234'

Viewing Journey Statistics

You can view the statistics of the journey by calling the statistics endpoint. The response will include how many profiles the whole met the goal of the journey (if set for the journey), how many profiles are in each stage, and how many profiles exited the stage by meeting exit criteria (if set for the stage and if the profiles exited). In the example below the journey ID is 12345. By default, statistics are displayed for the past 30 days (including the current date).\

Sample Request

Copy
Copied
curl -i -X GET \
  https://api-cdp.treasuredata.com/entities/journeys/12345/statistics \
  -H 'AUTHORIZATION: TD1 1/1234567891234567891234560001234567891234' 

Viewing Customer Profiles

You can view a list of customer profiles inside a specified journey by calling the customers endpoint. In the example below the journey ID is 12345.

Sample Request

Copy
Copied
curl -i -X GET \
  https://api-cdp.treasuredata.com/entities/journeys/12345/customers \
  -H 'AUTHORIZATION: TD1 1/1234567891234567891234560001234567891234'