curl --request POST \
--url https://{subdomain}.mihu.ai/api/v1/agents/{uuid}/routing-rules \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"department_name": "Complaints",
"trigger_keyword": "complaint",
"detection_mode": "both",
"phrases": [
"I want to file a complaint",
"I am unhappy",
"I need to escalate"
],
"ai_prompt": "Customer expresses dissatisfaction or wants to formally complain.",
"voice_response": "Transferring you to a senior specialist.",
"destination_type": "extension",
"destination": "103",
"transfer_type": "transfer_call",
"is_active": true
}
'import requests
url = "https://{subdomain}.mihu.ai/api/v1/agents/{uuid}/routing-rules"
payload = {
"department_name": "Complaints",
"trigger_keyword": "complaint",
"detection_mode": "both",
"phrases": ["I want to file a complaint", "I am unhappy", "I need to escalate"],
"ai_prompt": "Customer expresses dissatisfaction or wants to formally complain.",
"voice_response": "Transferring you to a senior specialist.",
"destination_type": "extension",
"destination": "103",
"transfer_type": "transfer_call",
"is_active": True
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
department_name: 'Complaints',
trigger_keyword: 'complaint',
detection_mode: 'both',
phrases: ['I want to file a complaint', 'I am unhappy', 'I need to escalate'],
ai_prompt: 'Customer expresses dissatisfaction or wants to formally complain.',
voice_response: 'Transferring you to a senior specialist.',
destination_type: 'extension',
destination: '103',
transfer_type: 'transfer_call',
is_active: true
})
};
fetch('https://{subdomain}.mihu.ai/api/v1/agents/{uuid}/routing-rules', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://{subdomain}.mihu.ai/api/v1/agents/{uuid}/routing-rules",
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([
'department_name' => 'Complaints',
'trigger_keyword' => 'complaint',
'detection_mode' => 'both',
'phrases' => [
'I want to file a complaint',
'I am unhappy',
'I need to escalate'
],
'ai_prompt' => 'Customer expresses dissatisfaction or wants to formally complain.',
'voice_response' => 'Transferring you to a senior specialist.',
'destination_type' => 'extension',
'destination' => '103',
'transfer_type' => 'transfer_call',
'is_active' => true
]),
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://{subdomain}.mihu.ai/api/v1/agents/{uuid}/routing-rules"
payload := strings.NewReader("{\n \"department_name\": \"Complaints\",\n \"trigger_keyword\": \"complaint\",\n \"detection_mode\": \"both\",\n \"phrases\": [\n \"I want to file a complaint\",\n \"I am unhappy\",\n \"I need to escalate\"\n ],\n \"ai_prompt\": \"Customer expresses dissatisfaction or wants to formally complain.\",\n \"voice_response\": \"Transferring you to a senior specialist.\",\n \"destination_type\": \"extension\",\n \"destination\": \"103\",\n \"transfer_type\": \"transfer_call\",\n \"is_active\": true\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://{subdomain}.mihu.ai/api/v1/agents/{uuid}/routing-rules")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"department_name\": \"Complaints\",\n \"trigger_keyword\": \"complaint\",\n \"detection_mode\": \"both\",\n \"phrases\": [\n \"I want to file a complaint\",\n \"I am unhappy\",\n \"I need to escalate\"\n ],\n \"ai_prompt\": \"Customer expresses dissatisfaction or wants to formally complain.\",\n \"voice_response\": \"Transferring you to a senior specialist.\",\n \"destination_type\": \"extension\",\n \"destination\": \"103\",\n \"transfer_type\": \"transfer_call\",\n \"is_active\": true\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://{subdomain}.mihu.ai/api/v1/agents/{uuid}/routing-rules")
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 \"department_name\": \"Complaints\",\n \"trigger_keyword\": \"complaint\",\n \"detection_mode\": \"both\",\n \"phrases\": [\n \"I want to file a complaint\",\n \"I am unhappy\",\n \"I need to escalate\"\n ],\n \"ai_prompt\": \"Customer expresses dissatisfaction or wants to formally complain.\",\n \"voice_response\": \"Transferring you to a senior specialist.\",\n \"destination_type\": \"extension\",\n \"destination\": \"103\",\n \"transfer_type\": \"transfer_call\",\n \"is_active\": true\n}"
response = http.request(request)
puts response.read_body{
"data": {
"agent_uuid": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"name": "<string>",
"description": "<string>",
"company_name": "<string>",
"role": "<string>",
"objective": "<string>",
"tone": "<string>",
"behavior_guidelines": "<string>",
"company_service": "<string>",
"topic": "<string>",
"length_detail": "<string>",
"interest_of_product": "<string>",
"negative_response": "<string>",
"status": "pending",
"custom_prompt": "<string>",
"language": "<string>",
"speed": "<string>",
"timezone": "<string>",
"appointment_scheduling_enabled": true,
"appointment_scheduling_randomly": true,
"custom_llm_url": "<string>",
"recommendations": "<string>",
"settings": {
"voice": {},
"text": {},
"memorize": {},
"evaluation": {}
},
"guidelines": [
{
"uuid": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"content": "Always confirm vehicle VIN or license plate before creating a service appointment.",
"order": 0
}
],
"notes": [
{
"uuid": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"content": "Service appointments take 60-90 minutes for standard maintenance, 2-4 hours for warranty work. Same-day pickup is available before 4 PM.",
"order": 0
}
],
"procedures": [
{
"uuid": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"name": "Book service appointment",
"description": "Used when the customer wants to schedule a service appointment for their vehicle.",
"steps": [
{
"order": 1,
"description": "Ask the customer for their vehicle license plate or VIN.",
"intent_uuid": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
}
]
}
],
"training": [
{
"uuid": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"content": "What does Volvo's standard warranty cover?",
"intent": "warranty_inquiry",
"response": "Volvo's standard warranty covers 4 years or 100,000 km, whichever comes first, including parts and labor at any authorized service center. Would you like the details for your specific model?"
}
],
"intents": [
{
"intent_uuid": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"key": "<string>",
"name": "<string>",
"description": "<string>",
"recommendation_actions": "<string>",
"confidence_threshold": 123,
"is_system": true,
"intent_llm_handle_by_response": true,
"webhook": {
"url": "<string>",
"auth_token": "<string>"
},
"parameters": [
{
"key": "email",
"default": "<string>",
"type": "string",
"required": true
}
],
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z"
}
],
"webhooks": [
{
"webhook_uuid": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"url": "<string>",
"events": [
"conversation_status"
],
"is_active": true,
"has_secret": true,
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z"
}
],
"appointments": {},
"routing_rules": [
{
"uuid": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"detection_mode": "intent",
"trigger_keyword": "sales",
"department_name": "Sales Department",
"phrases": [
"I want to talk to sales"
],
"ai_prompt": "Detect when the customer wants to speak with the sales team — they may ask about pricing, new products, quotes, or directly mention sales.",
"voice_response": "Sure, I'll transfer you to our sales team now. One moment please.",
"voice_on_error": "I'm sorry, I couldn't reach sales right now. Please call back later or leave a message.",
"voice_on_success": "You've been successfully connected. Have a great day.",
"destination_type": "extension",
"destination": "101",
"destination_agent_uuid": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"transfer_type": "transfer_call",
"transfer_config": {},
"priority": 1,
"is_active": true
}
],
"guard_rules": [
{
"uuid": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"name": "Legal complaint escalation",
"when_condition": "Customer mentions a legal complaint, lawyer, lawsuit, or threatens to take legal action.",
"example_phrases": [
"I'm calling my lawyer about this"
],
"then_action": "forward",
"selected_channels": [
"phone"
],
"say_before_forwarding": "I understand this is important — let me connect you with someone who can help.",
"say_before_end": "I'm sorry I couldn't help further. Please contact our team directly. Goodbye.",
"destination_type": "extension",
"destination": "<string>",
"destination_agent_uuid": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"is_active": true,
"is_default": false
}
],
"phone_numbers": [
{
"phone_number_uuid": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"number": "<string>",
"status": "active",
"country_code": "<string>",
"type": "<string>",
"capabilities": {
"call": true,
"sms": true,
"whatsapp": true,
"whatsapp_call": true
}
}
],
"channels": [
{}
],
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z"
}
}Add ONE routing rule (preserves existing rules)
Appends a new routing rule. Existing rules are untouched. If priority is omitted, it defaults to (max existing priority + 1) so the new rule is evaluated last. Returns the agent with the full updated routing_rules list. Use POST for incremental builds; use PUT to replace the whole set.
curl --request POST \
--url https://{subdomain}.mihu.ai/api/v1/agents/{uuid}/routing-rules \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"department_name": "Complaints",
"trigger_keyword": "complaint",
"detection_mode": "both",
"phrases": [
"I want to file a complaint",
"I am unhappy",
"I need to escalate"
],
"ai_prompt": "Customer expresses dissatisfaction or wants to formally complain.",
"voice_response": "Transferring you to a senior specialist.",
"destination_type": "extension",
"destination": "103",
"transfer_type": "transfer_call",
"is_active": true
}
'import requests
url = "https://{subdomain}.mihu.ai/api/v1/agents/{uuid}/routing-rules"
payload = {
"department_name": "Complaints",
"trigger_keyword": "complaint",
"detection_mode": "both",
"phrases": ["I want to file a complaint", "I am unhappy", "I need to escalate"],
"ai_prompt": "Customer expresses dissatisfaction or wants to formally complain.",
"voice_response": "Transferring you to a senior specialist.",
"destination_type": "extension",
"destination": "103",
"transfer_type": "transfer_call",
"is_active": True
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
department_name: 'Complaints',
trigger_keyword: 'complaint',
detection_mode: 'both',
phrases: ['I want to file a complaint', 'I am unhappy', 'I need to escalate'],
ai_prompt: 'Customer expresses dissatisfaction or wants to formally complain.',
voice_response: 'Transferring you to a senior specialist.',
destination_type: 'extension',
destination: '103',
transfer_type: 'transfer_call',
is_active: true
})
};
fetch('https://{subdomain}.mihu.ai/api/v1/agents/{uuid}/routing-rules', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://{subdomain}.mihu.ai/api/v1/agents/{uuid}/routing-rules",
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([
'department_name' => 'Complaints',
'trigger_keyword' => 'complaint',
'detection_mode' => 'both',
'phrases' => [
'I want to file a complaint',
'I am unhappy',
'I need to escalate'
],
'ai_prompt' => 'Customer expresses dissatisfaction or wants to formally complain.',
'voice_response' => 'Transferring you to a senior specialist.',
'destination_type' => 'extension',
'destination' => '103',
'transfer_type' => 'transfer_call',
'is_active' => true
]),
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://{subdomain}.mihu.ai/api/v1/agents/{uuid}/routing-rules"
payload := strings.NewReader("{\n \"department_name\": \"Complaints\",\n \"trigger_keyword\": \"complaint\",\n \"detection_mode\": \"both\",\n \"phrases\": [\n \"I want to file a complaint\",\n \"I am unhappy\",\n \"I need to escalate\"\n ],\n \"ai_prompt\": \"Customer expresses dissatisfaction or wants to formally complain.\",\n \"voice_response\": \"Transferring you to a senior specialist.\",\n \"destination_type\": \"extension\",\n \"destination\": \"103\",\n \"transfer_type\": \"transfer_call\",\n \"is_active\": true\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://{subdomain}.mihu.ai/api/v1/agents/{uuid}/routing-rules")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"department_name\": \"Complaints\",\n \"trigger_keyword\": \"complaint\",\n \"detection_mode\": \"both\",\n \"phrases\": [\n \"I want to file a complaint\",\n \"I am unhappy\",\n \"I need to escalate\"\n ],\n \"ai_prompt\": \"Customer expresses dissatisfaction or wants to formally complain.\",\n \"voice_response\": \"Transferring you to a senior specialist.\",\n \"destination_type\": \"extension\",\n \"destination\": \"103\",\n \"transfer_type\": \"transfer_call\",\n \"is_active\": true\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://{subdomain}.mihu.ai/api/v1/agents/{uuid}/routing-rules")
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 \"department_name\": \"Complaints\",\n \"trigger_keyword\": \"complaint\",\n \"detection_mode\": \"both\",\n \"phrases\": [\n \"I want to file a complaint\",\n \"I am unhappy\",\n \"I need to escalate\"\n ],\n \"ai_prompt\": \"Customer expresses dissatisfaction or wants to formally complain.\",\n \"voice_response\": \"Transferring you to a senior specialist.\",\n \"destination_type\": \"extension\",\n \"destination\": \"103\",\n \"transfer_type\": \"transfer_call\",\n \"is_active\": true\n}"
response = http.request(request)
puts response.read_body{
"data": {
"agent_uuid": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"name": "<string>",
"description": "<string>",
"company_name": "<string>",
"role": "<string>",
"objective": "<string>",
"tone": "<string>",
"behavior_guidelines": "<string>",
"company_service": "<string>",
"topic": "<string>",
"length_detail": "<string>",
"interest_of_product": "<string>",
"negative_response": "<string>",
"status": "pending",
"custom_prompt": "<string>",
"language": "<string>",
"speed": "<string>",
"timezone": "<string>",
"appointment_scheduling_enabled": true,
"appointment_scheduling_randomly": true,
"custom_llm_url": "<string>",
"recommendations": "<string>",
"settings": {
"voice": {},
"text": {},
"memorize": {},
"evaluation": {}
},
"guidelines": [
{
"uuid": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"content": "Always confirm vehicle VIN or license plate before creating a service appointment.",
"order": 0
}
],
"notes": [
{
"uuid": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"content": "Service appointments take 60-90 minutes for standard maintenance, 2-4 hours for warranty work. Same-day pickup is available before 4 PM.",
"order": 0
}
],
"procedures": [
{
"uuid": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"name": "Book service appointment",
"description": "Used when the customer wants to schedule a service appointment for their vehicle.",
"steps": [
{
"order": 1,
"description": "Ask the customer for their vehicle license plate or VIN.",
"intent_uuid": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
}
]
}
],
"training": [
{
"uuid": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"content": "What does Volvo's standard warranty cover?",
"intent": "warranty_inquiry",
"response": "Volvo's standard warranty covers 4 years or 100,000 km, whichever comes first, including parts and labor at any authorized service center. Would you like the details for your specific model?"
}
],
"intents": [
{
"intent_uuid": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"key": "<string>",
"name": "<string>",
"description": "<string>",
"recommendation_actions": "<string>",
"confidence_threshold": 123,
"is_system": true,
"intent_llm_handle_by_response": true,
"webhook": {
"url": "<string>",
"auth_token": "<string>"
},
"parameters": [
{
"key": "email",
"default": "<string>",
"type": "string",
"required": true
}
],
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z"
}
],
"webhooks": [
{
"webhook_uuid": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"url": "<string>",
"events": [
"conversation_status"
],
"is_active": true,
"has_secret": true,
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z"
}
],
"appointments": {},
"routing_rules": [
{
"uuid": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"detection_mode": "intent",
"trigger_keyword": "sales",
"department_name": "Sales Department",
"phrases": [
"I want to talk to sales"
],
"ai_prompt": "Detect when the customer wants to speak with the sales team — they may ask about pricing, new products, quotes, or directly mention sales.",
"voice_response": "Sure, I'll transfer you to our sales team now. One moment please.",
"voice_on_error": "I'm sorry, I couldn't reach sales right now. Please call back later or leave a message.",
"voice_on_success": "You've been successfully connected. Have a great day.",
"destination_type": "extension",
"destination": "101",
"destination_agent_uuid": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"transfer_type": "transfer_call",
"transfer_config": {},
"priority": 1,
"is_active": true
}
],
"guard_rules": [
{
"uuid": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"name": "Legal complaint escalation",
"when_condition": "Customer mentions a legal complaint, lawyer, lawsuit, or threatens to take legal action.",
"example_phrases": [
"I'm calling my lawyer about this"
],
"then_action": "forward",
"selected_channels": [
"phone"
],
"say_before_forwarding": "I understand this is important — let me connect you with someone who can help.",
"say_before_end": "I'm sorry I couldn't help further. Please contact our team directly. Goodbye.",
"destination_type": "extension",
"destination": "<string>",
"destination_agent_uuid": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"is_active": true,
"is_default": false
}
],
"phone_numbers": [
{
"phone_number_uuid": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"number": "<string>",
"status": "active",
"country_code": "<string>",
"type": "<string>",
"capabilities": {
"call": true,
"sms": true,
"whatsapp": true,
"whatsapp_call": true
}
}
],
"channels": [
{}
],
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z"
}
}Authorizations
Body
Routing rules tell the runtime agent when and how to transfer a call to another extension, phone number, or agent (the IVR equivalent). The runtime AI relies on ai_prompt and phrases to decide whether a customer utterance should trigger this rule — assignments without those fields will never fire.
Required for intent-based matching. Natural-language instructions the runtime AI uses to decide whether a customer utterance matches this rule. Without this field set, intent and both detection modes have no guidance to act on, so the rule will never trigger. Always provide concrete instructions describing what customer intent should fire this rule.
"Detect when the customer wants to speak with the sales team — they may ask about pricing, new products, quotes, or directly mention sales."
Where the call is sent. extension = SIP extension or URI (e.g. '101' or 'sip:101@domain.com'), phone = external phone number in E.164, agent = another mihu agent (set destination_agent_uuid).
extension, phone, agent "extension"
Telephony transfer mechanism. transfer_call = default transfer (recommended for most cases). forward_call = simple forwarding. warm_transfer_call = the agent stays on the line and announces the caller before connecting. blind_transfer_call = hang up the moment the destination rings. ping_and_transfer_call = the agent briefly announces the caller, then transfers. ping_and_bridge_call = checks availability via the configured URL, then bridges the returned number into the call and the agent stays muted on the line.
transfer_call, forward_call, warm_transfer_call, blind_transfer_call, ping_and_transfer_call, ping_and_bridge_call "transfer_call"