curl --request PATCH \
--url https://api.lehar.ai/ca/api/v0/campaigns/{campaign_id} \
--header 'Content-Type: application/json' \
--header 'X-API-KEY: <api-key>' \
--data '
{
"name": "March renewals (v2)",
"schedule": {
"max_attempts": 4
}
}
'import requests
url = "https://api.lehar.ai/ca/api/v0/campaigns/{campaign_id}"
payload = {
"name": "March renewals (v2)",
"schedule": { "max_attempts": 4 }
}
headers = {
"X-API-KEY": "<api-key>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PATCH',
headers: {'X-API-KEY': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({name: 'March renewals (v2)', schedule: {max_attempts: 4}})
};
fetch('https://api.lehar.ai/ca/api/v0/campaigns/{campaign_id}', 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/{campaign_id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PATCH",
CURLOPT_POSTFIELDS => json_encode([
'name' => 'March renewals (v2)',
'schedule' => [
'max_attempts' => 4
]
]),
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/{campaign_id}"
payload := strings.NewReader("{\n \"name\": \"March renewals (v2)\",\n \"schedule\": {\n \"max_attempts\": 4\n }\n}")
req, _ := http.NewRequest("PATCH", 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.patch("https://api.lehar.ai/ca/api/v0/campaigns/{campaign_id}")
.header("X-API-KEY", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"March renewals (v2)\",\n \"schedule\": {\n \"max_attempts\": 4\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.lehar.ai/ca/api/v0/campaigns/{campaign_id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Patch.new(url)
request["X-API-KEY"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"March renewals (v2)\",\n \"schedule\": {\n \"max_attempts\": 4\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 (v2)",
"description": null,
"campaign_type": "voice",
"status": "draft",
"timezone": "Asia/Kolkata",
"schedule": {
"business_hours": [
{
"days": [
"mon",
"tue",
"wed",
"thu",
"fri"
],
"start": "09:00",
"end": "18:00"
}
],
"max_attempts": 4,
"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:20:00Z"
}{
"error": {
"code": "invalid_request",
"message": "id and customer_id cannot be updated"
}
}{
"error": {
"code": "conflict",
"message": "Only draft, scheduled, or paused campaigns can be edited"
}
}Update campaign
Partially update a campaign’s configuration — send only the fields to change. Editable only while the campaign is draft, scheduled, or paused; a published, running, completed, failed, or cancelled campaign returns 409. Changing an agent binding re-validates it (the new agent must be published and match the channel), same as Create. id and customer_id cannot be changed, nor campaign_type once the campaign has started. status can’t be set here — use the dedicated /publish, /start, and /pause endpoints for lifecycle transitions. Scope campaigns:write.
curl --request PATCH \
--url https://api.lehar.ai/ca/api/v0/campaigns/{campaign_id} \
--header 'Content-Type: application/json' \
--header 'X-API-KEY: <api-key>' \
--data '
{
"name": "March renewals (v2)",
"schedule": {
"max_attempts": 4
}
}
'import requests
url = "https://api.lehar.ai/ca/api/v0/campaigns/{campaign_id}"
payload = {
"name": "March renewals (v2)",
"schedule": { "max_attempts": 4 }
}
headers = {
"X-API-KEY": "<api-key>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PATCH',
headers: {'X-API-KEY': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({name: 'March renewals (v2)', schedule: {max_attempts: 4}})
};
fetch('https://api.lehar.ai/ca/api/v0/campaigns/{campaign_id}', 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/{campaign_id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PATCH",
CURLOPT_POSTFIELDS => json_encode([
'name' => 'March renewals (v2)',
'schedule' => [
'max_attempts' => 4
]
]),
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/{campaign_id}"
payload := strings.NewReader("{\n \"name\": \"March renewals (v2)\",\n \"schedule\": {\n \"max_attempts\": 4\n }\n}")
req, _ := http.NewRequest("PATCH", 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.patch("https://api.lehar.ai/ca/api/v0/campaigns/{campaign_id}")
.header("X-API-KEY", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"March renewals (v2)\",\n \"schedule\": {\n \"max_attempts\": 4\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.lehar.ai/ca/api/v0/campaigns/{campaign_id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Patch.new(url)
request["X-API-KEY"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"March renewals (v2)\",\n \"schedule\": {\n \"max_attempts\": 4\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 (v2)",
"description": null,
"campaign_type": "voice",
"status": "draft",
"timezone": "Asia/Kolkata",
"schedule": {
"business_hours": [
{
"days": [
"mon",
"tue",
"wed",
"thu",
"fri"
],
"start": "09:00",
"end": "18:00"
}
],
"max_attempts": 4,
"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:20:00Z"
}{
"error": {
"code": "invalid_request",
"message": "id and customer_id cannot be updated"
}
}{
"error": {
"code": "conflict",
"message": "Only draft, scheduled, or paused campaigns can be edited"
}
}Authorizations
Path Parameters
Body
Changing this re-validates the required agent bindings for the new type.
voice, whatsapp, whatsapp_voice Validated against the campaign status set, but prefer the /publish, /start, and /pause endpoints for lifecycle changes.
Must reference a published voice agent.
Must reference a published whatsapp agent.
IANA timezone for the business hours and the agent's clock — same rules as Create campaign.
Business hours, retry policy and voice throttles — same shape as Create campaign.
Channel-specific config — same shape as Create campaign.
Response
The updated campaign

