Patch a campaign
PATCH
/api/v1/campaigns/{campaign_id}
using System.Net.Http.Headers;var client = new HttpClient();var request = new HttpRequestMessage{ Method = HttpMethod.Patch, RequestUri = new Uri("https://external-api.moja-ai.com/api/v1/campaigns/example"), Headers = { { "X-API-Key", "<X-API-Key>" }, }, Content = new StringContent("{ \"name\": \"example\", \"routing_plan_id\": \"example\", \"call_flow_id\": \"example\", \"execution_mode\": \"routing_plan\", \"is_active\": true, \"payout\": 1, \"timezone\": \"America/New_York\", \"conversion_scope\": 1, \"qai_category_id\": 1, \"tcpa_scrubbing\": \"default\", \"tcpa_scrubbing_config\": { \"id\": \"example\", \"api_key\": \"example\", \"api_version\": \"v1\", \"api_url\": \"https://api.blacklistalliance.net/lookup?key=abc123&ver=v1&resp=raw&phone=\", \"allow_calls_on_failure\": true }, \"number_group_items\": [ { \"id\": \"example\", \"number_id\": \"example\", \"publisher_id\": \"example\", \"type\": \"static\", \"payout\": 1, \"payout_condition\": \"example\", \"payout_condition_duration\": 1, \"payout_percentage\": 1, \"external_id\": \"example\", \"is_active\": true } ], \"ivr_payout_rules\": [ { \"id\": \"example\", \"legacy_rule_id\": \"example\", \"combinator\": \"and\", \"payout\": 0, \"filters\": [ { \"field\": \"keypress\", \"operator\": \"equals\", \"value\": \"1\" } ] } ], \"outgoing_webhooks\": [ \"example\" ], \"incoming_webhooks\": [ \"example\" ], \"preconverted_caller\": true, \"preconverted_destination\": true, \"preconverted_publisher\": true, \"preconverted_campaign\": true, \"external_id\": \"example\", \"disable_recordings\": true, \"access_to_call_recordings\": true, \"expose_ineligible_routes\": true, \"ineligible_routes_fields\": \"example\", \"advanced_caps\": [ {} ] }") { Headers = { ContentType = new MediaTypeHeaderValue("application/json") } }};using (var response = await client.SendAsync(request)){ response.EnsureSuccessStatusCode(); var body = await response.Content.ReadAsStringAsync(); Console.WriteLine(body);}package main
import ( "fmt" "strings" "net/http" "io")
func main() {
url := "https://external-api.moja-ai.com/api/v1/campaigns/example"
payload := strings.NewReader("{ \"name\": \"example\", \"routing_plan_id\": \"example\", \"call_flow_id\": \"example\", \"execution_mode\": \"routing_plan\", \"is_active\": true, \"payout\": 1, \"timezone\": \"America/New_York\", \"conversion_scope\": 1, \"qai_category_id\": 1, \"tcpa_scrubbing\": \"default\", \"tcpa_scrubbing_config\": { \"id\": \"example\", \"api_key\": \"example\", \"api_version\": \"v1\", \"api_url\": \"https://api.blacklistalliance.net/lookup?key=abc123&ver=v1&resp=raw&phone=\", \"allow_calls_on_failure\": true }, \"number_group_items\": [ { \"id\": \"example\", \"number_id\": \"example\", \"publisher_id\": \"example\", \"type\": \"static\", \"payout\": 1, \"payout_condition\": \"example\", \"payout_condition_duration\": 1, \"payout_percentage\": 1, \"external_id\": \"example\", \"is_active\": true } ], \"ivr_payout_rules\": [ { \"id\": \"example\", \"legacy_rule_id\": \"example\", \"combinator\": \"and\", \"payout\": 0, \"filters\": [ { \"field\": \"keypress\", \"operator\": \"equals\", \"value\": \"1\" } ] } ], \"outgoing_webhooks\": [ \"example\" ], \"incoming_webhooks\": [ \"example\" ], \"preconverted_caller\": true, \"preconverted_destination\": true, \"preconverted_publisher\": true, \"preconverted_campaign\": true, \"external_id\": \"example\", \"disable_recordings\": true, \"access_to_call_recordings\": true, \"expose_ineligible_routes\": true, \"ineligible_routes_fields\": \"example\", \"advanced_caps\": [ {} ] }")
req, _ := http.NewRequest("PATCH", url, payload)
req.Header.Add("X-API-Key", "<X-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(res) fmt.Println(string(body))
}const url = 'https://external-api.moja-ai.com/api/v1/campaigns/example';const options = { method: 'PATCH', headers: {'X-API-Key': '<X-API-Key>', 'Content-Type': 'application/json'}, body: '{"name":"example","routing_plan_id":"example","call_flow_id":"example","execution_mode":"routing_plan","is_active":true,"payout":1,"timezone":"America/New_York","conversion_scope":1,"qai_category_id":1,"tcpa_scrubbing":"default","tcpa_scrubbing_config":{"id":"example","api_key":"example","api_version":"v1","api_url":"https://api.blacklistalliance.net/lookup?key=abc123&ver=v1&resp=raw&phone=","allow_calls_on_failure":true},"number_group_items":[{"id":"example","number_id":"example","publisher_id":"example","type":"static","payout":1,"payout_condition":"example","payout_condition_duration":1,"payout_percentage":1,"external_id":"example","is_active":true}],"ivr_payout_rules":[{"id":"example","legacy_rule_id":"example","combinator":"and","payout":0,"filters":[{"field":"keypress","operator":"equals","value":"1"}]}],"outgoing_webhooks":["example"],"incoming_webhooks":["example"],"preconverted_caller":true,"preconverted_destination":true,"preconverted_publisher":true,"preconverted_campaign":true,"external_id":"example","disable_recordings":true,"access_to_call_recordings":true,"expose_ineligible_routes":true,"ineligible_routes_fields":"example","advanced_caps":[{}]}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request PATCH \ --url https://external-api.moja-ai.com/api/v1/campaigns/example \ --header 'Content-Type: application/json' \ --header 'X-API-Key: <X-API-Key>' \ --data '{ "name": "example", "routing_plan_id": "example", "call_flow_id": "example", "execution_mode": "routing_plan", "is_active": true, "payout": 1, "timezone": "America/New_York", "conversion_scope": 1, "qai_category_id": 1, "tcpa_scrubbing": "default", "tcpa_scrubbing_config": { "id": "example", "api_key": "example", "api_version": "v1", "api_url": "https://api.blacklistalliance.net/lookup?key=abc123&ver=v1&resp=raw&phone=", "allow_calls_on_failure": true }, "number_group_items": [ { "id": "example", "number_id": "example", "publisher_id": "example", "type": "static", "payout": 1, "payout_condition": "example", "payout_condition_duration": 1, "payout_percentage": 1, "external_id": "example", "is_active": true } ], "ivr_payout_rules": [ { "id": "example", "legacy_rule_id": "example", "combinator": "and", "payout": 0, "filters": [ { "field": "keypress", "operator": "equals", "value": "1" } ] } ], "outgoing_webhooks": [ "example" ], "incoming_webhooks": [ "example" ], "preconverted_caller": true, "preconverted_destination": true, "preconverted_publisher": true, "preconverted_campaign": true, "external_id": "example", "disable_recordings": true, "access_to_call_recordings": true, "expose_ineligible_routes": true, "ineligible_routes_fields": "example", "advanced_caps": [ {} ] }'Authorizations
Section titled “Authorizations”Parameters
Section titled “Parameters”Path Parameters
Section titled “Path Parameters”campaign_id
required
Campaign Id
string
Header Parameters
Section titled “Header Parameters”Request Bodyrequired
Section titled “Request Bodyrequired”Media typeapplication/json
CampaignPatch
object
tcpa_scrubbing_config
Any of:
CampaignTCPAScrubbingConfig
id is the DB row uuid (campaign_tcpa_scrubbing_configs.uuid) for stable PATCH round-trips.
null
number_group_items
Any of:
Array<object>
CampaignNumberGroupItemWriteWritable number-group fields. Pause is managed via /entity_pause/campaign_numbers.
object
number_id
required
Number Id
string
type
Type
string
is_active
Is Active
boolean
null
ivr_payout_rules
Any of:
Array<object>
CampaignIVRPayoutRuleid is campaign_ivr_payout_rules.uuid; legacy_rule_id is the legacy JSON rule key when distinct.
null
outgoing_webhooks
Any of:
Array<string>
null
incoming_webhooks
Any of:
Array<string>
null
advanced_caps
Any of:
Array<object>
object
key
additional properties
any
null
Responses
Section titled “Responses”Successful Response
Media typeapplication/json
CampaignResponse
object
id
required
Id
string
name
required
Name
string
org_id
required
Org Id
string
execution_mode
required
Execution Mode
string
is_active
required
Is Active
boolean
conversion_scope
required
Conversion Scope
integer
tcpa_scrubbing_config
Any of:
CampaignTCPAScrubbingConfig
id is the DB row uuid (campaign_tcpa_scrubbing_configs.uuid) for stable PATCH round-trips.
null
number_group_items
Number Group Items
Array<object>
CampaignNumberGroupItemid is campaign_number_group_items.uuid (stable row id). Includes pause state on reads.
object
number_id
required
Number Id
string
type
Type
string
is_active
Is Active
boolean
is_paused
Is Paused
boolean
ivr_payout_rules
Ivr Payout Rules
Array<object>
CampaignIVRPayoutRuleid is campaign_ivr_payout_rules.uuid; legacy_rule_id is the legacy JSON rule key when distinct.
outgoing_webhooks
Outgoing Webhooks
Array<string>
incoming_webhooks
Incoming Webhooks
Array<string>
preconverted_caller
Preconverted Caller
boolean
preconverted_destination
Preconverted Destination
boolean
preconverted_publisher
Preconverted Publisher
boolean
preconverted_campaign
Preconverted Campaign
boolean
disable_recordings
Disable Recordings
boolean
access_to_call_recordings
required
Access To Call Recordings
boolean
expose_ineligible_routes
Expose Ineligible Routes
boolean
routing_plan
Any of:
null
advanced_caps
Advanced Caps
Array<object>
object
key
additional properties
any
Example
{ "tcpa_scrubbing_config": { "api_version": "v1", "api_url": "https://api.blacklistalliance.net/lookup?key=abc123&ver=v1&resp=raw&phone=", "allow_calls_on_failure": true }, "number_group_items": [ { "type": "static", "is_active": true, "is_paused": false } ], "ivr_payout_rules": [ { "combinator": "and", "payout": 0, "filters": [ { "field": "keypress", "operator": "equals", "value": "1" } ] } ], "preconverted_caller": false, "preconverted_destination": false, "preconverted_publisher": false, "preconverted_campaign": false, "disable_recordings": false, "expose_ineligible_routes": false}Bad Request
Media typeapplication/json
ErrorResponse
object
detail
required
ErrorBody
object
code
required
Code
string
message
required
Message
string
Examplegenerated
{ "detail": { "code": "example", "message": "example" }}Unauthorized
Media typeapplication/json
ErrorResponse
object
detail
required
ErrorBody
object
code
required
Code
string
message
required
Message
string
Examplegenerated
{ "detail": { "code": "example", "message": "example" }}Not Found
Media typeapplication/json
ErrorResponse
object
detail
required
ErrorBody
object
code
required
Code
string
message
required
Message
string
Examplegenerated
{ "detail": { "code": "example", "message": "example" }}Conflict
Media typeapplication/json
ErrorResponse
object
detail
required
ErrorBody
object
code
required
Code
string
message
required
Message
string
Examplegenerated
{ "detail": { "code": "example", "message": "example" }}Validation Error
Media typeapplication/json
HTTPValidationError
object
detail
Detail
Array<object>
ValidationErrorobject
loc
required
Location
Array
msg
required
Message
string
type
required
Error Type
string
input
Input
ctx
Context
object
Examplegenerated
{ "detail": [ { "loc": [ "example" ], "msg": "example", "type": "example", "input": "example", "ctx": {} } ]}Too Many Requests
Media typeapplication/json
ErrorResponse
object
detail
required
ErrorBody
object
code
required
Code
string
message
required
Message
string
Examplegenerated
{ "detail": { "code": "example", "message": "example" }}
