# Chatbot steps

## Lists all steps for a flow

> \
> \
> \*\*Required Permission:\*\* \`chatbots.steps.list\`\
> \
> \*\*Resource:\*\* \`chatbots/:chatbotId\`

```json
{"openapi":"3.0.0","info":{"title":"ChatCaptain API","version":"1.0"},"tags":[{"name":"Chatbot steps","description":""}],"servers":[{"url":"https://api.chatcaptain.com","description":"Production"}],"security":[{},{}],"paths":{"/v1/chatbots/{chatbotId}/flows/{flowId}/steps":{"get":{"operationId":"ChatbotStepController_listSteps[1]_v1","parameters":[{"name":"chatbotId","required":true,"in":"path","description":"The ID of the chatbot.","schema":{"type":"string"}},{"name":"flowId","required":true,"in":"path","description":"The ID of the flows.","schema":{"type":"string"}}],"responses":{"200":{"description":"List of all Steps.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ListStepsResponseDto"}}}},"403":{"description":"Insufficient permissions."}},"summary":"Lists all steps for a flow","tags":["Chatbot steps"],"description":"\n\n**Required Permission:** `chatbots.steps.list`\n\n**Resource:** `chatbots/:chatbotId`"}}},"components":{"schemas":{"ListStepsResponseDto":{"type":"object","properties":{"steps":{"description":"A list of steps.","type":"array","items":{"$ref":"#/components/schemas/StepDto"}},"error":{"type":"string","description":"Optional error message."}},"required":["steps"]},"StepDto":{"type":"object","properties":{"id":{"type":"string","description":"The unique identifier of the step."},"name":{"type":"string","description":"The name of the step."},"created":{"type":"string","description":"The creation timestamp of the step."},"updated":{"type":"string","description":"The last update timestamp of the step."},"type":{"type":"string","description":"The type of the step (e.g., 'start', 'message', 'condition')."},"grid":{"description":"Grid coordinates for visual placement in the editor.","allOf":[{"$ref":"#/components/schemas/StepGridDto"}]},"elements":{"description":"A list of elements within this step.","type":"array","items":{"$ref":"#/components/schemas/StepElementDto"}},"intent":{"description":"Optional intent configuration for the step.","allOf":[{"$ref":"#/components/schemas/StepIntentDto"}]},"delay":{"description":"Optional delay configuration for the step.","allOf":[{"$ref":"#/components/schemas/StepDelayDto"}]},"split":{"description":"Optional split configuration for the step.","allOf":[{"$ref":"#/components/schemas/StepSplitDto"}]},"condition":{"description":"Optional condition configuration for the step.","allOf":[{"$ref":"#/components/schemas/StepConditionDto"}]},"flow":{"description":"Optional flow execution configuration for the step.","allOf":[{"$ref":"#/components/schemas/StepFlowDto"}]},"trigger":{"description":"Optional trigger configuration for the step.","allOf":[{"$ref":"#/components/schemas/StepTriggerDto"}]},"redirect":{"type":"string","description":"Optional step ID to redirect to."},"userInput":{"type":"string","description":"Optional user input prompt."},"userInputRequired":{"type":"boolean","description":"Whether user input is required for this step."},"context":{"description":"Optional context configuration for the step.","allOf":[{"$ref":"#/components/schemas/StepContextDto"}]},"app":{"description":"Optional app integration configuration for the step.","allOf":[{"$ref":"#/components/schemas/StepAppDto"}]},"description":{"type":"string","description":"An optional description for the step."},"entityDetection":{"description":"Optional entity detection configuration for the step.","allOf":[{"$ref":"#/components/schemas/StepEntityDetectionDto"}]},"userInputIsSensitive":{"type":"boolean","description":"Whether user input in this step is sensitive."},"runPrompt":{"description":"Optional run prompt configuration for the step.","allOf":[{"$ref":"#/components/schemas/StepRunPromptDto"}]},"leadAiConversation":{"description":"Optional Lead AI conversation configuration for the step.","allOf":[{"$ref":"#/components/schemas/StepLeadAiConversationDto"}]},"contactData":{"description":"Optional contact data configuration for the step.","allOf":[{"$ref":"#/components/schemas/StepContactDataDto"}]},"aiConfig":{"description":"Optional AI configuration for the step.","allOf":[{"$ref":"#/components/schemas/StepAiConfigDto"}]}},"required":["id","name","created","updated","type","grid","elements"]},"StepGridDto":{"type":"object","properties":{"x":{"type":"number","description":"X-coordinate in the flow editor."},"y":{"type":"number","description":"Y-coordinate in the flow editor."}},"required":["x","y"]},"StepElementDto":{"type":"object","properties":{"type":{"type":"string","description":"The type of the step element (e.g., 'text', 'buttons')."},"content":{"description":"The content of the step element.","allOf":[{"$ref":"#/components/schemas/StepElementContentDto"}]}},"required":["type","content"]},"StepElementContentDto":{"type":"object","properties":{"text":{"description":"Text content for the step element.","allOf":[{"$ref":"#/components/schemas/StepElementContentTextDto"}]},"buttons":{"description":"Button content for the step element.","allOf":[{"$ref":"#/components/schemas/StepElementContentButtonDto"}]},"file":{"description":"File content for the step element.","allOf":[{"$ref":"#/components/schemas/StepElementContentFileDto"}]},"voiceHangup":{"description":"Voice hangup action for the step element.","allOf":[{"$ref":"#/components/schemas/StepElementContentVoiceHangupDto"}]},"voiceTransfer":{"description":"Voice transfer action for the step element.","allOf":[{"$ref":"#/components/schemas/StepElementContentVoiceTransferDto"}]},"agentHandover":{"description":"Agent handover action for the step element.","allOf":[{"$ref":"#/components/schemas/StepElementContentAgentHandoverDto"}]},"assignVariable":{"description":"Assign variable action for the step element.","allOf":[{"$ref":"#/components/schemas/StepElementContentAssignVariableDto"}]},"updateTags":{"description":"Update tags action for the step element.","allOf":[{"$ref":"#/components/schemas/StepElementContentUpdateTagsDto"}]},"snooze":{"description":"Snooze action for the step element.","allOf":[{"$ref":"#/components/schemas/StepElementContentSnoozeDto"}]},"unread":{"description":"Unread action for the step element.","allOf":[{"$ref":"#/components/schemas/StepElementContentUnreadDto"}]},"whatsappTemplate":{"description":"WhatsApp template content for the step element.","allOf":[{"$ref":"#/components/schemas/StepElementContentWhatsAppTemplateDto"}]},"textToSpeech":{"description":"Text-to-speech content for the step element.","allOf":[{"$ref":"#/components/schemas/StepElementContentTextToSpeechDto"}]},"callSettings":{"description":"Call settings for the step element.","allOf":[{"$ref":"#/components/schemas/StepElementContentCallSettingsDto"}]},"metaWhatsappTemplate":{"description":"Meta WhatsApp template content for the step element.","allOf":[{"$ref":"#/components/schemas/StepElementContentMetaWhatsAppTemplateDto"}]},"note":{"description":"Note content for the step element.","allOf":[{"$ref":"#/components/schemas/StepElementContentNoteDto"}]},"chatEnd":{"description":"Chat end action for the step element.","allOf":[{"$ref":"#/components/schemas/StepElementContentChatEndDto"}]},"assignTeam":{"description":"Assign team action for the step element.","allOf":[{"$ref":"#/components/schemas/StepElementContentAssignTeamDto"}]},"assignOperator":{"description":"Assign operator action for the step element.","allOf":[{"$ref":"#/components/schemas/StepElementContentAssignOperatorDto"}]}}},"StepElementContentTextDto":{"type":"object","properties":{"text":{"type":"object","description":"The text content, localized by language key.","additionalProperties":{"type":"string"}}},"required":["text"]},"StepElementContentButtonDto":{"type":"object","properties":{"buttons":{"description":"A list of buttons to display.","type":"array","items":{"$ref":"#/components/schemas/StepElementContentButtonButtonDto"}}},"required":["buttons"]},"StepElementContentButtonButtonDto":{"type":"object","properties":{"text":{"type":"object","description":"The text displayed on the button, localized.","additionalProperties":{"type":"string"}},"value":{"type":"string","description":"The value associated with the button."},"type":{"type":"string","description":"The type of button (e.g., 'redirect', 'postback')."},"payload":{"type":"string","description":"An optional payload for postback buttons."}},"required":["text","value","type"]},"StepElementContentFileDto":{"type":"object","properties":{"name":{"type":"string","description":"The name of the file."},"bucketId":{"type":"string","description":"The ID of the bucket where the file is stored."},"objectId":{"type":"string","description":"The object ID of the file within the bucket."},"mimeType":{"type":"string","description":"The MIME type of the file."},"sizeInByte":{"type":"number","description":"The size of the file in bytes."},"fbaId":{"type":"string","description":"Facebook attachment ID (optional)."},"waaId":{"type":"string","description":"WhatsApp attachment ID (optional)."}},"required":["name","bucketId","objectId","mimeType","sizeInByte"]},"StepElementContentVoiceHangupDto":{"type":"object","properties":{"reason":{"type":"string","description":"The reason for hanging up the voice call."},"headers":{"type":"object","description":"Custom headers to send with the hangup event.","additionalProperties":{"type":"string"}}},"required":["reason","headers"]},"StepElementContentVoiceTransferDto":{"type":"object","properties":{"target":{"type":"string","description":"The target for the voice transfer (e.g., a phone number)."},"reason":{"type":"string","description":"An optional reason for the voice transfer."},"headers":{"type":"object","description":"Custom headers to send with the voice transfer.","additionalProperties":{"type":"string"}}},"required":["target","headers"]},"StepElementContentAgentHandoverDto":{"type":"object","properties":{"reason":{"type":"string","description":"An optional reason for the agent handover."},"timeoutSeconds":{"type":"number","description":"Timeout in seconds for the agent to accept the handover."},"agentId":{"type":"string","description":"The ID of the specific agent to hand over to."},"groupId":{"type":"string","description":"The ID of the agent group to hand over to."},"assignmentMethod":{"type":"string","description":"The method used for assigning the agent."}}},"StepElementContentAssignVariableDto":{"type":"object","properties":{"variableId":{"type":"string","description":"The ID of the variable to assign a value to."},"path":{"type":"string","description":"Optional JSON path within the variable to assign the value."},"value":{"type":"string","description":"The value to assign to the variable."}},"required":["variableId"]},"StepElementContentUpdateTagsDto":{"type":"object","properties":{"method":{"type":"string","description":"The method to update tags ('add' or 'remove').","enum":["add","remove"]},"tagId":{"type":"string","description":"The ID of the tag to add or remove."}},"required":["method","tagId"]},"StepElementContentSnoozeDto":{"type":"object","properties":{"seconds":{"type":"number","description":"The duration in seconds to snooze the conversation."}},"required":["seconds"]},"StepElementContentUnreadDto":{"type":"object","properties":{"unread":{"type":"boolean","description":"Whether to mark the conversation as unread."}},"required":["unread"]},"StepElementContentWhatsAppTemplateDto":{"type":"object","properties":{"templateId":{"type":"string","description":"The ID of the WhatsApp template to send."},"parameters":{"type":"object","description":"Parameters to populate the WhatsApp template.","additionalProperties":{"type":"string"}}},"required":["templateId","parameters"]},"StepElementContentTextToSpeechDto":{"type":"object","properties":{"text":{"type":"object","description":"The text content for text-to-speech, localized.","additionalProperties":{"type":"string"}},"speech":{"type":"string","description":"Optional SSML speech markup."}},"required":["text"]},"StepElementContentCallSettingsDto":{"type":"object","properties":{"userInputSpeechDetectionTimeout":{"type":"number","description":"Timeout for user speech detection in milliseconds."},"dtmf":{"type":"boolean","description":"Whether DTMF (Dual-tone multi-frequency) input is enabled."},"bargeIn":{"type":"boolean","description":"Whether barge-in is enabled (user can interrupt bot)."}}},"StepElementContentMetaWhatsAppTemplateDto":{"type":"object","properties":{"templateName":{"type":"string","description":"The name of the Meta WhatsApp template."},"templateId":{"type":"string","description":"The ID of the Meta WhatsApp template."},"header":{"description":"Header configuration for the Meta WhatsApp template.","allOf":[{"$ref":"#/components/schemas/StepElementContentMetaWhatsAppTemplateHeaderDto"}]},"bodyParameters":{"description":"Parameters for the body of the Meta WhatsApp template.","type":"array","items":{"type":"string"}},"buttons":{"description":"Button configurations for the Meta WhatsApp template.","allOf":[{"$ref":"#/components/schemas/StepElementContentMetaWhatsAppTemplateButtonsDto"}]}},"required":["templateName","templateId","bodyParameters"]},"StepElementContentMetaWhatsAppTemplateHeaderDto":{"type":"object","properties":{"file":{"description":"The file used in the template header.","allOf":[{"$ref":"#/components/schemas/StepElementContentFileDto"}]},"parameters":{"description":"Parameters for the header text.","type":"array","items":{"type":"string"}}},"required":["parameters"]},"StepElementContentMetaWhatsAppTemplateButtonsDto":{"type":"object","properties":{"values":{"description":"Values for the buttons in the template.","type":"array","items":{"type":"string"}}},"required":["values"]},"StepElementContentNoteDto":{"type":"object","properties":{"note":{"type":"string","description":"A private note for internal use."}},"required":["note"]},"StepElementContentChatEndDto":{"type":"object","properties":{"status":{"description":"The status to set for the conversation.\n\n- `0`: OPEN\n- `1`: BOT\n- `2`: IN_PROGRESS\n- `3`: CLOSED","allOf":[{"$ref":"#/components/schemas/StepElementContentChatEnd_ConversationStatus"}]}},"required":["status"]},"StepElementContentChatEnd_ConversationStatus":{"type":"number","enum":[0,1,2,3,-1],"description":"The status to set for the conversation.\n\n- `0`: OPEN\n- `1`: BOT\n- `2`: IN_PROGRESS\n- `3`: CLOSED"},"StepElementContentAssignTeamDto":{"type":"object","properties":{"teamId":{"type":"string","description":"The ID of the team to assign the conversation to."}},"required":["teamId"]},"StepElementContentAssignOperatorDto":{"type":"object","properties":{"operatorId":{"type":"string","description":"The ID of the operator to assign the conversation to."},"assignToLastAssigned":{"type":"boolean","description":"Whether to assign to the last assigned operator."}},"required":["assignToLastAssigned"]},"StepIntentDto":{"type":"object","properties":{"intentId":{"type":"string","description":"The ID of the associated intent."}},"required":["intentId"]},"StepDelayDto":{"type":"object","properties":{"seconds":{"type":"number","description":"The waiting time in seconds."}},"required":["seconds"]},"StepSplitDto":{"type":"object","properties":{"a":{"type":"number","description":"Percentage for exit A."},"b":{"type":"number","description":"Percentage for exit B."},"sameRedirect":{"type":"boolean","description":"Indicates whether both exits should lead to the same destination."},"redirects":{"description":"The redirect configurations for split A and B.","allOf":[{"$ref":"#/components/schemas/StepSplitRedirectsDto"}]}},"required":["a","b","sameRedirect","redirects"]},"StepSplitRedirectsDto":{"type":"object","properties":{"a":{"type":"string","description":"The step ID for redirect A."},"b":{"type":"string","description":"The step ID for redirect B."}},"required":["a","b"]},"StepConditionDto":{"type":"object","properties":{"redirects":{"description":"The redirect configurations based on condition outcome.","allOf":[{"$ref":"#/components/schemas/StepConditionRedirectsDto"}]},"conditions":{"description":"A list of conditions to evaluate.","type":"array","items":{"$ref":"#/components/schemas/StepConditionConditionDto"}}},"required":["redirects","conditions"]},"StepConditionRedirectsDto":{"type":"object","properties":{"t":{"type":"string","description":"The step ID to redirect to if the condition is true."},"f":{"type":"string","description":"The step ID to redirect to if the condition is false."}},"required":["t","f"]},"StepConditionConditionDto":{"type":"object","properties":{"valueLeft":{"type":"string","description":"The left-hand side value for the condition."},"operator":{"type":"string","description":"The operator for the condition (e.g., '==', '>', '<')."},"valueRight":{"type":"string","description":"The right-hand side value for the condition."},"group":{"type":"number","description":"The group number for logical grouping of conditions."}},"required":["valueLeft","operator","valueRight","group"]},"StepFlowDto":{"type":"object","properties":{"outlets":{"type":"object","description":"Outlets of the flow, mapping names to step IDs.","additionalProperties":{"$ref":"#/components/schemas/StepFlowOutletDto"}},"flowId":{"type":"string","description":"The ID of the flow to execute."},"entryStepId":{"type":"string","description":"The ID of the entry step within the flow."},"redirects":{"type":"object","description":"Redirects based on flow outcomes.","additionalProperties":{"type":"string"}}},"required":["outlets","flowId","entryStepId","redirects"]},"StepFlowOutletDto":{"type":"object","properties":{"stepId":{"type":"string","description":"The ID of the step this outlet points to."},"name":{"type":"string","description":"The name of the flow outlet."}},"required":["stepId","name"]},"StepTriggerDto":{"type":"object","properties":{"triggerId":{"type":"string","description":"The unique identifier of the trigger."},"event":{"type":"string","description":"The triggering event."},"payload":{"type":"string","description":"An optional payload value required for triggering."}},"required":["triggerId","event"]},"StepContextDto":{"type":"object","properties":{"intents":{"description":"A list of intents to consider in this context.","type":"array","items":{"$ref":"#/components/schemas/StepContextIntentDto"}},"fallbackRedirect":{"type":"string","description":"The step ID to redirect to if no intent is matched."}},"required":["intents"]},"StepContextIntentDto":{"type":"object","properties":{"name":{"type":"string","description":"The name of the intent."},"intentId":{"type":"string","description":"The ID of the intent."},"redirect":{"type":"string","description":"The step ID to redirect to if this intent is matched."}},"required":["name","intentId"]},"StepAppDto":{"type":"object","properties":{"appId":{"type":"string","description":"The ID of the app to integrate."},"moduleId":{"type":"string","description":"The ID of the module within the app to execute."},"paramsJson":{"type":"string","format":"json","description":"Parameters for the app module in JSON format."}},"required":["appId","moduleId","paramsJson"]},"StepEntityDetectionDto":{"type":"object","properties":{"outputVariableId":{"type":"string","description":"The ID of the variable to store the detected entities."},"outputVariablePath":{"type":"string","description":"Optional JSON path within the output variable."},"prompt":{"type":"string","description":"The prompt for entity detection."}},"required":["outputVariableId","prompt","examples"]},"StepRunPromptDto":{"type":"object","properties":{"outputVariableId":{"type":"string","description":"The ID of the variable to store the prompt's output."},"outputVariablePath":{"type":"string","description":"Optional JSON path within the output variable."},"prompt":{"type":"string","description":"The prompt to run."},"includeConversationHistory":{"type":"boolean","description":"Whether to include conversation history in the prompt."},"useRag":{"type":"boolean","description":"Whether to use RAG (Retrieval Augmented Generation)."},"includeNotes":{"type":"boolean","description":"Whether to use notes in prompt context."},"knowledgeGroupIds":{"description":"List of knowledge group IDs for RAG.","type":"array","items":{"type":"string"}},"ragContextMessages":{"type":"number","description":"Number of context messages for RAG."},"contextMessageCount":{"type":"number","description":"Number of messages to include in the context."}},"required":["outputVariableId","prompt","knowledgeGroupIds"]},"StepLeadAiConversationDto":{"type":"object","properties":{"prompt":{"type":"string","description":"The initial prompt for the AI conversation."},"context":{"type":"string","description":"Additional context for the AI conversation."},"maxIterations":{"type":"number","description":"The maximum number of iterations for the AI conversation."},"ragContextMessages":{"type":"number","description":"Number of context messages for RAG."},"includeConversationHistory":{"type":"boolean","description":"Whether to include conversation history."},"outlets":{"description":"Outlets for different conversation paths.","type":"array","items":{"$ref":"#/components/schemas/StepLeadAiConversationOutletDto"}},"tools":{"description":"Tools available to the AI during the conversation.","type":"array","items":{"$ref":"#/components/schemas/StepLeadAiConversationToolDto"}},"useRag":{"type":"boolean","description":"Whether to use RAG (Retrieval Augmented Generation)."},"delayMin":{"type":"number","description":"Minimum delay in seconds before the next AI response."},"delayMax":{"type":"number","description":"Maximum delay in seconds before the next AI response."},"delay":{"type":"boolean","description":"Whether to apply a delay before the next AI response."},"knowledgeGroupIds":{"description":"List of knowledge group IDs for RAG.","type":"array","items":{"type":"string"}},"contextMessageCount":{"type":"number","description":"Number of messages to include in the context."}},"required":["prompt","maxIterations","outlets","tools","knowledgeGroupIds"]},"StepLeadAiConversationOutletDto":{"type":"object","properties":{"name":{"type":"string","description":"The name of the conversation outlet."},"description":{"type":"string","description":"A description of what this outlet does."},"redirect":{"type":"string","description":"The step ID to redirect to when this outlet is triggered."}},"required":["name","description"]},"StepLeadAiConversationToolDto":{"type":"object","properties":{"appId":{"type":"string","description":"The ID of the app associated with the tool."},"moduleId":{"type":"string","description":"The ID of the module within the app."},"description":{"type":"string","description":"A description of what the tool does."},"name":{"type":"string","pattern":"/^[a-zA-Z][a-zA-Z0-9_]*$/","description":"The name of the tool."}},"required":["appId","moduleId","description","name"]},"StepContactDataDto":{"type":"object","properties":{"values":{"type":"string","description":"The values to set for contact data."}},"required":["values"]},"StepAiConfigDto":{"type":"object","properties":{"model":{"type":"number","description":"The AI model to use.\n\n- `1`: GEMINI_25_FLASH","enum":[1]},"thinkingBudget":{"type":"number","description":"Budget for the \"thinking\" process in tokens."},"seed":{"type":"number","description":"Seed for reproducible results."},"topP":{"type":"number","description":"Top-P value for generation."},"temperature":{"type":"number","description":"Temperature for generation creativity."}},"required":["model"]}}}}
```

## Creates a new step within a flow

> \
> \
> \*\*Required Permission:\*\* \`chatbots.steps.create\`\
> \
> \*\*Resource:\*\* \`chatbots/:chatbotId\`

```json
{"openapi":"3.0.0","info":{"title":"ChatCaptain API","version":"1.0"},"tags":[{"name":"Chatbot steps","description":""}],"servers":[{"url":"https://api.chatcaptain.com","description":"Production"}],"security":[{},{}],"paths":{"/v1/chatbots/{chatbotId}/flows/{flowId}/steps":{"post":{"operationId":"ChatbotStepController_createStep[1]_v1","parameters":[{"name":"chatbotId","required":true,"in":"path","description":"The ID of the chatbot.","schema":{"type":"string"}},{"name":"flowId","required":true,"in":"path","description":"The ID of the flows.","schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateStepRequestDto"}}}},"responses":{"201":{"description":"Step created successfully.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/StepResponseDto"}}}},"400":{"description":"Invalid input data."},"403":{"description":"Insufficient permissions."}},"summary":"Creates a new step within a flow","tags":["Chatbot steps"],"description":"\n\n**Required Permission:** `chatbots.steps.create`\n\n**Resource:** `chatbots/:chatbotId`"}}},"components":{"schemas":{"CreateStepRequestDto":{"type":"object","properties":{"name":{"type":"string","description":"The name of the step."},"type":{"type":"string","description":"The type of the step."},"grid":{"description":"Grid coordinates for visual placement.","allOf":[{"$ref":"#/components/schemas/StepGridDto"}]},"elements":{"description":"A list of elements to include in the step.","default":[],"type":"array","items":{"$ref":"#/components/schemas/StepElementDto"}},"delay":{"description":"Optional delay configuration.","allOf":[{"$ref":"#/components/schemas/StepDelayDto"}]},"split":{"description":"Optional split configuration.","allOf":[{"$ref":"#/components/schemas/StepSplitDto"}]},"condition":{"description":"Optional condition configuration.","allOf":[{"$ref":"#/components/schemas/StepConditionDto"}]},"trigger":{"description":"Optional trigger configuration.","allOf":[{"$ref":"#/components/schemas/UpdateOrCreateStepTriggerDto"}]},"redirect":{"type":"string","description":"Optional step ID to redirect to."},"context":{"description":"Optional context configuration.","allOf":[{"$ref":"#/components/schemas/StepContextDto"}]},"app":{"description":"Optional app integration configuration.","allOf":[{"$ref":"#/components/schemas/StepAppDto"}]},"entityDetection":{"description":"Optional entity detection configuration.","allOf":[{"$ref":"#/components/schemas/StepEntityDetectionDto"}]},"description":{"type":"string","description":"An optional description for the step."},"flow":{"description":"Optional flow execution configuration.","allOf":[{"$ref":"#/components/schemas/StepFlowDto"}]},"runPrompt":{"description":"Optional run prompt configuration.","allOf":[{"$ref":"#/components/schemas/StepRunPromptDto"}]},"leadAiConversation":{"description":"Optional Lead AI conversation configuration.","allOf":[{"$ref":"#/components/schemas/StepLeadAiConversationDto"}]},"contactData":{"description":"Optional contact data configuration.","allOf":[{"$ref":"#/components/schemas/StepContactDataDto"}]},"aiConfig":{"description":"Optional AI configuration.","allOf":[{"$ref":"#/components/schemas/StepAiConfigDto"}]},"conversationData":{"description":"Optional conversation data.","allOf":[{"$ref":"#/components/schemas/StepConversationDataDto"}]}},"required":["name","type","grid","elements"]},"StepGridDto":{"type":"object","properties":{"x":{"type":"number","description":"X-coordinate in the flow editor."},"y":{"type":"number","description":"Y-coordinate in the flow editor."}},"required":["x","y"]},"StepElementDto":{"type":"object","properties":{"type":{"type":"string","description":"The type of the step element (e.g., 'text', 'buttons')."},"content":{"description":"The content of the step element.","allOf":[{"$ref":"#/components/schemas/StepElementContentDto"}]}},"required":["type","content"]},"StepElementContentDto":{"type":"object","properties":{"text":{"description":"Text content for the step element.","allOf":[{"$ref":"#/components/schemas/StepElementContentTextDto"}]},"buttons":{"description":"Button content for the step element.","allOf":[{"$ref":"#/components/schemas/StepElementContentButtonDto"}]},"file":{"description":"File content for the step element.","allOf":[{"$ref":"#/components/schemas/StepElementContentFileDto"}]},"voiceHangup":{"description":"Voice hangup action for the step element.","allOf":[{"$ref":"#/components/schemas/StepElementContentVoiceHangupDto"}]},"voiceTransfer":{"description":"Voice transfer action for the step element.","allOf":[{"$ref":"#/components/schemas/StepElementContentVoiceTransferDto"}]},"agentHandover":{"description":"Agent handover action for the step element.","allOf":[{"$ref":"#/components/schemas/StepElementContentAgentHandoverDto"}]},"assignVariable":{"description":"Assign variable action for the step element.","allOf":[{"$ref":"#/components/schemas/StepElementContentAssignVariableDto"}]},"updateTags":{"description":"Update tags action for the step element.","allOf":[{"$ref":"#/components/schemas/StepElementContentUpdateTagsDto"}]},"snooze":{"description":"Snooze action for the step element.","allOf":[{"$ref":"#/components/schemas/StepElementContentSnoozeDto"}]},"unread":{"description":"Unread action for the step element.","allOf":[{"$ref":"#/components/schemas/StepElementContentUnreadDto"}]},"whatsappTemplate":{"description":"WhatsApp template content for the step element.","allOf":[{"$ref":"#/components/schemas/StepElementContentWhatsAppTemplateDto"}]},"textToSpeech":{"description":"Text-to-speech content for the step element.","allOf":[{"$ref":"#/components/schemas/StepElementContentTextToSpeechDto"}]},"callSettings":{"description":"Call settings for the step element.","allOf":[{"$ref":"#/components/schemas/StepElementContentCallSettingsDto"}]},"metaWhatsappTemplate":{"description":"Meta WhatsApp template content for the step element.","allOf":[{"$ref":"#/components/schemas/StepElementContentMetaWhatsAppTemplateDto"}]},"note":{"description":"Note content for the step element.","allOf":[{"$ref":"#/components/schemas/StepElementContentNoteDto"}]},"chatEnd":{"description":"Chat end action for the step element.","allOf":[{"$ref":"#/components/schemas/StepElementContentChatEndDto"}]},"assignTeam":{"description":"Assign team action for the step element.","allOf":[{"$ref":"#/components/schemas/StepElementContentAssignTeamDto"}]},"assignOperator":{"description":"Assign operator action for the step element.","allOf":[{"$ref":"#/components/schemas/StepElementContentAssignOperatorDto"}]}}},"StepElementContentTextDto":{"type":"object","properties":{"text":{"type":"object","description":"The text content, localized by language key.","additionalProperties":{"type":"string"}}},"required":["text"]},"StepElementContentButtonDto":{"type":"object","properties":{"buttons":{"description":"A list of buttons to display.","type":"array","items":{"$ref":"#/components/schemas/StepElementContentButtonButtonDto"}}},"required":["buttons"]},"StepElementContentButtonButtonDto":{"type":"object","properties":{"text":{"type":"object","description":"The text displayed on the button, localized.","additionalProperties":{"type":"string"}},"value":{"type":"string","description":"The value associated with the button."},"type":{"type":"string","description":"The type of button (e.g., 'redirect', 'postback')."},"payload":{"type":"string","description":"An optional payload for postback buttons."}},"required":["text","value","type"]},"StepElementContentFileDto":{"type":"object","properties":{"name":{"type":"string","description":"The name of the file."},"bucketId":{"type":"string","description":"The ID of the bucket where the file is stored."},"objectId":{"type":"string","description":"The object ID of the file within the bucket."},"mimeType":{"type":"string","description":"The MIME type of the file."},"sizeInByte":{"type":"number","description":"The size of the file in bytes."},"fbaId":{"type":"string","description":"Facebook attachment ID (optional)."},"waaId":{"type":"string","description":"WhatsApp attachment ID (optional)."}},"required":["name","bucketId","objectId","mimeType","sizeInByte"]},"StepElementContentVoiceHangupDto":{"type":"object","properties":{"reason":{"type":"string","description":"The reason for hanging up the voice call."},"headers":{"type":"object","description":"Custom headers to send with the hangup event.","additionalProperties":{"type":"string"}}},"required":["reason","headers"]},"StepElementContentVoiceTransferDto":{"type":"object","properties":{"target":{"type":"string","description":"The target for the voice transfer (e.g., a phone number)."},"reason":{"type":"string","description":"An optional reason for the voice transfer."},"headers":{"type":"object","description":"Custom headers to send with the voice transfer.","additionalProperties":{"type":"string"}}},"required":["target","headers"]},"StepElementContentAgentHandoverDto":{"type":"object","properties":{"reason":{"type":"string","description":"An optional reason for the agent handover."},"timeoutSeconds":{"type":"number","description":"Timeout in seconds for the agent to accept the handover."},"agentId":{"type":"string","description":"The ID of the specific agent to hand over to."},"groupId":{"type":"string","description":"The ID of the agent group to hand over to."},"assignmentMethod":{"type":"string","description":"The method used for assigning the agent."}}},"StepElementContentAssignVariableDto":{"type":"object","properties":{"variableId":{"type":"string","description":"The ID of the variable to assign a value to."},"path":{"type":"string","description":"Optional JSON path within the variable to assign the value."},"value":{"type":"string","description":"The value to assign to the variable."}},"required":["variableId"]},"StepElementContentUpdateTagsDto":{"type":"object","properties":{"method":{"type":"string","description":"The method to update tags ('add' or 'remove').","enum":["add","remove"]},"tagId":{"type":"string","description":"The ID of the tag to add or remove."}},"required":["method","tagId"]},"StepElementContentSnoozeDto":{"type":"object","properties":{"seconds":{"type":"number","description":"The duration in seconds to snooze the conversation."}},"required":["seconds"]},"StepElementContentUnreadDto":{"type":"object","properties":{"unread":{"type":"boolean","description":"Whether to mark the conversation as unread."}},"required":["unread"]},"StepElementContentWhatsAppTemplateDto":{"type":"object","properties":{"templateId":{"type":"string","description":"The ID of the WhatsApp template to send."},"parameters":{"type":"object","description":"Parameters to populate the WhatsApp template.","additionalProperties":{"type":"string"}}},"required":["templateId","parameters"]},"StepElementContentTextToSpeechDto":{"type":"object","properties":{"text":{"type":"object","description":"The text content for text-to-speech, localized.","additionalProperties":{"type":"string"}},"speech":{"type":"string","description":"Optional SSML speech markup."}},"required":["text"]},"StepElementContentCallSettingsDto":{"type":"object","properties":{"userInputSpeechDetectionTimeout":{"type":"number","description":"Timeout for user speech detection in milliseconds."},"dtmf":{"type":"boolean","description":"Whether DTMF (Dual-tone multi-frequency) input is enabled."},"bargeIn":{"type":"boolean","description":"Whether barge-in is enabled (user can interrupt bot)."}}},"StepElementContentMetaWhatsAppTemplateDto":{"type":"object","properties":{"templateName":{"type":"string","description":"The name of the Meta WhatsApp template."},"templateId":{"type":"string","description":"The ID of the Meta WhatsApp template."},"header":{"description":"Header configuration for the Meta WhatsApp template.","allOf":[{"$ref":"#/components/schemas/StepElementContentMetaWhatsAppTemplateHeaderDto"}]},"bodyParameters":{"description":"Parameters for the body of the Meta WhatsApp template.","type":"array","items":{"type":"string"}},"buttons":{"description":"Button configurations for the Meta WhatsApp template.","allOf":[{"$ref":"#/components/schemas/StepElementContentMetaWhatsAppTemplateButtonsDto"}]}},"required":["templateName","templateId","bodyParameters"]},"StepElementContentMetaWhatsAppTemplateHeaderDto":{"type":"object","properties":{"file":{"description":"The file used in the template header.","allOf":[{"$ref":"#/components/schemas/StepElementContentFileDto"}]},"parameters":{"description":"Parameters for the header text.","type":"array","items":{"type":"string"}}},"required":["parameters"]},"StepElementContentMetaWhatsAppTemplateButtonsDto":{"type":"object","properties":{"values":{"description":"Values for the buttons in the template.","type":"array","items":{"type":"string"}}},"required":["values"]},"StepElementContentNoteDto":{"type":"object","properties":{"note":{"type":"string","description":"A private note for internal use."}},"required":["note"]},"StepElementContentChatEndDto":{"type":"object","properties":{"status":{"description":"The status to set for the conversation.\n\n- `0`: OPEN\n- `1`: BOT\n- `2`: IN_PROGRESS\n- `3`: CLOSED","allOf":[{"$ref":"#/components/schemas/StepElementContentChatEnd_ConversationStatus"}]}},"required":["status"]},"StepElementContentChatEnd_ConversationStatus":{"type":"number","enum":[0,1,2,3,-1],"description":"The status to set for the conversation.\n\n- `0`: OPEN\n- `1`: BOT\n- `2`: IN_PROGRESS\n- `3`: CLOSED"},"StepElementContentAssignTeamDto":{"type":"object","properties":{"teamId":{"type":"string","description":"The ID of the team to assign the conversation to."}},"required":["teamId"]},"StepElementContentAssignOperatorDto":{"type":"object","properties":{"operatorId":{"type":"string","description":"The ID of the operator to assign the conversation to."},"assignToLastAssigned":{"type":"boolean","description":"Whether to assign to the last assigned operator."}},"required":["assignToLastAssigned"]},"StepDelayDto":{"type":"object","properties":{"seconds":{"type":"number","description":"The waiting time in seconds."}},"required":["seconds"]},"StepSplitDto":{"type":"object","properties":{"a":{"type":"number","description":"Percentage for exit A."},"b":{"type":"number","description":"Percentage for exit B."},"sameRedirect":{"type":"boolean","description":"Indicates whether both exits should lead to the same destination."},"redirects":{"description":"The redirect configurations for split A and B.","allOf":[{"$ref":"#/components/schemas/StepSplitRedirectsDto"}]}},"required":["a","b","sameRedirect","redirects"]},"StepSplitRedirectsDto":{"type":"object","properties":{"a":{"type":"string","description":"The step ID for redirect A."},"b":{"type":"string","description":"The step ID for redirect B."}},"required":["a","b"]},"StepConditionDto":{"type":"object","properties":{"redirects":{"description":"The redirect configurations based on condition outcome.","allOf":[{"$ref":"#/components/schemas/StepConditionRedirectsDto"}]},"conditions":{"description":"A list of conditions to evaluate.","type":"array","items":{"$ref":"#/components/schemas/StepConditionConditionDto"}}},"required":["redirects","conditions"]},"StepConditionRedirectsDto":{"type":"object","properties":{"t":{"type":"string","description":"The step ID to redirect to if the condition is true."},"f":{"type":"string","description":"The step ID to redirect to if the condition is false."}},"required":["t","f"]},"StepConditionConditionDto":{"type":"object","properties":{"valueLeft":{"type":"string","description":"The left-hand side value for the condition."},"operator":{"type":"string","description":"The operator for the condition (e.g., '==', '>', '<')."},"valueRight":{"type":"string","description":"The right-hand side value for the condition."},"group":{"type":"number","description":"The group number for logical grouping of conditions."}},"required":["valueLeft","operator","valueRight","group"]},"UpdateOrCreateStepTriggerDto":{"type":"object","properties":{"event":{"type":"string","description":"The triggering event."},"payload":{"type":"string","description":"An optional payload value required for triggering."}},"required":["event"]},"StepContextDto":{"type":"object","properties":{"intents":{"description":"A list of intents to consider in this context.","type":"array","items":{"$ref":"#/components/schemas/StepContextIntentDto"}},"fallbackRedirect":{"type":"string","description":"The step ID to redirect to if no intent is matched."}},"required":["intents"]},"StepContextIntentDto":{"type":"object","properties":{"name":{"type":"string","description":"The name of the intent."},"intentId":{"type":"string","description":"The ID of the intent."},"redirect":{"type":"string","description":"The step ID to redirect to if this intent is matched."}},"required":["name","intentId"]},"StepAppDto":{"type":"object","properties":{"appId":{"type":"string","description":"The ID of the app to integrate."},"moduleId":{"type":"string","description":"The ID of the module within the app to execute."},"paramsJson":{"type":"string","format":"json","description":"Parameters for the app module in JSON format."}},"required":["appId","moduleId","paramsJson"]},"StepEntityDetectionDto":{"type":"object","properties":{"outputVariableId":{"type":"string","description":"The ID of the variable to store the detected entities."},"outputVariablePath":{"type":"string","description":"Optional JSON path within the output variable."},"prompt":{"type":"string","description":"The prompt for entity detection."}},"required":["outputVariableId","prompt","examples"]},"StepFlowDto":{"type":"object","properties":{"outlets":{"type":"object","description":"Outlets of the flow, mapping names to step IDs.","additionalProperties":{"$ref":"#/components/schemas/StepFlowOutletDto"}},"flowId":{"type":"string","description":"The ID of the flow to execute."},"entryStepId":{"type":"string","description":"The ID of the entry step within the flow."},"redirects":{"type":"object","description":"Redirects based on flow outcomes.","additionalProperties":{"type":"string"}}},"required":["outlets","flowId","entryStepId","redirects"]},"StepFlowOutletDto":{"type":"object","properties":{"stepId":{"type":"string","description":"The ID of the step this outlet points to."},"name":{"type":"string","description":"The name of the flow outlet."}},"required":["stepId","name"]},"StepRunPromptDto":{"type":"object","properties":{"outputVariableId":{"type":"string","description":"The ID of the variable to store the prompt's output."},"outputVariablePath":{"type":"string","description":"Optional JSON path within the output variable."},"prompt":{"type":"string","description":"The prompt to run."},"includeConversationHistory":{"type":"boolean","description":"Whether to include conversation history in the prompt."},"useRag":{"type":"boolean","description":"Whether to use RAG (Retrieval Augmented Generation)."},"includeNotes":{"type":"boolean","description":"Whether to use notes in prompt context."},"knowledgeGroupIds":{"description":"List of knowledge group IDs for RAG.","type":"array","items":{"type":"string"}},"ragContextMessages":{"type":"number","description":"Number of context messages for RAG."},"contextMessageCount":{"type":"number","description":"Number of messages to include in the context."}},"required":["outputVariableId","prompt","knowledgeGroupIds"]},"StepLeadAiConversationDto":{"type":"object","properties":{"prompt":{"type":"string","description":"The initial prompt for the AI conversation."},"context":{"type":"string","description":"Additional context for the AI conversation."},"maxIterations":{"type":"number","description":"The maximum number of iterations for the AI conversation."},"ragContextMessages":{"type":"number","description":"Number of context messages for RAG."},"includeConversationHistory":{"type":"boolean","description":"Whether to include conversation history."},"outlets":{"description":"Outlets for different conversation paths.","type":"array","items":{"$ref":"#/components/schemas/StepLeadAiConversationOutletDto"}},"tools":{"description":"Tools available to the AI during the conversation.","type":"array","items":{"$ref":"#/components/schemas/StepLeadAiConversationToolDto"}},"useRag":{"type":"boolean","description":"Whether to use RAG (Retrieval Augmented Generation)."},"delayMin":{"type":"number","description":"Minimum delay in seconds before the next AI response."},"delayMax":{"type":"number","description":"Maximum delay in seconds before the next AI response."},"delay":{"type":"boolean","description":"Whether to apply a delay before the next AI response."},"knowledgeGroupIds":{"description":"List of knowledge group IDs for RAG.","type":"array","items":{"type":"string"}},"contextMessageCount":{"type":"number","description":"Number of messages to include in the context."}},"required":["prompt","maxIterations","outlets","tools","knowledgeGroupIds"]},"StepLeadAiConversationOutletDto":{"type":"object","properties":{"name":{"type":"string","description":"The name of the conversation outlet."},"description":{"type":"string","description":"A description of what this outlet does."},"redirect":{"type":"string","description":"The step ID to redirect to when this outlet is triggered."}},"required":["name","description"]},"StepLeadAiConversationToolDto":{"type":"object","properties":{"appId":{"type":"string","description":"The ID of the app associated with the tool."},"moduleId":{"type":"string","description":"The ID of the module within the app."},"description":{"type":"string","description":"A description of what the tool does."},"name":{"type":"string","pattern":"/^[a-zA-Z][a-zA-Z0-9_]*$/","description":"The name of the tool."}},"required":["appId","moduleId","description","name"]},"StepContactDataDto":{"type":"object","properties":{"values":{"type":"string","description":"The values to set for contact data."}},"required":["values"]},"StepAiConfigDto":{"type":"object","properties":{"model":{"type":"number","description":"The AI model to use.\n\n- `1`: GEMINI_25_FLASH","enum":[1]},"thinkingBudget":{"type":"number","description":"Budget for the \"thinking\" process in tokens."},"seed":{"type":"number","description":"Seed for reproducible results."},"topP":{"type":"number","description":"Top-P value for generation."},"temperature":{"type":"number","description":"Temperature for generation creativity."}},"required":["model"]},"StepConversationDataDto":{"type":"object","properties":{"name":{"type":"string","description":"The name of the conversation."},"language":{"type":"string","description":"The language of the conversation."}},"required":["name","language"]},"StepResponseDto":{"type":"object","properties":{"step":{"description":"The retrieved step.","allOf":[{"$ref":"#/components/schemas/StepDto"}]}}},"StepDto":{"type":"object","properties":{"id":{"type":"string","description":"The unique identifier of the step."},"name":{"type":"string","description":"The name of the step."},"created":{"type":"string","description":"The creation timestamp of the step."},"updated":{"type":"string","description":"The last update timestamp of the step."},"type":{"type":"string","description":"The type of the step (e.g., 'start', 'message', 'condition')."},"grid":{"description":"Grid coordinates for visual placement in the editor.","allOf":[{"$ref":"#/components/schemas/StepGridDto"}]},"elements":{"description":"A list of elements within this step.","type":"array","items":{"$ref":"#/components/schemas/StepElementDto"}},"intent":{"description":"Optional intent configuration for the step.","allOf":[{"$ref":"#/components/schemas/StepIntentDto"}]},"delay":{"description":"Optional delay configuration for the step.","allOf":[{"$ref":"#/components/schemas/StepDelayDto"}]},"split":{"description":"Optional split configuration for the step.","allOf":[{"$ref":"#/components/schemas/StepSplitDto"}]},"condition":{"description":"Optional condition configuration for the step.","allOf":[{"$ref":"#/components/schemas/StepConditionDto"}]},"flow":{"description":"Optional flow execution configuration for the step.","allOf":[{"$ref":"#/components/schemas/StepFlowDto"}]},"trigger":{"description":"Optional trigger configuration for the step.","allOf":[{"$ref":"#/components/schemas/StepTriggerDto"}]},"redirect":{"type":"string","description":"Optional step ID to redirect to."},"userInput":{"type":"string","description":"Optional user input prompt."},"userInputRequired":{"type":"boolean","description":"Whether user input is required for this step."},"context":{"description":"Optional context configuration for the step.","allOf":[{"$ref":"#/components/schemas/StepContextDto"}]},"app":{"description":"Optional app integration configuration for the step.","allOf":[{"$ref":"#/components/schemas/StepAppDto"}]},"description":{"type":"string","description":"An optional description for the step."},"entityDetection":{"description":"Optional entity detection configuration for the step.","allOf":[{"$ref":"#/components/schemas/StepEntityDetectionDto"}]},"userInputIsSensitive":{"type":"boolean","description":"Whether user input in this step is sensitive."},"runPrompt":{"description":"Optional run prompt configuration for the step.","allOf":[{"$ref":"#/components/schemas/StepRunPromptDto"}]},"leadAiConversation":{"description":"Optional Lead AI conversation configuration for the step.","allOf":[{"$ref":"#/components/schemas/StepLeadAiConversationDto"}]},"contactData":{"description":"Optional contact data configuration for the step.","allOf":[{"$ref":"#/components/schemas/StepContactDataDto"}]},"aiConfig":{"description":"Optional AI configuration for the step.","allOf":[{"$ref":"#/components/schemas/StepAiConfigDto"}]}},"required":["id","name","created","updated","type","grid","elements"]},"StepIntentDto":{"type":"object","properties":{"intentId":{"type":"string","description":"The ID of the associated intent."}},"required":["intentId"]},"StepTriggerDto":{"type":"object","properties":{"triggerId":{"type":"string","description":"The unique identifier of the trigger."},"event":{"type":"string","description":"The triggering event."},"payload":{"type":"string","description":"An optional payload value required for triggering."}},"required":["triggerId","event"]}}}}
```

## Retrieves a specific step

> \
> \
> \*\*Required Permission:\*\* \`chatbots.steps.get\`\
> \
> \*\*Resource:\*\* \`chatbots/:chatbotId\`

```json
{"openapi":"3.0.0","info":{"title":"ChatCaptain API","version":"1.0"},"tags":[{"name":"Chatbot steps","description":""}],"servers":[{"url":"https://api.chatcaptain.com","description":"Production"}],"security":[{},{}],"paths":{"/v1/chatbots/{chatbotId}/flows/{flowId}/steps/{stepId}":{"get":{"operationId":"ChatbotStepController_getStep[1]_v1","parameters":[{"name":"chatbotId","required":true,"in":"path","description":"The ID of the chatbot.","schema":{"type":"string"}},{"name":"flowId","required":true,"in":"path","description":"The ID of the flows.","schema":{"type":"string"}},{"name":"stepId","required":true,"in":"path","description":"The ID of the step to retrieve.","schema":{"type":"string"}}],"responses":{"200":{"description":"Details of the step.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GetStepResponseDto"}}}},"403":{"description":"Insufficient permissions."}},"summary":"Retrieves a specific step","tags":["Chatbot steps"],"description":"\n\n**Required Permission:** `chatbots.steps.get`\n\n**Resource:** `chatbots/:chatbotId`"}}},"components":{"schemas":{"GetStepResponseDto":{"type":"object","properties":{"step":{"description":"The retrieved step.","allOf":[{"$ref":"#/components/schemas/StepDto"}]},"error":{"type":"string","description":"Optional error message."}}},"StepDto":{"type":"object","properties":{"id":{"type":"string","description":"The unique identifier of the step."},"name":{"type":"string","description":"The name of the step."},"created":{"type":"string","description":"The creation timestamp of the step."},"updated":{"type":"string","description":"The last update timestamp of the step."},"type":{"type":"string","description":"The type of the step (e.g., 'start', 'message', 'condition')."},"grid":{"description":"Grid coordinates for visual placement in the editor.","allOf":[{"$ref":"#/components/schemas/StepGridDto"}]},"elements":{"description":"A list of elements within this step.","type":"array","items":{"$ref":"#/components/schemas/StepElementDto"}},"intent":{"description":"Optional intent configuration for the step.","allOf":[{"$ref":"#/components/schemas/StepIntentDto"}]},"delay":{"description":"Optional delay configuration for the step.","allOf":[{"$ref":"#/components/schemas/StepDelayDto"}]},"split":{"description":"Optional split configuration for the step.","allOf":[{"$ref":"#/components/schemas/StepSplitDto"}]},"condition":{"description":"Optional condition configuration for the step.","allOf":[{"$ref":"#/components/schemas/StepConditionDto"}]},"flow":{"description":"Optional flow execution configuration for the step.","allOf":[{"$ref":"#/components/schemas/StepFlowDto"}]},"trigger":{"description":"Optional trigger configuration for the step.","allOf":[{"$ref":"#/components/schemas/StepTriggerDto"}]},"redirect":{"type":"string","description":"Optional step ID to redirect to."},"userInput":{"type":"string","description":"Optional user input prompt."},"userInputRequired":{"type":"boolean","description":"Whether user input is required for this step."},"context":{"description":"Optional context configuration for the step.","allOf":[{"$ref":"#/components/schemas/StepContextDto"}]},"app":{"description":"Optional app integration configuration for the step.","allOf":[{"$ref":"#/components/schemas/StepAppDto"}]},"description":{"type":"string","description":"An optional description for the step."},"entityDetection":{"description":"Optional entity detection configuration for the step.","allOf":[{"$ref":"#/components/schemas/StepEntityDetectionDto"}]},"userInputIsSensitive":{"type":"boolean","description":"Whether user input in this step is sensitive."},"runPrompt":{"description":"Optional run prompt configuration for the step.","allOf":[{"$ref":"#/components/schemas/StepRunPromptDto"}]},"leadAiConversation":{"description":"Optional Lead AI conversation configuration for the step.","allOf":[{"$ref":"#/components/schemas/StepLeadAiConversationDto"}]},"contactData":{"description":"Optional contact data configuration for the step.","allOf":[{"$ref":"#/components/schemas/StepContactDataDto"}]},"aiConfig":{"description":"Optional AI configuration for the step.","allOf":[{"$ref":"#/components/schemas/StepAiConfigDto"}]}},"required":["id","name","created","updated","type","grid","elements"]},"StepGridDto":{"type":"object","properties":{"x":{"type":"number","description":"X-coordinate in the flow editor."},"y":{"type":"number","description":"Y-coordinate in the flow editor."}},"required":["x","y"]},"StepElementDto":{"type":"object","properties":{"type":{"type":"string","description":"The type of the step element (e.g., 'text', 'buttons')."},"content":{"description":"The content of the step element.","allOf":[{"$ref":"#/components/schemas/StepElementContentDto"}]}},"required":["type","content"]},"StepElementContentDto":{"type":"object","properties":{"text":{"description":"Text content for the step element.","allOf":[{"$ref":"#/components/schemas/StepElementContentTextDto"}]},"buttons":{"description":"Button content for the step element.","allOf":[{"$ref":"#/components/schemas/StepElementContentButtonDto"}]},"file":{"description":"File content for the step element.","allOf":[{"$ref":"#/components/schemas/StepElementContentFileDto"}]},"voiceHangup":{"description":"Voice hangup action for the step element.","allOf":[{"$ref":"#/components/schemas/StepElementContentVoiceHangupDto"}]},"voiceTransfer":{"description":"Voice transfer action for the step element.","allOf":[{"$ref":"#/components/schemas/StepElementContentVoiceTransferDto"}]},"agentHandover":{"description":"Agent handover action for the step element.","allOf":[{"$ref":"#/components/schemas/StepElementContentAgentHandoverDto"}]},"assignVariable":{"description":"Assign variable action for the step element.","allOf":[{"$ref":"#/components/schemas/StepElementContentAssignVariableDto"}]},"updateTags":{"description":"Update tags action for the step element.","allOf":[{"$ref":"#/components/schemas/StepElementContentUpdateTagsDto"}]},"snooze":{"description":"Snooze action for the step element.","allOf":[{"$ref":"#/components/schemas/StepElementContentSnoozeDto"}]},"unread":{"description":"Unread action for the step element.","allOf":[{"$ref":"#/components/schemas/StepElementContentUnreadDto"}]},"whatsappTemplate":{"description":"WhatsApp template content for the step element.","allOf":[{"$ref":"#/components/schemas/StepElementContentWhatsAppTemplateDto"}]},"textToSpeech":{"description":"Text-to-speech content for the step element.","allOf":[{"$ref":"#/components/schemas/StepElementContentTextToSpeechDto"}]},"callSettings":{"description":"Call settings for the step element.","allOf":[{"$ref":"#/components/schemas/StepElementContentCallSettingsDto"}]},"metaWhatsappTemplate":{"description":"Meta WhatsApp template content for the step element.","allOf":[{"$ref":"#/components/schemas/StepElementContentMetaWhatsAppTemplateDto"}]},"note":{"description":"Note content for the step element.","allOf":[{"$ref":"#/components/schemas/StepElementContentNoteDto"}]},"chatEnd":{"description":"Chat end action for the step element.","allOf":[{"$ref":"#/components/schemas/StepElementContentChatEndDto"}]},"assignTeam":{"description":"Assign team action for the step element.","allOf":[{"$ref":"#/components/schemas/StepElementContentAssignTeamDto"}]},"assignOperator":{"description":"Assign operator action for the step element.","allOf":[{"$ref":"#/components/schemas/StepElementContentAssignOperatorDto"}]}}},"StepElementContentTextDto":{"type":"object","properties":{"text":{"type":"object","description":"The text content, localized by language key.","additionalProperties":{"type":"string"}}},"required":["text"]},"StepElementContentButtonDto":{"type":"object","properties":{"buttons":{"description":"A list of buttons to display.","type":"array","items":{"$ref":"#/components/schemas/StepElementContentButtonButtonDto"}}},"required":["buttons"]},"StepElementContentButtonButtonDto":{"type":"object","properties":{"text":{"type":"object","description":"The text displayed on the button, localized.","additionalProperties":{"type":"string"}},"value":{"type":"string","description":"The value associated with the button."},"type":{"type":"string","description":"The type of button (e.g., 'redirect', 'postback')."},"payload":{"type":"string","description":"An optional payload for postback buttons."}},"required":["text","value","type"]},"StepElementContentFileDto":{"type":"object","properties":{"name":{"type":"string","description":"The name of the file."},"bucketId":{"type":"string","description":"The ID of the bucket where the file is stored."},"objectId":{"type":"string","description":"The object ID of the file within the bucket."},"mimeType":{"type":"string","description":"The MIME type of the file."},"sizeInByte":{"type":"number","description":"The size of the file in bytes."},"fbaId":{"type":"string","description":"Facebook attachment ID (optional)."},"waaId":{"type":"string","description":"WhatsApp attachment ID (optional)."}},"required":["name","bucketId","objectId","mimeType","sizeInByte"]},"StepElementContentVoiceHangupDto":{"type":"object","properties":{"reason":{"type":"string","description":"The reason for hanging up the voice call."},"headers":{"type":"object","description":"Custom headers to send with the hangup event.","additionalProperties":{"type":"string"}}},"required":["reason","headers"]},"StepElementContentVoiceTransferDto":{"type":"object","properties":{"target":{"type":"string","description":"The target for the voice transfer (e.g., a phone number)."},"reason":{"type":"string","description":"An optional reason for the voice transfer."},"headers":{"type":"object","description":"Custom headers to send with the voice transfer.","additionalProperties":{"type":"string"}}},"required":["target","headers"]},"StepElementContentAgentHandoverDto":{"type":"object","properties":{"reason":{"type":"string","description":"An optional reason for the agent handover."},"timeoutSeconds":{"type":"number","description":"Timeout in seconds for the agent to accept the handover."},"agentId":{"type":"string","description":"The ID of the specific agent to hand over to."},"groupId":{"type":"string","description":"The ID of the agent group to hand over to."},"assignmentMethod":{"type":"string","description":"The method used for assigning the agent."}}},"StepElementContentAssignVariableDto":{"type":"object","properties":{"variableId":{"type":"string","description":"The ID of the variable to assign a value to."},"path":{"type":"string","description":"Optional JSON path within the variable to assign the value."},"value":{"type":"string","description":"The value to assign to the variable."}},"required":["variableId"]},"StepElementContentUpdateTagsDto":{"type":"object","properties":{"method":{"type":"string","description":"The method to update tags ('add' or 'remove').","enum":["add","remove"]},"tagId":{"type":"string","description":"The ID of the tag to add or remove."}},"required":["method","tagId"]},"StepElementContentSnoozeDto":{"type":"object","properties":{"seconds":{"type":"number","description":"The duration in seconds to snooze the conversation."}},"required":["seconds"]},"StepElementContentUnreadDto":{"type":"object","properties":{"unread":{"type":"boolean","description":"Whether to mark the conversation as unread."}},"required":["unread"]},"StepElementContentWhatsAppTemplateDto":{"type":"object","properties":{"templateId":{"type":"string","description":"The ID of the WhatsApp template to send."},"parameters":{"type":"object","description":"Parameters to populate the WhatsApp template.","additionalProperties":{"type":"string"}}},"required":["templateId","parameters"]},"StepElementContentTextToSpeechDto":{"type":"object","properties":{"text":{"type":"object","description":"The text content for text-to-speech, localized.","additionalProperties":{"type":"string"}},"speech":{"type":"string","description":"Optional SSML speech markup."}},"required":["text"]},"StepElementContentCallSettingsDto":{"type":"object","properties":{"userInputSpeechDetectionTimeout":{"type":"number","description":"Timeout for user speech detection in milliseconds."},"dtmf":{"type":"boolean","description":"Whether DTMF (Dual-tone multi-frequency) input is enabled."},"bargeIn":{"type":"boolean","description":"Whether barge-in is enabled (user can interrupt bot)."}}},"StepElementContentMetaWhatsAppTemplateDto":{"type":"object","properties":{"templateName":{"type":"string","description":"The name of the Meta WhatsApp template."},"templateId":{"type":"string","description":"The ID of the Meta WhatsApp template."},"header":{"description":"Header configuration for the Meta WhatsApp template.","allOf":[{"$ref":"#/components/schemas/StepElementContentMetaWhatsAppTemplateHeaderDto"}]},"bodyParameters":{"description":"Parameters for the body of the Meta WhatsApp template.","type":"array","items":{"type":"string"}},"buttons":{"description":"Button configurations for the Meta WhatsApp template.","allOf":[{"$ref":"#/components/schemas/StepElementContentMetaWhatsAppTemplateButtonsDto"}]}},"required":["templateName","templateId","bodyParameters"]},"StepElementContentMetaWhatsAppTemplateHeaderDto":{"type":"object","properties":{"file":{"description":"The file used in the template header.","allOf":[{"$ref":"#/components/schemas/StepElementContentFileDto"}]},"parameters":{"description":"Parameters for the header text.","type":"array","items":{"type":"string"}}},"required":["parameters"]},"StepElementContentMetaWhatsAppTemplateButtonsDto":{"type":"object","properties":{"values":{"description":"Values for the buttons in the template.","type":"array","items":{"type":"string"}}},"required":["values"]},"StepElementContentNoteDto":{"type":"object","properties":{"note":{"type":"string","description":"A private note for internal use."}},"required":["note"]},"StepElementContentChatEndDto":{"type":"object","properties":{"status":{"description":"The status to set for the conversation.\n\n- `0`: OPEN\n- `1`: BOT\n- `2`: IN_PROGRESS\n- `3`: CLOSED","allOf":[{"$ref":"#/components/schemas/StepElementContentChatEnd_ConversationStatus"}]}},"required":["status"]},"StepElementContentChatEnd_ConversationStatus":{"type":"number","enum":[0,1,2,3,-1],"description":"The status to set for the conversation.\n\n- `0`: OPEN\n- `1`: BOT\n- `2`: IN_PROGRESS\n- `3`: CLOSED"},"StepElementContentAssignTeamDto":{"type":"object","properties":{"teamId":{"type":"string","description":"The ID of the team to assign the conversation to."}},"required":["teamId"]},"StepElementContentAssignOperatorDto":{"type":"object","properties":{"operatorId":{"type":"string","description":"The ID of the operator to assign the conversation to."},"assignToLastAssigned":{"type":"boolean","description":"Whether to assign to the last assigned operator."}},"required":["assignToLastAssigned"]},"StepIntentDto":{"type":"object","properties":{"intentId":{"type":"string","description":"The ID of the associated intent."}},"required":["intentId"]},"StepDelayDto":{"type":"object","properties":{"seconds":{"type":"number","description":"The waiting time in seconds."}},"required":["seconds"]},"StepSplitDto":{"type":"object","properties":{"a":{"type":"number","description":"Percentage for exit A."},"b":{"type":"number","description":"Percentage for exit B."},"sameRedirect":{"type":"boolean","description":"Indicates whether both exits should lead to the same destination."},"redirects":{"description":"The redirect configurations for split A and B.","allOf":[{"$ref":"#/components/schemas/StepSplitRedirectsDto"}]}},"required":["a","b","sameRedirect","redirects"]},"StepSplitRedirectsDto":{"type":"object","properties":{"a":{"type":"string","description":"The step ID for redirect A."},"b":{"type":"string","description":"The step ID for redirect B."}},"required":["a","b"]},"StepConditionDto":{"type":"object","properties":{"redirects":{"description":"The redirect configurations based on condition outcome.","allOf":[{"$ref":"#/components/schemas/StepConditionRedirectsDto"}]},"conditions":{"description":"A list of conditions to evaluate.","type":"array","items":{"$ref":"#/components/schemas/StepConditionConditionDto"}}},"required":["redirects","conditions"]},"StepConditionRedirectsDto":{"type":"object","properties":{"t":{"type":"string","description":"The step ID to redirect to if the condition is true."},"f":{"type":"string","description":"The step ID to redirect to if the condition is false."}},"required":["t","f"]},"StepConditionConditionDto":{"type":"object","properties":{"valueLeft":{"type":"string","description":"The left-hand side value for the condition."},"operator":{"type":"string","description":"The operator for the condition (e.g., '==', '>', '<')."},"valueRight":{"type":"string","description":"The right-hand side value for the condition."},"group":{"type":"number","description":"The group number for logical grouping of conditions."}},"required":["valueLeft","operator","valueRight","group"]},"StepFlowDto":{"type":"object","properties":{"outlets":{"type":"object","description":"Outlets of the flow, mapping names to step IDs.","additionalProperties":{"$ref":"#/components/schemas/StepFlowOutletDto"}},"flowId":{"type":"string","description":"The ID of the flow to execute."},"entryStepId":{"type":"string","description":"The ID of the entry step within the flow."},"redirects":{"type":"object","description":"Redirects based on flow outcomes.","additionalProperties":{"type":"string"}}},"required":["outlets","flowId","entryStepId","redirects"]},"StepFlowOutletDto":{"type":"object","properties":{"stepId":{"type":"string","description":"The ID of the step this outlet points to."},"name":{"type":"string","description":"The name of the flow outlet."}},"required":["stepId","name"]},"StepTriggerDto":{"type":"object","properties":{"triggerId":{"type":"string","description":"The unique identifier of the trigger."},"event":{"type":"string","description":"The triggering event."},"payload":{"type":"string","description":"An optional payload value required for triggering."}},"required":["triggerId","event"]},"StepContextDto":{"type":"object","properties":{"intents":{"description":"A list of intents to consider in this context.","type":"array","items":{"$ref":"#/components/schemas/StepContextIntentDto"}},"fallbackRedirect":{"type":"string","description":"The step ID to redirect to if no intent is matched."}},"required":["intents"]},"StepContextIntentDto":{"type":"object","properties":{"name":{"type":"string","description":"The name of the intent."},"intentId":{"type":"string","description":"The ID of the intent."},"redirect":{"type":"string","description":"The step ID to redirect to if this intent is matched."}},"required":["name","intentId"]},"StepAppDto":{"type":"object","properties":{"appId":{"type":"string","description":"The ID of the app to integrate."},"moduleId":{"type":"string","description":"The ID of the module within the app to execute."},"paramsJson":{"type":"string","format":"json","description":"Parameters for the app module in JSON format."}},"required":["appId","moduleId","paramsJson"]},"StepEntityDetectionDto":{"type":"object","properties":{"outputVariableId":{"type":"string","description":"The ID of the variable to store the detected entities."},"outputVariablePath":{"type":"string","description":"Optional JSON path within the output variable."},"prompt":{"type":"string","description":"The prompt for entity detection."}},"required":["outputVariableId","prompt","examples"]},"StepRunPromptDto":{"type":"object","properties":{"outputVariableId":{"type":"string","description":"The ID of the variable to store the prompt's output."},"outputVariablePath":{"type":"string","description":"Optional JSON path within the output variable."},"prompt":{"type":"string","description":"The prompt to run."},"includeConversationHistory":{"type":"boolean","description":"Whether to include conversation history in the prompt."},"useRag":{"type":"boolean","description":"Whether to use RAG (Retrieval Augmented Generation)."},"includeNotes":{"type":"boolean","description":"Whether to use notes in prompt context."},"knowledgeGroupIds":{"description":"List of knowledge group IDs for RAG.","type":"array","items":{"type":"string"}},"ragContextMessages":{"type":"number","description":"Number of context messages for RAG."},"contextMessageCount":{"type":"number","description":"Number of messages to include in the context."}},"required":["outputVariableId","prompt","knowledgeGroupIds"]},"StepLeadAiConversationDto":{"type":"object","properties":{"prompt":{"type":"string","description":"The initial prompt for the AI conversation."},"context":{"type":"string","description":"Additional context for the AI conversation."},"maxIterations":{"type":"number","description":"The maximum number of iterations for the AI conversation."},"ragContextMessages":{"type":"number","description":"Number of context messages for RAG."},"includeConversationHistory":{"type":"boolean","description":"Whether to include conversation history."},"outlets":{"description":"Outlets for different conversation paths.","type":"array","items":{"$ref":"#/components/schemas/StepLeadAiConversationOutletDto"}},"tools":{"description":"Tools available to the AI during the conversation.","type":"array","items":{"$ref":"#/components/schemas/StepLeadAiConversationToolDto"}},"useRag":{"type":"boolean","description":"Whether to use RAG (Retrieval Augmented Generation)."},"delayMin":{"type":"number","description":"Minimum delay in seconds before the next AI response."},"delayMax":{"type":"number","description":"Maximum delay in seconds before the next AI response."},"delay":{"type":"boolean","description":"Whether to apply a delay before the next AI response."},"knowledgeGroupIds":{"description":"List of knowledge group IDs for RAG.","type":"array","items":{"type":"string"}},"contextMessageCount":{"type":"number","description":"Number of messages to include in the context."}},"required":["prompt","maxIterations","outlets","tools","knowledgeGroupIds"]},"StepLeadAiConversationOutletDto":{"type":"object","properties":{"name":{"type":"string","description":"The name of the conversation outlet."},"description":{"type":"string","description":"A description of what this outlet does."},"redirect":{"type":"string","description":"The step ID to redirect to when this outlet is triggered."}},"required":["name","description"]},"StepLeadAiConversationToolDto":{"type":"object","properties":{"appId":{"type":"string","description":"The ID of the app associated with the tool."},"moduleId":{"type":"string","description":"The ID of the module within the app."},"description":{"type":"string","description":"A description of what the tool does."},"name":{"type":"string","pattern":"/^[a-zA-Z][a-zA-Z0-9_]*$/","description":"The name of the tool."}},"required":["appId","moduleId","description","name"]},"StepContactDataDto":{"type":"object","properties":{"values":{"type":"string","description":"The values to set for contact data."}},"required":["values"]},"StepAiConfigDto":{"type":"object","properties":{"model":{"type":"number","description":"The AI model to use.\n\n- `1`: GEMINI_25_FLASH","enum":[1]},"thinkingBudget":{"type":"number","description":"Budget for the \"thinking\" process in tokens."},"seed":{"type":"number","description":"Seed for reproducible results."},"topP":{"type":"number","description":"Top-P value for generation."},"temperature":{"type":"number","description":"Temperature for generation creativity."}},"required":["model"]}}}}
```

## Deletes a step

> \
> \
> \*\*Required Permission:\*\* \`chatbots.steps.delete\`\
> \
> \*\*Resource:\*\* \`chatbots/:chatbotId\`

```json
{"openapi":"3.0.0","info":{"title":"ChatCaptain API","version":"1.0"},"tags":[{"name":"Chatbot steps","description":""}],"servers":[{"url":"https://api.chatcaptain.com","description":"Production"}],"security":[{},{}],"paths":{"/v1/chatbots/{chatbotId}/flows/{flowId}/steps/{stepId}":{"delete":{"operationId":"ChatbotStepController_deleteStep[1]_v1","parameters":[{"name":"chatbotId","required":true,"in":"path","description":"The ID of the chatbot.","schema":{"type":"string"}},{"name":"flowId","required":true,"in":"path","description":"The ID of the flows.","schema":{"type":"string"}},{"name":"stepId","required":true,"in":"path","description":"The ID of the step to delete.","schema":{"type":"string"}}],"responses":{"200":{"description":"Result of the deletion process.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DeleteStepResponseDto"}}}},"403":{"description":"Insufficient permissions."}},"summary":"Deletes a step","tags":["Chatbot steps"],"description":"\n\n**Required Permission:** `chatbots.steps.delete`\n\n**Resource:** `chatbots/:chatbotId`"}}},"components":{"schemas":{"DeleteStepResponseDto":{"type":"object","properties":{"deleted":{"type":"boolean","description":"Indicates if the step was successfully deleted."},"error":{"type":"string","description":"Optional error message."}},"required":["deleted"]}}}}
```

## Updates an existing step

> \
> \
> \*\*Required Permission:\*\* \`chatbots.steps.edit\`\
> \
> \*\*Resource:\*\* \`chatbots/:chatbotId\`

```json
{"openapi":"3.0.0","info":{"title":"ChatCaptain API","version":"1.0"},"tags":[{"name":"Chatbot steps","description":""}],"servers":[{"url":"https://api.chatcaptain.com","description":"Production"}],"security":[{},{}],"paths":{"/v1/chatbots/{chatbotId}/flows/{flowId}/steps/{stepId}":{"patch":{"operationId":"ChatbotStepController_updateStep[1]_v1","parameters":[{"name":"chatbotId","required":true,"in":"path","description":"The ID of the chatbot.","schema":{"type":"string"}},{"name":"flowId","required":true,"in":"path","description":"The ID of the flows.","schema":{"type":"string"}},{"name":"stepId","required":true,"in":"path","description":"The ID of the step to update.","schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateStepRequestDto"}}}},"responses":{"200":{"description":"Step updated successfully.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/StepResponseDto"}}}},"400":{"description":"Invalid input data."},"403":{"description":"Insufficient permissions."}},"summary":"Updates an existing step","tags":["Chatbot steps"],"description":"\n\n**Required Permission:** `chatbots.steps.edit`\n\n**Resource:** `chatbots/:chatbotId`"}}},"components":{"schemas":{"UpdateStepRequestDto":{"type":"object","properties":{"name":{"type":"string","description":"The new name of the step."},"grid":{"description":"New grid coordinates for visual placement.","allOf":[{"$ref":"#/components/schemas/StepGridDto"}]},"elements":{"description":"A list of elements to update in the step.","default":[],"type":"array","items":{"$ref":"#/components/schemas/StepElementDto"}},"delay":{"description":"Optional delay configuration.","allOf":[{"$ref":"#/components/schemas/StepDelayDto"}]},"split":{"description":"Optional split configuration.","allOf":[{"$ref":"#/components/schemas/StepSplitDto"}]},"condition":{"description":"Optional condition configuration.","allOf":[{"$ref":"#/components/schemas/StepConditionDto"}]},"flow":{"description":"Optional flow execution configuration.","allOf":[{"$ref":"#/components/schemas/StepFlowDto"}]},"trigger":{"description":"Optional trigger configuration.","allOf":[{"$ref":"#/components/schemas/UpdateOrCreateStepTriggerDto"}]},"redirect":{"type":"string","description":"Optional step ID to redirect to."},"userInput":{"type":"string","description":"Optional user input redirect."},"userInputRequired":{"type":"boolean","description":"Whether user input is required for this step."},"context":{"description":"Optional context configuration.","allOf":[{"$ref":"#/components/schemas/StepContextDto"}]},"app":{"description":"Optional app integration configuration.","allOf":[{"$ref":"#/components/schemas/StepAppDto"}]},"entityDetection":{"description":"Optional entity detection configuration.","allOf":[{"$ref":"#/components/schemas/StepEntityDetectionDto"}]},"description":{"type":"string","description":"An optional description for the step."},"userInputIsSensitive":{"type":"boolean","description":"Whether user input in this step is sensitive."},"runPrompt":{"description":"Optional run prompt configuration.","allOf":[{"$ref":"#/components/schemas/StepRunPromptDto"}]},"leadAiConversation":{"description":"Optional Lead AI conversation configuration.","allOf":[{"$ref":"#/components/schemas/StepLeadAiConversationDto"}]},"intent":{"description":"Optional intent configuration for the step.","allOf":[{"$ref":"#/components/schemas/StepIntentDto"}]},"contactData":{"description":"Optional contact data configuration.","allOf":[{"$ref":"#/components/schemas/StepContactDataDto"}]},"aiConfig":{"description":"Optional AI configuration.","allOf":[{"$ref":"#/components/schemas/StepAiConfigDto"}]},"conversationData":{"description":"Optional conversation data.","allOf":[{"$ref":"#/components/schemas/StepConversationDataDto"}]}},"required":["elements"]},"StepGridDto":{"type":"object","properties":{"x":{"type":"number","description":"X-coordinate in the flow editor."},"y":{"type":"number","description":"Y-coordinate in the flow editor."}},"required":["x","y"]},"StepElementDto":{"type":"object","properties":{"type":{"type":"string","description":"The type of the step element (e.g., 'text', 'buttons')."},"content":{"description":"The content of the step element.","allOf":[{"$ref":"#/components/schemas/StepElementContentDto"}]}},"required":["type","content"]},"StepElementContentDto":{"type":"object","properties":{"text":{"description":"Text content for the step element.","allOf":[{"$ref":"#/components/schemas/StepElementContentTextDto"}]},"buttons":{"description":"Button content for the step element.","allOf":[{"$ref":"#/components/schemas/StepElementContentButtonDto"}]},"file":{"description":"File content for the step element.","allOf":[{"$ref":"#/components/schemas/StepElementContentFileDto"}]},"voiceHangup":{"description":"Voice hangup action for the step element.","allOf":[{"$ref":"#/components/schemas/StepElementContentVoiceHangupDto"}]},"voiceTransfer":{"description":"Voice transfer action for the step element.","allOf":[{"$ref":"#/components/schemas/StepElementContentVoiceTransferDto"}]},"agentHandover":{"description":"Agent handover action for the step element.","allOf":[{"$ref":"#/components/schemas/StepElementContentAgentHandoverDto"}]},"assignVariable":{"description":"Assign variable action for the step element.","allOf":[{"$ref":"#/components/schemas/StepElementContentAssignVariableDto"}]},"updateTags":{"description":"Update tags action for the step element.","allOf":[{"$ref":"#/components/schemas/StepElementContentUpdateTagsDto"}]},"snooze":{"description":"Snooze action for the step element.","allOf":[{"$ref":"#/components/schemas/StepElementContentSnoozeDto"}]},"unread":{"description":"Unread action for the step element.","allOf":[{"$ref":"#/components/schemas/StepElementContentUnreadDto"}]},"whatsappTemplate":{"description":"WhatsApp template content for the step element.","allOf":[{"$ref":"#/components/schemas/StepElementContentWhatsAppTemplateDto"}]},"textToSpeech":{"description":"Text-to-speech content for the step element.","allOf":[{"$ref":"#/components/schemas/StepElementContentTextToSpeechDto"}]},"callSettings":{"description":"Call settings for the step element.","allOf":[{"$ref":"#/components/schemas/StepElementContentCallSettingsDto"}]},"metaWhatsappTemplate":{"description":"Meta WhatsApp template content for the step element.","allOf":[{"$ref":"#/components/schemas/StepElementContentMetaWhatsAppTemplateDto"}]},"note":{"description":"Note content for the step element.","allOf":[{"$ref":"#/components/schemas/StepElementContentNoteDto"}]},"chatEnd":{"description":"Chat end action for the step element.","allOf":[{"$ref":"#/components/schemas/StepElementContentChatEndDto"}]},"assignTeam":{"description":"Assign team action for the step element.","allOf":[{"$ref":"#/components/schemas/StepElementContentAssignTeamDto"}]},"assignOperator":{"description":"Assign operator action for the step element.","allOf":[{"$ref":"#/components/schemas/StepElementContentAssignOperatorDto"}]}}},"StepElementContentTextDto":{"type":"object","properties":{"text":{"type":"object","description":"The text content, localized by language key.","additionalProperties":{"type":"string"}}},"required":["text"]},"StepElementContentButtonDto":{"type":"object","properties":{"buttons":{"description":"A list of buttons to display.","type":"array","items":{"$ref":"#/components/schemas/StepElementContentButtonButtonDto"}}},"required":["buttons"]},"StepElementContentButtonButtonDto":{"type":"object","properties":{"text":{"type":"object","description":"The text displayed on the button, localized.","additionalProperties":{"type":"string"}},"value":{"type":"string","description":"The value associated with the button."},"type":{"type":"string","description":"The type of button (e.g., 'redirect', 'postback')."},"payload":{"type":"string","description":"An optional payload for postback buttons."}},"required":["text","value","type"]},"StepElementContentFileDto":{"type":"object","properties":{"name":{"type":"string","description":"The name of the file."},"bucketId":{"type":"string","description":"The ID of the bucket where the file is stored."},"objectId":{"type":"string","description":"The object ID of the file within the bucket."},"mimeType":{"type":"string","description":"The MIME type of the file."},"sizeInByte":{"type":"number","description":"The size of the file in bytes."},"fbaId":{"type":"string","description":"Facebook attachment ID (optional)."},"waaId":{"type":"string","description":"WhatsApp attachment ID (optional)."}},"required":["name","bucketId","objectId","mimeType","sizeInByte"]},"StepElementContentVoiceHangupDto":{"type":"object","properties":{"reason":{"type":"string","description":"The reason for hanging up the voice call."},"headers":{"type":"object","description":"Custom headers to send with the hangup event.","additionalProperties":{"type":"string"}}},"required":["reason","headers"]},"StepElementContentVoiceTransferDto":{"type":"object","properties":{"target":{"type":"string","description":"The target for the voice transfer (e.g., a phone number)."},"reason":{"type":"string","description":"An optional reason for the voice transfer."},"headers":{"type":"object","description":"Custom headers to send with the voice transfer.","additionalProperties":{"type":"string"}}},"required":["target","headers"]},"StepElementContentAgentHandoverDto":{"type":"object","properties":{"reason":{"type":"string","description":"An optional reason for the agent handover."},"timeoutSeconds":{"type":"number","description":"Timeout in seconds for the agent to accept the handover."},"agentId":{"type":"string","description":"The ID of the specific agent to hand over to."},"groupId":{"type":"string","description":"The ID of the agent group to hand over to."},"assignmentMethod":{"type":"string","description":"The method used for assigning the agent."}}},"StepElementContentAssignVariableDto":{"type":"object","properties":{"variableId":{"type":"string","description":"The ID of the variable to assign a value to."},"path":{"type":"string","description":"Optional JSON path within the variable to assign the value."},"value":{"type":"string","description":"The value to assign to the variable."}},"required":["variableId"]},"StepElementContentUpdateTagsDto":{"type":"object","properties":{"method":{"type":"string","description":"The method to update tags ('add' or 'remove').","enum":["add","remove"]},"tagId":{"type":"string","description":"The ID of the tag to add or remove."}},"required":["method","tagId"]},"StepElementContentSnoozeDto":{"type":"object","properties":{"seconds":{"type":"number","description":"The duration in seconds to snooze the conversation."}},"required":["seconds"]},"StepElementContentUnreadDto":{"type":"object","properties":{"unread":{"type":"boolean","description":"Whether to mark the conversation as unread."}},"required":["unread"]},"StepElementContentWhatsAppTemplateDto":{"type":"object","properties":{"templateId":{"type":"string","description":"The ID of the WhatsApp template to send."},"parameters":{"type":"object","description":"Parameters to populate the WhatsApp template.","additionalProperties":{"type":"string"}}},"required":["templateId","parameters"]},"StepElementContentTextToSpeechDto":{"type":"object","properties":{"text":{"type":"object","description":"The text content for text-to-speech, localized.","additionalProperties":{"type":"string"}},"speech":{"type":"string","description":"Optional SSML speech markup."}},"required":["text"]},"StepElementContentCallSettingsDto":{"type":"object","properties":{"userInputSpeechDetectionTimeout":{"type":"number","description":"Timeout for user speech detection in milliseconds."},"dtmf":{"type":"boolean","description":"Whether DTMF (Dual-tone multi-frequency) input is enabled."},"bargeIn":{"type":"boolean","description":"Whether barge-in is enabled (user can interrupt bot)."}}},"StepElementContentMetaWhatsAppTemplateDto":{"type":"object","properties":{"templateName":{"type":"string","description":"The name of the Meta WhatsApp template."},"templateId":{"type":"string","description":"The ID of the Meta WhatsApp template."},"header":{"description":"Header configuration for the Meta WhatsApp template.","allOf":[{"$ref":"#/components/schemas/StepElementContentMetaWhatsAppTemplateHeaderDto"}]},"bodyParameters":{"description":"Parameters for the body of the Meta WhatsApp template.","type":"array","items":{"type":"string"}},"buttons":{"description":"Button configurations for the Meta WhatsApp template.","allOf":[{"$ref":"#/components/schemas/StepElementContentMetaWhatsAppTemplateButtonsDto"}]}},"required":["templateName","templateId","bodyParameters"]},"StepElementContentMetaWhatsAppTemplateHeaderDto":{"type":"object","properties":{"file":{"description":"The file used in the template header.","allOf":[{"$ref":"#/components/schemas/StepElementContentFileDto"}]},"parameters":{"description":"Parameters for the header text.","type":"array","items":{"type":"string"}}},"required":["parameters"]},"StepElementContentMetaWhatsAppTemplateButtonsDto":{"type":"object","properties":{"values":{"description":"Values for the buttons in the template.","type":"array","items":{"type":"string"}}},"required":["values"]},"StepElementContentNoteDto":{"type":"object","properties":{"note":{"type":"string","description":"A private note for internal use."}},"required":["note"]},"StepElementContentChatEndDto":{"type":"object","properties":{"status":{"description":"The status to set for the conversation.\n\n- `0`: OPEN\n- `1`: BOT\n- `2`: IN_PROGRESS\n- `3`: CLOSED","allOf":[{"$ref":"#/components/schemas/StepElementContentChatEnd_ConversationStatus"}]}},"required":["status"]},"StepElementContentChatEnd_ConversationStatus":{"type":"number","enum":[0,1,2,3,-1],"description":"The status to set for the conversation.\n\n- `0`: OPEN\n- `1`: BOT\n- `2`: IN_PROGRESS\n- `3`: CLOSED"},"StepElementContentAssignTeamDto":{"type":"object","properties":{"teamId":{"type":"string","description":"The ID of the team to assign the conversation to."}},"required":["teamId"]},"StepElementContentAssignOperatorDto":{"type":"object","properties":{"operatorId":{"type":"string","description":"The ID of the operator to assign the conversation to."},"assignToLastAssigned":{"type":"boolean","description":"Whether to assign to the last assigned operator."}},"required":["assignToLastAssigned"]},"StepDelayDto":{"type":"object","properties":{"seconds":{"type":"number","description":"The waiting time in seconds."}},"required":["seconds"]},"StepSplitDto":{"type":"object","properties":{"a":{"type":"number","description":"Percentage for exit A."},"b":{"type":"number","description":"Percentage for exit B."},"sameRedirect":{"type":"boolean","description":"Indicates whether both exits should lead to the same destination."},"redirects":{"description":"The redirect configurations for split A and B.","allOf":[{"$ref":"#/components/schemas/StepSplitRedirectsDto"}]}},"required":["a","b","sameRedirect","redirects"]},"StepSplitRedirectsDto":{"type":"object","properties":{"a":{"type":"string","description":"The step ID for redirect A."},"b":{"type":"string","description":"The step ID for redirect B."}},"required":["a","b"]},"StepConditionDto":{"type":"object","properties":{"redirects":{"description":"The redirect configurations based on condition outcome.","allOf":[{"$ref":"#/components/schemas/StepConditionRedirectsDto"}]},"conditions":{"description":"A list of conditions to evaluate.","type":"array","items":{"$ref":"#/components/schemas/StepConditionConditionDto"}}},"required":["redirects","conditions"]},"StepConditionRedirectsDto":{"type":"object","properties":{"t":{"type":"string","description":"The step ID to redirect to if the condition is true."},"f":{"type":"string","description":"The step ID to redirect to if the condition is false."}},"required":["t","f"]},"StepConditionConditionDto":{"type":"object","properties":{"valueLeft":{"type":"string","description":"The left-hand side value for the condition."},"operator":{"type":"string","description":"The operator for the condition (e.g., '==', '>', '<')."},"valueRight":{"type":"string","description":"The right-hand side value for the condition."},"group":{"type":"number","description":"The group number for logical grouping of conditions."}},"required":["valueLeft","operator","valueRight","group"]},"StepFlowDto":{"type":"object","properties":{"outlets":{"type":"object","description":"Outlets of the flow, mapping names to step IDs.","additionalProperties":{"$ref":"#/components/schemas/StepFlowOutletDto"}},"flowId":{"type":"string","description":"The ID of the flow to execute."},"entryStepId":{"type":"string","description":"The ID of the entry step within the flow."},"redirects":{"type":"object","description":"Redirects based on flow outcomes.","additionalProperties":{"type":"string"}}},"required":["outlets","flowId","entryStepId","redirects"]},"StepFlowOutletDto":{"type":"object","properties":{"stepId":{"type":"string","description":"The ID of the step this outlet points to."},"name":{"type":"string","description":"The name of the flow outlet."}},"required":["stepId","name"]},"UpdateOrCreateStepTriggerDto":{"type":"object","properties":{"event":{"type":"string","description":"The triggering event."},"payload":{"type":"string","description":"An optional payload value required for triggering."}},"required":["event"]},"StepContextDto":{"type":"object","properties":{"intents":{"description":"A list of intents to consider in this context.","type":"array","items":{"$ref":"#/components/schemas/StepContextIntentDto"}},"fallbackRedirect":{"type":"string","description":"The step ID to redirect to if no intent is matched."}},"required":["intents"]},"StepContextIntentDto":{"type":"object","properties":{"name":{"type":"string","description":"The name of the intent."},"intentId":{"type":"string","description":"The ID of the intent."},"redirect":{"type":"string","description":"The step ID to redirect to if this intent is matched."}},"required":["name","intentId"]},"StepAppDto":{"type":"object","properties":{"appId":{"type":"string","description":"The ID of the app to integrate."},"moduleId":{"type":"string","description":"The ID of the module within the app to execute."},"paramsJson":{"type":"string","format":"json","description":"Parameters for the app module in JSON format."}},"required":["appId","moduleId","paramsJson"]},"StepEntityDetectionDto":{"type":"object","properties":{"outputVariableId":{"type":"string","description":"The ID of the variable to store the detected entities."},"outputVariablePath":{"type":"string","description":"Optional JSON path within the output variable."},"prompt":{"type":"string","description":"The prompt for entity detection."}},"required":["outputVariableId","prompt","examples"]},"StepRunPromptDto":{"type":"object","properties":{"outputVariableId":{"type":"string","description":"The ID of the variable to store the prompt's output."},"outputVariablePath":{"type":"string","description":"Optional JSON path within the output variable."},"prompt":{"type":"string","description":"The prompt to run."},"includeConversationHistory":{"type":"boolean","description":"Whether to include conversation history in the prompt."},"useRag":{"type":"boolean","description":"Whether to use RAG (Retrieval Augmented Generation)."},"includeNotes":{"type":"boolean","description":"Whether to use notes in prompt context."},"knowledgeGroupIds":{"description":"List of knowledge group IDs for RAG.","type":"array","items":{"type":"string"}},"ragContextMessages":{"type":"number","description":"Number of context messages for RAG."},"contextMessageCount":{"type":"number","description":"Number of messages to include in the context."}},"required":["outputVariableId","prompt","knowledgeGroupIds"]},"StepLeadAiConversationDto":{"type":"object","properties":{"prompt":{"type":"string","description":"The initial prompt for the AI conversation."},"context":{"type":"string","description":"Additional context for the AI conversation."},"maxIterations":{"type":"number","description":"The maximum number of iterations for the AI conversation."},"ragContextMessages":{"type":"number","description":"Number of context messages for RAG."},"includeConversationHistory":{"type":"boolean","description":"Whether to include conversation history."},"outlets":{"description":"Outlets for different conversation paths.","type":"array","items":{"$ref":"#/components/schemas/StepLeadAiConversationOutletDto"}},"tools":{"description":"Tools available to the AI during the conversation.","type":"array","items":{"$ref":"#/components/schemas/StepLeadAiConversationToolDto"}},"useRag":{"type":"boolean","description":"Whether to use RAG (Retrieval Augmented Generation)."},"delayMin":{"type":"number","description":"Minimum delay in seconds before the next AI response."},"delayMax":{"type":"number","description":"Maximum delay in seconds before the next AI response."},"delay":{"type":"boolean","description":"Whether to apply a delay before the next AI response."},"knowledgeGroupIds":{"description":"List of knowledge group IDs for RAG.","type":"array","items":{"type":"string"}},"contextMessageCount":{"type":"number","description":"Number of messages to include in the context."}},"required":["prompt","maxIterations","outlets","tools","knowledgeGroupIds"]},"StepLeadAiConversationOutletDto":{"type":"object","properties":{"name":{"type":"string","description":"The name of the conversation outlet."},"description":{"type":"string","description":"A description of what this outlet does."},"redirect":{"type":"string","description":"The step ID to redirect to when this outlet is triggered."}},"required":["name","description"]},"StepLeadAiConversationToolDto":{"type":"object","properties":{"appId":{"type":"string","description":"The ID of the app associated with the tool."},"moduleId":{"type":"string","description":"The ID of the module within the app."},"description":{"type":"string","description":"A description of what the tool does."},"name":{"type":"string","pattern":"/^[a-zA-Z][a-zA-Z0-9_]*$/","description":"The name of the tool."}},"required":["appId","moduleId","description","name"]},"StepIntentDto":{"type":"object","properties":{"intentId":{"type":"string","description":"The ID of the associated intent."}},"required":["intentId"]},"StepContactDataDto":{"type":"object","properties":{"values":{"type":"string","description":"The values to set for contact data."}},"required":["values"]},"StepAiConfigDto":{"type":"object","properties":{"model":{"type":"number","description":"The AI model to use.\n\n- `1`: GEMINI_25_FLASH","enum":[1]},"thinkingBudget":{"type":"number","description":"Budget for the \"thinking\" process in tokens."},"seed":{"type":"number","description":"Seed for reproducible results."},"topP":{"type":"number","description":"Top-P value for generation."},"temperature":{"type":"number","description":"Temperature for generation creativity."}},"required":["model"]},"StepConversationDataDto":{"type":"object","properties":{"name":{"type":"string","description":"The name of the conversation."},"language":{"type":"string","description":"The language of the conversation."}},"required":["name","language"]},"StepResponseDto":{"type":"object","properties":{"step":{"description":"The retrieved step.","allOf":[{"$ref":"#/components/schemas/StepDto"}]}}},"StepDto":{"type":"object","properties":{"id":{"type":"string","description":"The unique identifier of the step."},"name":{"type":"string","description":"The name of the step."},"created":{"type":"string","description":"The creation timestamp of the step."},"updated":{"type":"string","description":"The last update timestamp of the step."},"type":{"type":"string","description":"The type of the step (e.g., 'start', 'message', 'condition')."},"grid":{"description":"Grid coordinates for visual placement in the editor.","allOf":[{"$ref":"#/components/schemas/StepGridDto"}]},"elements":{"description":"A list of elements within this step.","type":"array","items":{"$ref":"#/components/schemas/StepElementDto"}},"intent":{"description":"Optional intent configuration for the step.","allOf":[{"$ref":"#/components/schemas/StepIntentDto"}]},"delay":{"description":"Optional delay configuration for the step.","allOf":[{"$ref":"#/components/schemas/StepDelayDto"}]},"split":{"description":"Optional split configuration for the step.","allOf":[{"$ref":"#/components/schemas/StepSplitDto"}]},"condition":{"description":"Optional condition configuration for the step.","allOf":[{"$ref":"#/components/schemas/StepConditionDto"}]},"flow":{"description":"Optional flow execution configuration for the step.","allOf":[{"$ref":"#/components/schemas/StepFlowDto"}]},"trigger":{"description":"Optional trigger configuration for the step.","allOf":[{"$ref":"#/components/schemas/StepTriggerDto"}]},"redirect":{"type":"string","description":"Optional step ID to redirect to."},"userInput":{"type":"string","description":"Optional user input prompt."},"userInputRequired":{"type":"boolean","description":"Whether user input is required for this step."},"context":{"description":"Optional context configuration for the step.","allOf":[{"$ref":"#/components/schemas/StepContextDto"}]},"app":{"description":"Optional app integration configuration for the step.","allOf":[{"$ref":"#/components/schemas/StepAppDto"}]},"description":{"type":"string","description":"An optional description for the step."},"entityDetection":{"description":"Optional entity detection configuration for the step.","allOf":[{"$ref":"#/components/schemas/StepEntityDetectionDto"}]},"userInputIsSensitive":{"type":"boolean","description":"Whether user input in this step is sensitive."},"runPrompt":{"description":"Optional run prompt configuration for the step.","allOf":[{"$ref":"#/components/schemas/StepRunPromptDto"}]},"leadAiConversation":{"description":"Optional Lead AI conversation configuration for the step.","allOf":[{"$ref":"#/components/schemas/StepLeadAiConversationDto"}]},"contactData":{"description":"Optional contact data configuration for the step.","allOf":[{"$ref":"#/components/schemas/StepContactDataDto"}]},"aiConfig":{"description":"Optional AI configuration for the step.","allOf":[{"$ref":"#/components/schemas/StepAiConfigDto"}]}},"required":["id","name","created","updated","type","grid","elements"]},"StepTriggerDto":{"type":"object","properties":{"triggerId":{"type":"string","description":"The unique identifier of the trigger."},"event":{"type":"string","description":"The triggering event."},"payload":{"type":"string","description":"An optional payload value required for triggering."}},"required":["triggerId","event"]}}}}
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.chatcaptain.com/api/api-dokumentation/chatbot-steps.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
