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.
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. 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.
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 achieve goal",
"segment_id": "54321",
}
}
}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".
"steps": {
"a49a0aa3-6991-4dd8-a4af-c5d36fe9dd93": {
"type": "WaitStep",
"waitStep": 3,
"waitStepUnit": "day",
"next": "2b38f1e5-97d5-45ae-b165-b1c3288721cb",
}
}You can view a journey and all its stages and activations. In the example below, the journey ID is 12345
curl -i -X GET \
https://api-cdp.treasuredata.com/entities/journeys/12345 \
-H 'AUTHORIZATION: TD1 1/1234567891234567891234560001234567891234'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.
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": "...",
}
}
}You can delete a journey using the specified journey ID. In the example below, the journey ID is 12345
curl -i -X DELETE \
https://api-cdp.treasuredata.com/entities/journeys/12345 \
-H 'AUTHORIZATION: TD1 1/1234567891234567891234560001234567891234'