Skip to main content
PATCH
/
v1
/
campaigns
/
{campaign_id}
Update a campaign
curl --request PATCH \
  --url https://api.openmic.ai/v1/campaigns/{campaign_id} \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "name": "<string>",
  "from_number": "<string>",
  "time_start": "<string>",
  "time_end": "<string>",
  "timezone": "<string>",
  "contact_list_id": 123,
  "days": []
}
'
import requests

url = "https://api.openmic.ai/v1/campaigns/{campaign_id}"

payload = {
"name": "<string>",
"from_number": "<string>",
"time_start": "<string>",
"time_end": "<string>",
"timezone": "<string>",
"contact_list_id": 123,
"days": []
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}

response = requests.patch(url, json=payload, headers=headers)

print(response.text)
const options = {
method: 'PATCH',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
name: '<string>',
from_number: '<string>',
time_start: '<string>',
time_end: '<string>',
timezone: '<string>',
contact_list_id: 123,
days: []
})
};

fetch('https://api.openmic.ai/v1/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.openmic.ai/v1/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' => '<string>',
'from_number' => '<string>',
'time_start' => '<string>',
'time_end' => '<string>',
'timezone' => '<string>',
'contact_list_id' => 123,
'days' => [

]
]),
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://api.openmic.ai/v1/campaigns/{campaign_id}"

payload := strings.NewReader("{\n \"name\": \"<string>\",\n \"from_number\": \"<string>\",\n \"time_start\": \"<string>\",\n \"time_end\": \"<string>\",\n \"timezone\": \"<string>\",\n \"contact_list_id\": 123,\n \"days\": []\n}")

req, _ := http.NewRequest("PATCH", 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.patch("https://api.openmic.ai/v1/campaigns/{campaign_id}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"<string>\",\n \"from_number\": \"<string>\",\n \"time_start\": \"<string>\",\n \"time_end\": \"<string>\",\n \"timezone\": \"<string>\",\n \"contact_list_id\": 123,\n \"days\": []\n}")
.asString();
require 'uri'
require 'net/http'

url = URI("https://api.openmic.ai/v1/campaigns/{campaign_id}")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Patch.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"<string>\",\n \"from_number\": \"<string>\",\n \"time_start\": \"<string>\",\n \"time_end\": \"<string>\",\n \"timezone\": \"<string>\",\n \"contact_list_id\": 123,\n \"days\": []\n}"

response = http.request(request)
puts response.read_body
{
  "id": 123,
  "name": "<string>",
  "type": "outbound",
  "bot_uid": "<string>",
  "from_number": "<string>",
  "contact_list_id": 123,
  "time_start": "<string>",
  "time_end": "<string>",
  "timezone": "<string>",
  "days": [],
  "current_index": 123,
  "total_contacts": 123,
  "created_at": "2023-11-07T05:31:56Z",
  "updated_at": "2023-11-07T05:31:56Z"
}

Authorizations

Authorization
string
header
required

API key authentication. Include your API key in the Authorization header as: Authorization: Bearer <your-api-key>

Path Parameters

campaign_id
integer
required

Body

application/json

All fields are optional. Only provided fields will be updated.

name
string

Campaign name.

Maximum string length: 255
from_number
string

Phone number to dial from in E.164 format.

time_start
string

Start time for the calling window in HH:MM format (e.g. "09:00").

Pattern: ^([0-1][0-9]|2[0-3]):[0-5][0-9]$
time_end
string

End time for the calling window in HH:MM format (e.g. "17:00").

Pattern: ^([0-1][0-9]|2[0-3]):[0-5][0-9]$
timezone
string

IANA timezone for the calling window.

contact_list_id
integer

ID of the contact list to dial.

days
enum<string>[]

Days of week to run the campaign (e.g. ["Monday", "Wednesday", "Friday"]). Note: When setting days, time_start and time_end must also be provided (either in the same request or already set on the campaign).

Available options:
Monday,
Tuesday,
Wednesday,
Thursday,
Friday,
Saturday,
Sunday

Response

Updated campaign

id
integer

Unique identifier.

name
string

Campaign name.

type
enum<string>

Campaign type (always outbound).

Available options:
outbound
status
enum<string>

Current campaign status.

Available options:
Scheduled,
Running,
Stopped,
Completed,
Failed,
Expired,
Paused
bot_uid
string

Bot UID for API reference.

from_number
string

Phone number used to dial from (E.164 format).

contact_list_id
integer

Associated contact list ID.

time_start
string

Daily calling window start time in HH:MM format.

time_end
string

Daily calling window end time in HH:MM format.

timezone
string

Calling window timezone (IANA format).

days
enum<string>[]

Days of week the campaign runs on (for recurring campaigns).

Available options:
Monday,
Tuesday,
Wednesday,
Thursday,
Friday,
Saturday,
Sunday
schedule_type
enum<string>

Schedule type: single (one-time) or multi (recurring on specific days).

Available options:
single,
multi
current_index
integer

Number of contacts already called.

total_contacts
integer

Total number of contacts in the campaign's contact list.

created_at
string<date-time>
updated_at
string<date-time>