import Retell from 'retell-sdk';
const client = new Retell({
apiKey: process.env['RETELL_API_KEY'], // This is the default and can be omitted
});
const conversationFlowComponentResponse = await client.conversationFlowComponent.create({
name: 'Customer Information Collector',
nodes: [
{
id: 'collect_info',
instruction: {
text: 'Ask the customer for their name and contact information.',
type: 'prompt',
},
type: 'conversation',
},
],
});
console.log(conversationFlowComponentResponse.conversation_flow_component_id);import os
from retell import Retell
client = Retell(
api_key=os.environ.get("RETELL_API_KEY"), # This is the default and can be omitted
)
conversation_flow_component_response = client.conversation_flow_component.create(
name="Customer Information Collector",
nodes=[{
"id": "collect_info",
"instruction": {
"text": "Ask the customer for their name and contact information.",
"type": "prompt",
},
"type": "conversation",
}],
)
print(conversation_flow_component_response.conversation_flow_component_id)curl --request POST \
--url https://api.retellai.com/create-conversation-flow-component \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "Customer Information Collector",
"nodes": [
{
"id": "collect_info",
"type": "conversation",
"instruction": {
"type": "prompt",
"text": "Ask the customer for their name and contact information."
}
}
],
"flex_mode": false,
"tools": [
{
"type": "custom",
"name": "get_customer_info",
"description": "Get customer information from database",
"tool_id": "tool_001",
"url": "https://api.example.com/customer",
"method": "GET"
}
],
"mcps": [
{
"name": "<string>",
"url": "<string>",
"headers": {
"Authorization": "Bearer 1234567890"
},
"query_params": {
"index": "1",
"key": "value"
},
"timeout_ms": 123
}
],
"start_node_id": "collect_info",
"begin_tag_display_position": {
"x": 100,
"y": 200
},
"notes": [
{
"id": "note_abc123",
"content": "Remember to handle edge cases here.",
"display_position": {
"x": 300,
"y": 150
},
"size": {
"width": 200,
"height": 100
}
}
]
}
'<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.retellai.com/create-conversation-flow-component",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'name' => 'Customer Information Collector',
'nodes' => [
[
'id' => 'collect_info',
'type' => 'conversation',
'instruction' => [
'type' => 'prompt',
'text' => 'Ask the customer for their name and contact information.'
]
]
],
'flex_mode' => false,
'tools' => [
[
'type' => 'custom',
'name' => 'get_customer_info',
'description' => 'Get customer information from database',
'tool_id' => 'tool_001',
'url' => 'https://api.example.com/customer',
'method' => 'GET'
]
],
'mcps' => [
[
'name' => '<string>',
'url' => '<string>',
'headers' => [
'Authorization' => 'Bearer 1234567890'
],
'query_params' => [
'index' => '1',
'key' => 'value'
],
'timeout_ms' => 123
]
],
'start_node_id' => 'collect_info',
'begin_tag_display_position' => [
'x' => 100,
'y' => 200
],
'notes' => [
[
'id' => 'note_abc123',
'content' => 'Remember to handle edge cases here.',
'display_position' => [
'x' => 300,
'y' => 150
],
'size' => [
'width' => 200,
'height' => 100
]
]
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.retellai.com/create-conversation-flow-component"
payload := strings.NewReader("{\n \"name\": \"Customer Information Collector\",\n \"nodes\": [\n {\n \"id\": \"collect_info\",\n \"type\": \"conversation\",\n \"instruction\": {\n \"type\": \"prompt\",\n \"text\": \"Ask the customer for their name and contact information.\"\n }\n }\n ],\n \"flex_mode\": false,\n \"tools\": [\n {\n \"type\": \"custom\",\n \"name\": \"get_customer_info\",\n \"description\": \"Get customer information from database\",\n \"tool_id\": \"tool_001\",\n \"url\": \"https://api.example.com/customer\",\n \"method\": \"GET\"\n }\n ],\n \"mcps\": [\n {\n \"name\": \"<string>\",\n \"url\": \"<string>\",\n \"headers\": {\n \"Authorization\": \"Bearer 1234567890\"\n },\n \"query_params\": {\n \"index\": \"1\",\n \"key\": \"value\"\n },\n \"timeout_ms\": 123\n }\n ],\n \"start_node_id\": \"collect_info\",\n \"begin_tag_display_position\": {\n \"x\": 100,\n \"y\": 200\n },\n \"notes\": [\n {\n \"id\": \"note_abc123\",\n \"content\": \"Remember to handle edge cases here.\",\n \"display_position\": {\n \"x\": 300,\n \"y\": 150\n },\n \"size\": {\n \"width\": 200,\n \"height\": 100\n }\n }\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.retellai.com/create-conversation-flow-component")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"Customer Information Collector\",\n \"nodes\": [\n {\n \"id\": \"collect_info\",\n \"type\": \"conversation\",\n \"instruction\": {\n \"type\": \"prompt\",\n \"text\": \"Ask the customer for their name and contact information.\"\n }\n }\n ],\n \"flex_mode\": false,\n \"tools\": [\n {\n \"type\": \"custom\",\n \"name\": \"get_customer_info\",\n \"description\": \"Get customer information from database\",\n \"tool_id\": \"tool_001\",\n \"url\": \"https://api.example.com/customer\",\n \"method\": \"GET\"\n }\n ],\n \"mcps\": [\n {\n \"name\": \"<string>\",\n \"url\": \"<string>\",\n \"headers\": {\n \"Authorization\": \"Bearer 1234567890\"\n },\n \"query_params\": {\n \"index\": \"1\",\n \"key\": \"value\"\n },\n \"timeout_ms\": 123\n }\n ],\n \"start_node_id\": \"collect_info\",\n \"begin_tag_display_position\": {\n \"x\": 100,\n \"y\": 200\n },\n \"notes\": [\n {\n \"id\": \"note_abc123\",\n \"content\": \"Remember to handle edge cases here.\",\n \"display_position\": {\n \"x\": 300,\n \"y\": 150\n },\n \"size\": {\n \"width\": 200,\n \"height\": 100\n }\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.retellai.com/create-conversation-flow-component")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"Customer Information Collector\",\n \"nodes\": [\n {\n \"id\": \"collect_info\",\n \"type\": \"conversation\",\n \"instruction\": {\n \"type\": \"prompt\",\n \"text\": \"Ask the customer for their name and contact information.\"\n }\n }\n ],\n \"flex_mode\": false,\n \"tools\": [\n {\n \"type\": \"custom\",\n \"name\": \"get_customer_info\",\n \"description\": \"Get customer information from database\",\n \"tool_id\": \"tool_001\",\n \"url\": \"https://api.example.com/customer\",\n \"method\": \"GET\"\n }\n ],\n \"mcps\": [\n {\n \"name\": \"<string>\",\n \"url\": \"<string>\",\n \"headers\": {\n \"Authorization\": \"Bearer 1234567890\"\n },\n \"query_params\": {\n \"index\": \"1\",\n \"key\": \"value\"\n },\n \"timeout_ms\": 123\n }\n ],\n \"start_node_id\": \"collect_info\",\n \"begin_tag_display_position\": {\n \"x\": 100,\n \"y\": 200\n },\n \"notes\": [\n {\n \"id\": \"note_abc123\",\n \"content\": \"Remember to handle edge cases here.\",\n \"display_position\": {\n \"x\": 300,\n \"y\": 150\n },\n \"size\": {\n \"width\": 200,\n \"height\": 100\n }\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"name": "Customer Information Collector",
"nodes": [
{
"id": "collect_info",
"type": "conversation",
"instruction": {
"type": "prompt",
"text": "Ask the customer for their name and contact information."
}
}
],
"conversation_flow_component_id": "<string>",
"user_modified_timestamp": 123,
"flex_mode": false,
"tools": [
{
"type": "custom",
"name": "get_customer_info",
"description": "Get customer information from database",
"tool_id": "tool_001",
"url": "https://api.example.com/customer",
"method": "GET"
}
],
"mcps": [
{
"name": "<string>",
"url": "<string>",
"headers": {
"Authorization": "Bearer 1234567890"
},
"query_params": {
"index": "1",
"key": "value"
},
"timeout_ms": 123
}
],
"start_node_id": "collect_info",
"begin_tag_display_position": {
"x": 100,
"y": 200
},
"notes": [
{
"id": "note_abc123",
"content": "Remember to handle edge cases here.",
"display_position": {
"x": 300,
"y": 150
},
"size": {
"width": 200,
"height": 100
}
}
],
"linked_conversation_flow_ids": [
"<string>"
]
}{
"status": "error",
"message": "Invalid request format, please check API reference."
}{
"status": "error",
"message": "API key is missing or invalid."
}{
"status": "error",
"message": "The requested resource was not found."
}{
"status": "error",
"message": "Account rate limited, please throttle your requests."
}{
"status": "error",
"message": "An unexpected server error occurred."
}Create Conversation Flow Component
Create a new shared conversation flow component
import Retell from 'retell-sdk';
const client = new Retell({
apiKey: process.env['RETELL_API_KEY'], // This is the default and can be omitted
});
const conversationFlowComponentResponse = await client.conversationFlowComponent.create({
name: 'Customer Information Collector',
nodes: [
{
id: 'collect_info',
instruction: {
text: 'Ask the customer for their name and contact information.',
type: 'prompt',
},
type: 'conversation',
},
],
});
console.log(conversationFlowComponentResponse.conversation_flow_component_id);import os
from retell import Retell
client = Retell(
api_key=os.environ.get("RETELL_API_KEY"), # This is the default and can be omitted
)
conversation_flow_component_response = client.conversation_flow_component.create(
name="Customer Information Collector",
nodes=[{
"id": "collect_info",
"instruction": {
"text": "Ask the customer for their name and contact information.",
"type": "prompt",
},
"type": "conversation",
}],
)
print(conversation_flow_component_response.conversation_flow_component_id)curl --request POST \
--url https://api.retellai.com/create-conversation-flow-component \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "Customer Information Collector",
"nodes": [
{
"id": "collect_info",
"type": "conversation",
"instruction": {
"type": "prompt",
"text": "Ask the customer for their name and contact information."
}
}
],
"flex_mode": false,
"tools": [
{
"type": "custom",
"name": "get_customer_info",
"description": "Get customer information from database",
"tool_id": "tool_001",
"url": "https://api.example.com/customer",
"method": "GET"
}
],
"mcps": [
{
"name": "<string>",
"url": "<string>",
"headers": {
"Authorization": "Bearer 1234567890"
},
"query_params": {
"index": "1",
"key": "value"
},
"timeout_ms": 123
}
],
"start_node_id": "collect_info",
"begin_tag_display_position": {
"x": 100,
"y": 200
},
"notes": [
{
"id": "note_abc123",
"content": "Remember to handle edge cases here.",
"display_position": {
"x": 300,
"y": 150
},
"size": {
"width": 200,
"height": 100
}
}
]
}
'<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.retellai.com/create-conversation-flow-component",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'name' => 'Customer Information Collector',
'nodes' => [
[
'id' => 'collect_info',
'type' => 'conversation',
'instruction' => [
'type' => 'prompt',
'text' => 'Ask the customer for their name and contact information.'
]
]
],
'flex_mode' => false,
'tools' => [
[
'type' => 'custom',
'name' => 'get_customer_info',
'description' => 'Get customer information from database',
'tool_id' => 'tool_001',
'url' => 'https://api.example.com/customer',
'method' => 'GET'
]
],
'mcps' => [
[
'name' => '<string>',
'url' => '<string>',
'headers' => [
'Authorization' => 'Bearer 1234567890'
],
'query_params' => [
'index' => '1',
'key' => 'value'
],
'timeout_ms' => 123
]
],
'start_node_id' => 'collect_info',
'begin_tag_display_position' => [
'x' => 100,
'y' => 200
],
'notes' => [
[
'id' => 'note_abc123',
'content' => 'Remember to handle edge cases here.',
'display_position' => [
'x' => 300,
'y' => 150
],
'size' => [
'width' => 200,
'height' => 100
]
]
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.retellai.com/create-conversation-flow-component"
payload := strings.NewReader("{\n \"name\": \"Customer Information Collector\",\n \"nodes\": [\n {\n \"id\": \"collect_info\",\n \"type\": \"conversation\",\n \"instruction\": {\n \"type\": \"prompt\",\n \"text\": \"Ask the customer for their name and contact information.\"\n }\n }\n ],\n \"flex_mode\": false,\n \"tools\": [\n {\n \"type\": \"custom\",\n \"name\": \"get_customer_info\",\n \"description\": \"Get customer information from database\",\n \"tool_id\": \"tool_001\",\n \"url\": \"https://api.example.com/customer\",\n \"method\": \"GET\"\n }\n ],\n \"mcps\": [\n {\n \"name\": \"<string>\",\n \"url\": \"<string>\",\n \"headers\": {\n \"Authorization\": \"Bearer 1234567890\"\n },\n \"query_params\": {\n \"index\": \"1\",\n \"key\": \"value\"\n },\n \"timeout_ms\": 123\n }\n ],\n \"start_node_id\": \"collect_info\",\n \"begin_tag_display_position\": {\n \"x\": 100,\n \"y\": 200\n },\n \"notes\": [\n {\n \"id\": \"note_abc123\",\n \"content\": \"Remember to handle edge cases here.\",\n \"display_position\": {\n \"x\": 300,\n \"y\": 150\n },\n \"size\": {\n \"width\": 200,\n \"height\": 100\n }\n }\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.retellai.com/create-conversation-flow-component")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"Customer Information Collector\",\n \"nodes\": [\n {\n \"id\": \"collect_info\",\n \"type\": \"conversation\",\n \"instruction\": {\n \"type\": \"prompt\",\n \"text\": \"Ask the customer for their name and contact information.\"\n }\n }\n ],\n \"flex_mode\": false,\n \"tools\": [\n {\n \"type\": \"custom\",\n \"name\": \"get_customer_info\",\n \"description\": \"Get customer information from database\",\n \"tool_id\": \"tool_001\",\n \"url\": \"https://api.example.com/customer\",\n \"method\": \"GET\"\n }\n ],\n \"mcps\": [\n {\n \"name\": \"<string>\",\n \"url\": \"<string>\",\n \"headers\": {\n \"Authorization\": \"Bearer 1234567890\"\n },\n \"query_params\": {\n \"index\": \"1\",\n \"key\": \"value\"\n },\n \"timeout_ms\": 123\n }\n ],\n \"start_node_id\": \"collect_info\",\n \"begin_tag_display_position\": {\n \"x\": 100,\n \"y\": 200\n },\n \"notes\": [\n {\n \"id\": \"note_abc123\",\n \"content\": \"Remember to handle edge cases here.\",\n \"display_position\": {\n \"x\": 300,\n \"y\": 150\n },\n \"size\": {\n \"width\": 200,\n \"height\": 100\n }\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.retellai.com/create-conversation-flow-component")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"Customer Information Collector\",\n \"nodes\": [\n {\n \"id\": \"collect_info\",\n \"type\": \"conversation\",\n \"instruction\": {\n \"type\": \"prompt\",\n \"text\": \"Ask the customer for their name and contact information.\"\n }\n }\n ],\n \"flex_mode\": false,\n \"tools\": [\n {\n \"type\": \"custom\",\n \"name\": \"get_customer_info\",\n \"description\": \"Get customer information from database\",\n \"tool_id\": \"tool_001\",\n \"url\": \"https://api.example.com/customer\",\n \"method\": \"GET\"\n }\n ],\n \"mcps\": [\n {\n \"name\": \"<string>\",\n \"url\": \"<string>\",\n \"headers\": {\n \"Authorization\": \"Bearer 1234567890\"\n },\n \"query_params\": {\n \"index\": \"1\",\n \"key\": \"value\"\n },\n \"timeout_ms\": 123\n }\n ],\n \"start_node_id\": \"collect_info\",\n \"begin_tag_display_position\": {\n \"x\": 100,\n \"y\": 200\n },\n \"notes\": [\n {\n \"id\": \"note_abc123\",\n \"content\": \"Remember to handle edge cases here.\",\n \"display_position\": {\n \"x\": 300,\n \"y\": 150\n },\n \"size\": {\n \"width\": 200,\n \"height\": 100\n }\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"name": "Customer Information Collector",
"nodes": [
{
"id": "collect_info",
"type": "conversation",
"instruction": {
"type": "prompt",
"text": "Ask the customer for their name and contact information."
}
}
],
"conversation_flow_component_id": "<string>",
"user_modified_timestamp": 123,
"flex_mode": false,
"tools": [
{
"type": "custom",
"name": "get_customer_info",
"description": "Get customer information from database",
"tool_id": "tool_001",
"url": "https://api.example.com/customer",
"method": "GET"
}
],
"mcps": [
{
"name": "<string>",
"url": "<string>",
"headers": {
"Authorization": "Bearer 1234567890"
},
"query_params": {
"index": "1",
"key": "value"
},
"timeout_ms": 123
}
],
"start_node_id": "collect_info",
"begin_tag_display_position": {
"x": 100,
"y": 200
},
"notes": [
{
"id": "note_abc123",
"content": "Remember to handle edge cases here.",
"display_position": {
"x": 300,
"y": 150
},
"size": {
"width": 200,
"height": 100
}
}
],
"linked_conversation_flow_ids": [
"<string>"
]
}{
"status": "error",
"message": "Invalid request format, please check API reference."
}{
"status": "error",
"message": "API key is missing or invalid."
}{
"status": "error",
"message": "The requested resource was not found."
}{
"status": "error",
"message": "Account rate limited, please throttle your requests."
}{
"status": "error",
"message": "An unexpected server error occurred."
}Authorizations
Authentication header containing API key (find it in dashboard). The format is "Bearer YOUR_API_KEY"
Body
Name of the component
"Customer Information Collector"
Nodes that make up the component
Show child attributes
Show child attributes
[
{
"id": "collect_info",
"type": "conversation",
"instruction": {
"type": "prompt",
"text": "Ask the customer for their name and contact information."
}
}
]If enabled, the whole component will be converted as a Single Prompt agent.
false
Tools available within the component
- Option 1
- Option 2
- Option 3
Show child attributes
Show child attributes
[
{
"type": "custom",
"name": "get_customer_info",
"description": "Get customer information from database",
"tool_id": "tool_001",
"url": "https://api.example.com/customer",
"method": "GET"
}
]A list of MCP server configurations to use for this component
Show child attributes
Show child attributes
ID of the starting node
"collect_info"
Display position for the begin tag in the frontend
Show child attributes
Show child attributes
Visual annotations displayed on the flow canvas.
Show child attributes
Show child attributes
Response
Successfully created conversation flow component
Name of the component
"Customer Information Collector"
Nodes that make up the component
Show child attributes
Show child attributes
[
{
"id": "collect_info",
"type": "conversation",
"instruction": {
"type": "prompt",
"text": "Ask the customer for their name and contact information."
}
}
]Unique identifier for the component
Timestamp of last user modification
If enabled, the whole component will be converted as a Single Prompt agent.
false
Tools available within the component
- Option 1
- Option 2
- Option 3
Show child attributes
Show child attributes
[
{
"type": "custom",
"name": "get_customer_info",
"description": "Get customer information from database",
"tool_id": "tool_001",
"url": "https://api.example.com/customer",
"method": "GET"
}
]A list of MCP server configurations to use for this component
Show child attributes
Show child attributes
ID of the starting node
"collect_info"
Display position for the begin tag in the frontend
Show child attributes
Show child attributes
Visual annotations displayed on the flow canvas.
Show child attributes
Show child attributes
IDs of conversation flows linked to this shared component
Was this page helpful?

