Create Journey State
(v2)POST
Adds a state to a journey and returns its id. Send fromStateId and when to connect it from an existing state in the same call; retrieve the journey to read the edge that creates. State names are unique within a journey; reusing one returns a 409.
curl -X POST "https://api.confident-ai.com/v2/journeys/{journeyId}/states" \
-H "CONFIDENT_API_KEY: <PROJECT-API-KEY>" \
-H "Content-Type: application/json" \
-d '{
"name": "Share Order Details",
"instructions": "Give order number 48213 and the email jane@example.com.",
"fromStateId": "<JOURNEY-STATE-ID>",
"when": "The assistant asks for your order number or email."
}'{
"success": true,
"data": {
"id": "<JOURNEY-STATE-ID>"
},
"link": "https://app.confident-ai.com/project/<PROJECT-ID>/journeys/<JOURNEY-ID>",
"deprecated": false
}Headers
CONFIDENT_API_KEYstringRequiredThe API key of your Confident AI project.
Path parameters
journeyIdstringRequiredThe id of the journey.
Request body
namestringRequiredThe name of the state, unique within the journey. Name it for what the user does, in a few words.
instructionsstringRequiredWhat the simulated user says or does in this state, written to them in the second person. They keep acting it out until the app's reply matches an edge leaving the state.
fromStateIdstringThe id of an existing state in this journey to connect the new state from. An edge from that state to the new one is created alongside it, and
whenis then required. Omit it to add an unconnected state.whenstringWhat the app does or says in its reply that moves the simulated user from
fromStateIdinto the new state; describe the app's reply, not the user. Required withfromStateIdand ignored without it. An emptywhenkeeps the edge out of the journey's paths until it is given one.
Response
Create Journey State succeeded.
successbooleanIndicates if the request was successful.
dataobjectA reference to a journey state by its id.
Show 1 propertyHide 1 property
idstringThe id of the state, generated by Confident AI.
linkstringThis is the URL of the resource on the Confident AI platform.
deprecatedbooleanIndicates if this endpoint is deprecated.