Create campaign
curl --request POST \
--url https://api.lehar.ai/ca/api/v0/campaigns \
--header 'Content-Type: application/json' \
--header 'X-API-KEY: <api-key>' \
--data '
{
"name": "March renewals",
"campaign_type": "voice",
"voice_agent_id": "agent_sales_hi",
"timezone": "Asia/Kolkata",
"schedule": {
"business_hours": {
"start": "09:00",
"end": "18:00",
"days": [
"mon",
"tue",
"wed",
"thu",
"fri"
]
},
"max_attempts": 3,
"retry_delay_minutes": 120
}
}
'import requests
url = "https://api.lehar.ai/ca/api/v0/campaigns"
payload = {
"name": "March renewals",
"campaign_type": "voice",
"voice_agent_id": "agent_sales_hi",
"timezone": "Asia/Kolkata",
"schedule": {
"business_hours": {
"start": "09:00",
"end": "18:00",
"days": ["mon", "tue", "wed", "thu", "fri"]
},
"max_attempts": 3,
"retry_delay_minutes": 120
}
}
headers = {
"X-API-KEY": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'X-API-KEY': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
name: 'March renewals',
campaign_type: 'voice',
voice_agent_id: 'agent_sales_hi',
timezone: 'Asia/Kolkata',
schedule: {
business_hours: {start: '09:00', end: '18:00', days: ['mon', 'tue', 'wed', 'thu', 'fri']},
max_attempts: 3,
retry_delay_minutes: 120
}
})
};
fetch('https://api.lehar.ai/ca/api/v0/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://api.lehar.ai/ca/api/v0/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' => 'March renewals',
'campaign_type' => 'voice',
'voice_agent_id' => 'agent_sales_hi',
'timezone' => 'Asia/Kolkata',
'schedule' => [
'business_hours' => [
'start' => '09:00',
'end' => '18:00',
'days' => [
'mon',
'tue',
'wed',
'thu',
'fri'
]
],
'max_attempts' => 3,
'retry_delay_minutes' => 120
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"X-API-KEY: <api-key>"
],
]);
$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.lehar.ai/ca/api/v0/campaigns"
payload := strings.NewReader("{\n \"name\": \"March renewals\",\n \"campaign_type\": \"voice\",\n \"voice_agent_id\": \"agent_sales_hi\",\n \"timezone\": \"Asia/Kolkata\",\n \"schedule\": {\n \"business_hours\": {\n \"start\": \"09:00\",\n \"end\": \"18:00\",\n \"days\": [\n \"mon\",\n \"tue\",\n \"wed\",\n \"thu\",\n \"fri\"\n ]\n },\n \"max_attempts\": 3,\n \"retry_delay_minutes\": 120\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("X-API-KEY", "<api-key>")
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.lehar.ai/ca/api/v0/campaigns")
.header("X-API-KEY", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"March renewals\",\n \"campaign_type\": \"voice\",\n \"voice_agent_id\": \"agent_sales_hi\",\n \"timezone\": \"Asia/Kolkata\",\n \"schedule\": {\n \"business_hours\": {\n \"start\": \"09:00\",\n \"end\": \"18:00\",\n \"days\": [\n \"mon\",\n \"tue\",\n \"wed\",\n \"thu\",\n \"fri\"\n ]\n },\n \"max_attempts\": 3,\n \"retry_delay_minutes\": 120\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.lehar.ai/ca/api/v0/campaigns")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["X-API-KEY"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"March renewals\",\n \"campaign_type\": \"voice\",\n \"voice_agent_id\": \"agent_sales_hi\",\n \"timezone\": \"Asia/Kolkata\",\n \"schedule\": {\n \"business_hours\": {\n \"start\": \"09:00\",\n \"end\": \"18:00\",\n \"days\": [\n \"mon\",\n \"tue\",\n \"wed\",\n \"thu\",\n \"fri\"\n ]\n },\n \"max_attempts\": 3,\n \"retry_delay_minutes\": 120\n }\n}"
response = http.request(request)
puts response.read_body{
"id": "campaign_01EXAMPLE",
"customer_id": "customer_01EXAMPLE",
"created_by_user_id": "user_01EXAMPLE",
"voice_agent_id": "agent_sales_hi",
"whatsapp_agent_id": null,
"from_phone_number_id": null,
"whatsapp_sender_id": null,
"name": "March renewals",
"description": null,
"campaign_type": "voice",
"status": "draft",
"timezone": "Asia/Kolkata",
"schedule": {
"business_hours": {
"start": "09:00",
"end": "18:00",
"days": [
"mon",
"tue",
"wed",
"thu",
"fri"
]
},
"max_attempts": 3,
"retry_delay_minutes": 120
},
"workflow": {},
"variables_schema": {},
"metadata": {},
"temporal_workflow_id": null,
"temporal_run_id": null,
"cloned_from_campaign_id": null,
"started_at": null,
"completed_at": null,
"created_at": "2026-05-22T10:00:00Z",
"updated_at": "2026-05-22T10:00:00Z"
}{
"error": {
"code": "invalid_request",
"message": "voice_agent_id is required for this campaign type"
}
}Campaigns
Create campaign
Creates a campaign as a draft. Bind the agent per channel: voice_agent_id for voice, whatsapp_agent_id for whatsapp, both for whatsapp_voice. The bound agent must be published. Scope campaigns:write.
POST
/
campaigns
Create campaign
curl --request POST \
--url https://api.lehar.ai/ca/api/v0/campaigns \
--header 'Content-Type: application/json' \
--header 'X-API-KEY: <api-key>' \
--data '
{
"name": "March renewals",
"campaign_type": "voice",
"voice_agent_id": "agent_sales_hi",
"timezone": "Asia/Kolkata",
"schedule": {
"business_hours": {
"start": "09:00",
"end": "18:00",
"days": [
"mon",
"tue",
"wed",
"thu",
"fri"
]
},
"max_attempts": 3,
"retry_delay_minutes": 120
}
}
'import requests
url = "https://api.lehar.ai/ca/api/v0/campaigns"
payload = {
"name": "March renewals",
"campaign_type": "voice",
"voice_agent_id": "agent_sales_hi",
"timezone": "Asia/Kolkata",
"schedule": {
"business_hours": {
"start": "09:00",
"end": "18:00",
"days": ["mon", "tue", "wed", "thu", "fri"]
},
"max_attempts": 3,
"retry_delay_minutes": 120
}
}
headers = {
"X-API-KEY": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'X-API-KEY': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
name: 'March renewals',
campaign_type: 'voice',
voice_agent_id: 'agent_sales_hi',
timezone: 'Asia/Kolkata',
schedule: {
business_hours: {start: '09:00', end: '18:00', days: ['mon', 'tue', 'wed', 'thu', 'fri']},
max_attempts: 3,
retry_delay_minutes: 120
}
})
};
fetch('https://api.lehar.ai/ca/api/v0/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://api.lehar.ai/ca/api/v0/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' => 'March renewals',
'campaign_type' => 'voice',
'voice_agent_id' => 'agent_sales_hi',
'timezone' => 'Asia/Kolkata',
'schedule' => [
'business_hours' => [
'start' => '09:00',
'end' => '18:00',
'days' => [
'mon',
'tue',
'wed',
'thu',
'fri'
]
],
'max_attempts' => 3,
'retry_delay_minutes' => 120
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"X-API-KEY: <api-key>"
],
]);
$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.lehar.ai/ca/api/v0/campaigns"
payload := strings.NewReader("{\n \"name\": \"March renewals\",\n \"campaign_type\": \"voice\",\n \"voice_agent_id\": \"agent_sales_hi\",\n \"timezone\": \"Asia/Kolkata\",\n \"schedule\": {\n \"business_hours\": {\n \"start\": \"09:00\",\n \"end\": \"18:00\",\n \"days\": [\n \"mon\",\n \"tue\",\n \"wed\",\n \"thu\",\n \"fri\"\n ]\n },\n \"max_attempts\": 3,\n \"retry_delay_minutes\": 120\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("X-API-KEY", "<api-key>")
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.lehar.ai/ca/api/v0/campaigns")
.header("X-API-KEY", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"March renewals\",\n \"campaign_type\": \"voice\",\n \"voice_agent_id\": \"agent_sales_hi\",\n \"timezone\": \"Asia/Kolkata\",\n \"schedule\": {\n \"business_hours\": {\n \"start\": \"09:00\",\n \"end\": \"18:00\",\n \"days\": [\n \"mon\",\n \"tue\",\n \"wed\",\n \"thu\",\n \"fri\"\n ]\n },\n \"max_attempts\": 3,\n \"retry_delay_minutes\": 120\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.lehar.ai/ca/api/v0/campaigns")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["X-API-KEY"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"March renewals\",\n \"campaign_type\": \"voice\",\n \"voice_agent_id\": \"agent_sales_hi\",\n \"timezone\": \"Asia/Kolkata\",\n \"schedule\": {\n \"business_hours\": {\n \"start\": \"09:00\",\n \"end\": \"18:00\",\n \"days\": [\n \"mon\",\n \"tue\",\n \"wed\",\n \"thu\",\n \"fri\"\n ]\n },\n \"max_attempts\": 3,\n \"retry_delay_minutes\": 120\n }\n}"
response = http.request(request)
puts response.read_body{
"id": "campaign_01EXAMPLE",
"customer_id": "customer_01EXAMPLE",
"created_by_user_id": "user_01EXAMPLE",
"voice_agent_id": "agent_sales_hi",
"whatsapp_agent_id": null,
"from_phone_number_id": null,
"whatsapp_sender_id": null,
"name": "March renewals",
"description": null,
"campaign_type": "voice",
"status": "draft",
"timezone": "Asia/Kolkata",
"schedule": {
"business_hours": {
"start": "09:00",
"end": "18:00",
"days": [
"mon",
"tue",
"wed",
"thu",
"fri"
]
},
"max_attempts": 3,
"retry_delay_minutes": 120
},
"workflow": {},
"variables_schema": {},
"metadata": {},
"temporal_workflow_id": null,
"temporal_run_id": null,
"cloned_from_campaign_id": null,
"started_at": null,
"completed_at": null,
"created_at": "2026-05-22T10:00:00Z",
"updated_at": "2026-05-22T10:00:00Z"
}{
"error": {
"code": "invalid_request",
"message": "voice_agent_id is required for this campaign type"
}
}Authorizations
ApiKeyAuthBearerAuth
Body
application/json
Available options:
voice, whatsapp, whatsapp_voice Required for voice and whatsapp_voice. Must reference a published voice agent.
Required for whatsapp and whatsapp_voice.
Business hours and retry policy.
Show child attributes
Show child attributes
Channel-specific config (e.g. workflow.whatsapp for WhatsApp campaigns).
Response
Created campaign (status draft)

