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": "Verify identity",
"instructions": "The agent asks for the order number and the email on the account, and checks they match before going further.",
"fromStateId": "<JOURNEY-STATE-ID>",
"when": "The customer asks for their money back on an order."
}'{
"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.
instructionsstringRequiredWhat happens at this step of the conversation. When goldens are generated for a path, the instructions of its states, in order, are what the scenario is written from. May be empty.
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.whenstringThe condition for the edge from
fromStateId, in plain language. Required withfromStateIdand ignored without it. An empty condition keeps 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.