curl --request POST \
--url https://{subdomain}.mihu.ai/api/v1/campaigns \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "Summer Promotion 2025",
"description": "Campaign for summer products promotion",
"status": "Draft",
"campaign_type": "email",
"start_date": "2025-06-01T00:00:00Z",
"end_date": "2025-08-31T23:59:59Z",
"rules": {
"target_audience": "new_customers",
"minimum_age": 18
},
"agent_uuid": "550e8400-e29b-41d4-a716-446655440000",
"contact_template_setting_uuid": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
}
'import requests
url = "https://{subdomain}.mihu.ai/api/v1/campaigns"
payload = {
"name": "Summer Promotion 2025",
"description": "Campaign for summer products promotion",
"status": "Draft",
"campaign_type": "email",
"start_date": "2025-06-01T00:00:00Z",
"end_date": "2025-08-31T23:59:59Z",
"rules": {
"target_audience": "new_customers",
"minimum_age": 18
},
"agent_uuid": "550e8400-e29b-41d4-a716-446655440000",
"contact_template_setting_uuid": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
}
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: 'Summer Promotion 2025',
description: 'Campaign for summer products promotion',
status: 'Draft',
campaign_type: 'email',
start_date: '2025-06-01T00:00:00Z',
end_date: '2025-08-31T23:59:59Z',
rules: {target_audience: 'new_customers', minimum_age: 18},
agent_uuid: '550e8400-e29b-41d4-a716-446655440000',
contact_template_setting_uuid: '3c90c3cc-0d44-4b50-8888-8dd25736052a'
})
};
fetch('https://{subdomain}.mihu.ai/api/v1/campaigns', 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/campaigns",
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' => 'Summer Promotion 2025',
'description' => 'Campaign for summer products promotion',
'status' => 'Draft',
'campaign_type' => 'email',
'start_date' => '2025-06-01T00:00:00Z',
'end_date' => '2025-08-31T23:59:59Z',
'rules' => [
'target_audience' => 'new_customers',
'minimum_age' => 18
],
'agent_uuid' => '550e8400-e29b-41d4-a716-446655440000',
'contact_template_setting_uuid' => '3c90c3cc-0d44-4b50-8888-8dd25736052a'
]),
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/campaigns"
payload := strings.NewReader("{\n \"name\": \"Summer Promotion 2025\",\n \"description\": \"Campaign for summer products promotion\",\n \"status\": \"Draft\",\n \"campaign_type\": \"email\",\n \"start_date\": \"2025-06-01T00:00:00Z\",\n \"end_date\": \"2025-08-31T23:59:59Z\",\n \"rules\": {\n \"target_audience\": \"new_customers\",\n \"minimum_age\": 18\n },\n \"agent_uuid\": \"550e8400-e29b-41d4-a716-446655440000\",\n \"contact_template_setting_uuid\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\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/campaigns")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"Summer Promotion 2025\",\n \"description\": \"Campaign for summer products promotion\",\n \"status\": \"Draft\",\n \"campaign_type\": \"email\",\n \"start_date\": \"2025-06-01T00:00:00Z\",\n \"end_date\": \"2025-08-31T23:59:59Z\",\n \"rules\": {\n \"target_audience\": \"new_customers\",\n \"minimum_age\": 18\n },\n \"agent_uuid\": \"550e8400-e29b-41d4-a716-446655440000\",\n \"contact_template_setting_uuid\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://{subdomain}.mihu.ai/api/v1/campaigns")
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\": \"Summer Promotion 2025\",\n \"description\": \"Campaign for summer products promotion\",\n \"status\": \"Draft\",\n \"campaign_type\": \"email\",\n \"start_date\": \"2025-06-01T00:00:00Z\",\n \"end_date\": \"2025-08-31T23:59:59Z\",\n \"rules\": {\n \"target_audience\": \"new_customers\",\n \"minimum_age\": 18\n },\n \"agent_uuid\": \"550e8400-e29b-41d4-a716-446655440000\",\n \"contact_template_setting_uuid\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n}"
response = http.request(request)
puts response.read_body{
"success": true,
"message": "Campaign created successfully",
"data": {
"uuid": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"name": "<string>",
"description": "<string>",
"status": "<string>",
"campaign_type": "<string>",
"start_date": "2023-11-07T05:31:56Z",
"end_date": "2023-11-07T05:31:56Z",
"rules": {},
"agent_uuid": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z"
}
}{
"success": false,
"message": "Validation errors",
"data": [
"<unknown>"
]
}{
"success": false,
"message": "An unexpected error occurred",
"data": [
"<unknown>"
]
}Create a new campaign
Creates the campaign shell: name, channel type, agent, status, date window, and optional message settings. Use this when you want fine-grained control over setup. After creation, attach a rule and one or more pools, then publish the campaign to schedule work.
curl --request POST \
--url https://{subdomain}.mihu.ai/api/v1/campaigns \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "Summer Promotion 2025",
"description": "Campaign for summer products promotion",
"status": "Draft",
"campaign_type": "email",
"start_date": "2025-06-01T00:00:00Z",
"end_date": "2025-08-31T23:59:59Z",
"rules": {
"target_audience": "new_customers",
"minimum_age": 18
},
"agent_uuid": "550e8400-e29b-41d4-a716-446655440000",
"contact_template_setting_uuid": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
}
'import requests
url = "https://{subdomain}.mihu.ai/api/v1/campaigns"
payload = {
"name": "Summer Promotion 2025",
"description": "Campaign for summer products promotion",
"status": "Draft",
"campaign_type": "email",
"start_date": "2025-06-01T00:00:00Z",
"end_date": "2025-08-31T23:59:59Z",
"rules": {
"target_audience": "new_customers",
"minimum_age": 18
},
"agent_uuid": "550e8400-e29b-41d4-a716-446655440000",
"contact_template_setting_uuid": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
}
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: 'Summer Promotion 2025',
description: 'Campaign for summer products promotion',
status: 'Draft',
campaign_type: 'email',
start_date: '2025-06-01T00:00:00Z',
end_date: '2025-08-31T23:59:59Z',
rules: {target_audience: 'new_customers', minimum_age: 18},
agent_uuid: '550e8400-e29b-41d4-a716-446655440000',
contact_template_setting_uuid: '3c90c3cc-0d44-4b50-8888-8dd25736052a'
})
};
fetch('https://{subdomain}.mihu.ai/api/v1/campaigns', 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/campaigns",
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' => 'Summer Promotion 2025',
'description' => 'Campaign for summer products promotion',
'status' => 'Draft',
'campaign_type' => 'email',
'start_date' => '2025-06-01T00:00:00Z',
'end_date' => '2025-08-31T23:59:59Z',
'rules' => [
'target_audience' => 'new_customers',
'minimum_age' => 18
],
'agent_uuid' => '550e8400-e29b-41d4-a716-446655440000',
'contact_template_setting_uuid' => '3c90c3cc-0d44-4b50-8888-8dd25736052a'
]),
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/campaigns"
payload := strings.NewReader("{\n \"name\": \"Summer Promotion 2025\",\n \"description\": \"Campaign for summer products promotion\",\n \"status\": \"Draft\",\n \"campaign_type\": \"email\",\n \"start_date\": \"2025-06-01T00:00:00Z\",\n \"end_date\": \"2025-08-31T23:59:59Z\",\n \"rules\": {\n \"target_audience\": \"new_customers\",\n \"minimum_age\": 18\n },\n \"agent_uuid\": \"550e8400-e29b-41d4-a716-446655440000\",\n \"contact_template_setting_uuid\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\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/campaigns")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"Summer Promotion 2025\",\n \"description\": \"Campaign for summer products promotion\",\n \"status\": \"Draft\",\n \"campaign_type\": \"email\",\n \"start_date\": \"2025-06-01T00:00:00Z\",\n \"end_date\": \"2025-08-31T23:59:59Z\",\n \"rules\": {\n \"target_audience\": \"new_customers\",\n \"minimum_age\": 18\n },\n \"agent_uuid\": \"550e8400-e29b-41d4-a716-446655440000\",\n \"contact_template_setting_uuid\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://{subdomain}.mihu.ai/api/v1/campaigns")
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\": \"Summer Promotion 2025\",\n \"description\": \"Campaign for summer products promotion\",\n \"status\": \"Draft\",\n \"campaign_type\": \"email\",\n \"start_date\": \"2025-06-01T00:00:00Z\",\n \"end_date\": \"2025-08-31T23:59:59Z\",\n \"rules\": {\n \"target_audience\": \"new_customers\",\n \"minimum_age\": 18\n },\n \"agent_uuid\": \"550e8400-e29b-41d4-a716-446655440000\",\n \"contact_template_setting_uuid\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n}"
response = http.request(request)
puts response.read_body{
"success": true,
"message": "Campaign created successfully",
"data": {
"uuid": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"name": "<string>",
"description": "<string>",
"status": "<string>",
"campaign_type": "<string>",
"start_date": "2023-11-07T05:31:56Z",
"end_date": "2023-11-07T05:31:56Z",
"rules": {},
"agent_uuid": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z"
}
}{
"success": false,
"message": "Validation errors",
"data": [
"<unknown>"
]
}{
"success": false,
"message": "An unexpected error occurred",
"data": [
"<unknown>"
]
}Authorizations
Use a Bearer token to access these API endpoints. Example: "Bearer {your-token}"
Body
"Summer Promotion 2025"
"Campaign for summer products promotion"
Active, Draft, Completed, Archived "Draft"
"email"
"2025-06-01T00:00:00Z"
"2025-08-31T23:59:59Z"
{
"target_audience": "new_customers",
"minimum_age": 18
}Agent UUID. The channel binding (agent_app) is resolved automatically: when campaign_type is given, the agent's channel matching that type is used.
"550e8400-e29b-41d4-a716-446655440000"
For campaign_type='text' (WhatsApp): UUID of an active template setting (create via POST /api/v1/whatsapp/template-settings). A text campaign cannot publish without one.
Response
Created
Indicates whether the request completed successfully. True for successful responses; false for documented error responses.
true
Human-readable response message. Safe to display in logs or simple client notifications; use structured fields for program logic.
"Campaign created successfully"
Show child attributes
Show child attributes