curl --request POST \
--url https://{subdomain}.mihu.ai/api/v1/rules \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "Aggressive call rule",
"type": "call",
"max_calls_per_day": 3,
"max_total_calls": 10,
"retry_interval_minutes": 120,
"start_time": "09:00",
"end_time": "18:00",
"dnc_check": true,
"remove_on_opt_out": true,
"escalation_after_failed_attempts": 0,
"escalation_type": "<string>",
"escalation_target": "<string>"
}
'import requests
url = "https://{subdomain}.mihu.ai/api/v1/rules"
payload = {
"name": "Aggressive call rule",
"type": "call",
"max_calls_per_day": 3,
"max_total_calls": 10,
"retry_interval_minutes": 120,
"start_time": "09:00",
"end_time": "18:00",
"dnc_check": True,
"remove_on_opt_out": True,
"escalation_after_failed_attempts": 0,
"escalation_type": "<string>",
"escalation_target": "<string>"
}
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({
name: 'Aggressive call rule',
type: 'call',
max_calls_per_day: 3,
max_total_calls: 10,
retry_interval_minutes: 120,
start_time: '09:00',
end_time: '18:00',
dnc_check: true,
remove_on_opt_out: true,
escalation_after_failed_attempts: 0,
escalation_type: '<string>',
escalation_target: '<string>'
})
};
fetch('https://{subdomain}.mihu.ai/api/v1/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/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([
'name' => 'Aggressive call rule',
'type' => 'call',
'max_calls_per_day' => 3,
'max_total_calls' => 10,
'retry_interval_minutes' => 120,
'start_time' => '09:00',
'end_time' => '18:00',
'dnc_check' => true,
'remove_on_opt_out' => true,
'escalation_after_failed_attempts' => 0,
'escalation_type' => '<string>',
'escalation_target' => '<string>'
]),
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/rules"
payload := strings.NewReader("{\n \"name\": \"Aggressive call rule\",\n \"type\": \"call\",\n \"max_calls_per_day\": 3,\n \"max_total_calls\": 10,\n \"retry_interval_minutes\": 120,\n \"start_time\": \"09:00\",\n \"end_time\": \"18:00\",\n \"dnc_check\": true,\n \"remove_on_opt_out\": true,\n \"escalation_after_failed_attempts\": 0,\n \"escalation_type\": \"<string>\",\n \"escalation_target\": \"<string>\"\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/rules")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"Aggressive call rule\",\n \"type\": \"call\",\n \"max_calls_per_day\": 3,\n \"max_total_calls\": 10,\n \"retry_interval_minutes\": 120,\n \"start_time\": \"09:00\",\n \"end_time\": \"18:00\",\n \"dnc_check\": true,\n \"remove_on_opt_out\": true,\n \"escalation_after_failed_attempts\": 0,\n \"escalation_type\": \"<string>\",\n \"escalation_target\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://{subdomain}.mihu.ai/api/v1/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 \"name\": \"Aggressive call rule\",\n \"type\": \"call\",\n \"max_calls_per_day\": 3,\n \"max_total_calls\": 10,\n \"retry_interval_minutes\": 120,\n \"start_time\": \"09:00\",\n \"end_time\": \"18:00\",\n \"dnc_check\": true,\n \"remove_on_opt_out\": true,\n \"escalation_after_failed_attempts\": 0,\n \"escalation_type\": \"<string>\",\n \"escalation_target\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"success": true,
"message": "Rule created successfully",
"data": {
"uuid": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"name": "Aggressive call rule",
"type": "call",
"max_calls_per_day": 3,
"max_total_calls": 10,
"retry_interval_minutes": 120,
"start_time": "09:00:00",
"end_time": "18:00:00",
"dnc_check": true,
"remove_on_opt_out": true,
"escalation_after_failed_attempts": 0,
"escalation_type": "<string>",
"escalation_target": "<string>",
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z"
}
}Create a new campaign contact rule
Creates a standalone rule that can later be attached to one or more campaigns via PUT /api/v1/campaigns//rule. The rule’s type (call vs text) governs which fields are honored and which defaults are applied.
curl --request POST \
--url https://{subdomain}.mihu.ai/api/v1/rules \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "Aggressive call rule",
"type": "call",
"max_calls_per_day": 3,
"max_total_calls": 10,
"retry_interval_minutes": 120,
"start_time": "09:00",
"end_time": "18:00",
"dnc_check": true,
"remove_on_opt_out": true,
"escalation_after_failed_attempts": 0,
"escalation_type": "<string>",
"escalation_target": "<string>"
}
'import requests
url = "https://{subdomain}.mihu.ai/api/v1/rules"
payload = {
"name": "Aggressive call rule",
"type": "call",
"max_calls_per_day": 3,
"max_total_calls": 10,
"retry_interval_minutes": 120,
"start_time": "09:00",
"end_time": "18:00",
"dnc_check": True,
"remove_on_opt_out": True,
"escalation_after_failed_attempts": 0,
"escalation_type": "<string>",
"escalation_target": "<string>"
}
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({
name: 'Aggressive call rule',
type: 'call',
max_calls_per_day: 3,
max_total_calls: 10,
retry_interval_minutes: 120,
start_time: '09:00',
end_time: '18:00',
dnc_check: true,
remove_on_opt_out: true,
escalation_after_failed_attempts: 0,
escalation_type: '<string>',
escalation_target: '<string>'
})
};
fetch('https://{subdomain}.mihu.ai/api/v1/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/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([
'name' => 'Aggressive call rule',
'type' => 'call',
'max_calls_per_day' => 3,
'max_total_calls' => 10,
'retry_interval_minutes' => 120,
'start_time' => '09:00',
'end_time' => '18:00',
'dnc_check' => true,
'remove_on_opt_out' => true,
'escalation_after_failed_attempts' => 0,
'escalation_type' => '<string>',
'escalation_target' => '<string>'
]),
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/rules"
payload := strings.NewReader("{\n \"name\": \"Aggressive call rule\",\n \"type\": \"call\",\n \"max_calls_per_day\": 3,\n \"max_total_calls\": 10,\n \"retry_interval_minutes\": 120,\n \"start_time\": \"09:00\",\n \"end_time\": \"18:00\",\n \"dnc_check\": true,\n \"remove_on_opt_out\": true,\n \"escalation_after_failed_attempts\": 0,\n \"escalation_type\": \"<string>\",\n \"escalation_target\": \"<string>\"\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/rules")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"Aggressive call rule\",\n \"type\": \"call\",\n \"max_calls_per_day\": 3,\n \"max_total_calls\": 10,\n \"retry_interval_minutes\": 120,\n \"start_time\": \"09:00\",\n \"end_time\": \"18:00\",\n \"dnc_check\": true,\n \"remove_on_opt_out\": true,\n \"escalation_after_failed_attempts\": 0,\n \"escalation_type\": \"<string>\",\n \"escalation_target\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://{subdomain}.mihu.ai/api/v1/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 \"name\": \"Aggressive call rule\",\n \"type\": \"call\",\n \"max_calls_per_day\": 3,\n \"max_total_calls\": 10,\n \"retry_interval_minutes\": 120,\n \"start_time\": \"09:00\",\n \"end_time\": \"18:00\",\n \"dnc_check\": true,\n \"remove_on_opt_out\": true,\n \"escalation_after_failed_attempts\": 0,\n \"escalation_type\": \"<string>\",\n \"escalation_target\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"success": true,
"message": "Rule created successfully",
"data": {
"uuid": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"name": "Aggressive call rule",
"type": "call",
"max_calls_per_day": 3,
"max_total_calls": 10,
"retry_interval_minutes": 120,
"start_time": "09:00:00",
"end_time": "18:00:00",
"dnc_check": true,
"remove_on_opt_out": true,
"escalation_after_failed_attempts": 0,
"escalation_type": "<string>",
"escalation_target": "<string>",
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z"
}
}Authorizations
Use a Bearer token to access these API endpoints. Example: "Bearer {your-token}"
Body
Human-readable label for the rule. 3-255 characters. Not required to be unique.
3 - 255"Aggressive call rule"
Determines task scheduling behavior. 'call' rules honor retry interval and working-hours window. 'text' rules are forced to one-shot semantics: max_total_calls and max_calls_per_day are coerced to 1, and retry_interval_minutes / end_time / escalation_* are nulled. Default: 'call'.
call, text "call"
Maximum number of attempts to the same contact per calendar day, evaluated in the contact's local timezone. Ignored when type='text' (forced to 1). Default: 3 for call, 1 for text.
x >= 13
Hard cap on total attempts to the same contact across the campaign's full date range. Once reached, no further tasks are scheduled for that contact. Default: 10 for call, 1 for text.
x >= 110
Minimum minutes between successive attempts to the same contact. Honored only for type='call'. Null for type='text'. Default: 120.
x >= 1120
Earliest allowed local time of day (HH:MM, 24h) the system may attempt to reach a contact. Interpreted in the contact's local timezone, not server time. Default: '09:00'.
"09:00"
Latest allowed local time of day (HH:MM, 24h). Honored only for type='call'. Null for type='text'. Default: '18:00'.
"18:00"
When true, contacts on the Do Not Call list are skipped at task-creation time. Default: true.
true
When true, an inbound opt-out (STOP keyword, unsubscribe webhook) automatically removes the contact from active pool items. Default: true.
true
Trigger threshold for escalation_type. After this many consecutive failed attempts on a contact, the escalation hook fires. 0 disables escalation. Default: 0.
x >= 00
Free-form identifier consumed by your downstream escalation logic. Common values: 'notify_manager', 'reassign_to_human', 'mark_failed'. Null disables.
255Free-form payload paired with escalation_type — typically a manager email, a team UUID, or human-readable instructions. Interpretation is up to your handler.
