Change a Campaign

SMS V3 APIs

Change a campaign that has not started: send only what changes, everything else stays.

PATCHhttps://telcomw.com/api/v3/campaigns/42

Put the campaign_id in the URL and send a JSON body with only the fields to change. Your API key goes in the X-API-Key header.

Parameters

Parameter Sent in Required Description
X-API-Key header YES Your API key, sent as a header. You can also send it as Authorization: Bearer YOUR_API_KEY.
campaign_id path YES The id of the campaign.
name body NO A new name.
message body NO A new text.
sender_id body NO A new sender ID (it must be approved on your account).
scheduled_at body NO A new date and time with its time zone, at least one minute from now.
to body NO New phone numbers: they replace the old ones. Send this or group_id.
group_id body NO A phonebook group: its numbers replace the old ones. Send this or to.
skip_invalid body NO true to leave out the phone numbers that are not valid and send to the rest. By default one invalid number rejects the whole request, and nothing is sent or charged.
notify_before body NO true or false: the email before the campaign runs.

Example request

curl --location --request PATCH 'https://telcomw.com/api/v3/campaigns/42' \
  --header 'X-API-Key: YOUR_API_KEY' \
  --header 'Content-Type: application/json' \
  --data '{
  "message": "Our sale starts today and ends on Sunday!",
  "scheduled_at": "2026-11-20T10:00:00+02:00"
}'
curl --location --request PATCH "https://telcomw.com/api/v3/campaigns/42" ^
  --header "X-API-Key: YOUR_API_KEY" ^
  --header "Content-Type: application/json" ^
  --data "{\"message\":\"Our sale starts today and ends on Sunday!\",\"scheduled_at\":\"2026-11-20T10:00:00+02:00\"}"
<?php

$headers = [
    'X-API-Key: YOUR_API_KEY',
    'Content-Type: application/json',
];

$data = [
    'message' => 'Our sale starts today and ends on Sunday!',
    'scheduled_at' => '2026-11-20T10:00:00+02:00'
];

$ch = curl_init('https://telcomw.com/api/v3/campaigns/42');
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'PATCH');
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($data));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);
curl_close($ch);

print_r(json_decode($response, true));
const axios = require('axios');

axios.request({
  method: 'patch',
  url: 'https://telcomw.com/api/v3/campaigns/42',
  headers: {
    'X-API-Key': 'YOUR_API_KEY',
    'Content-Type': 'application/json'
  },
  data: {
    "message": "Our sale starts today and ends on Sunday!",
    "scheduled_at": "2026-11-20T10:00:00+02:00"
  }
}).then((res) => console.log(res.data))
  .catch((err) => console.error(err.response ? err.response.data : err.message));
import requests

headers = {
    'X-API-Key': 'YOUR_API_KEY',
    'Content-Type': 'application/json'
}
payload = {
    'message': 'Our sale starts today and ends on Sunday!',
    'scheduled_at': '2026-11-20T10:00:00+02:00'
}

response = requests.request('PATCH', 'https://telcomw.com/api/v3/campaigns/42', headers=headers, json=payload)
print(response.json())

Response

The response is JSON.

Changed (200)

{
  "success": true,
  "request_id": "req_5f2c9a1d0e7b4a63",
  "data": {
    "campaign_id": 42,
    "name": "November sale",
    "sender_id": "WGIT",
    "message": "Our sale starts today and ends on Sunday!",
    "status": "scheduled",
    "scheduled_at": "2026-11-20T07:00:00.000Z",
    "recipients_source": "numbers",
    "group_id": null,
    "recipients": 2,
    "queued": 0,
    "failed": 0,
    "cost": 0,
    "currency": "MWK",
    "notify_before": true,
    "batch_ids": [],
    "error": null,
    "started_at": null,
    "completed_at": null,
    "created_at": "2026-11-05T09:12:44.000Z",
    "estimate": {
      "pages": 2,
      "cost": 40,
      "balance": 4250.5,
      "enough": true,
      "currency": "MWK"
    }
  }
}

Already started (409)

{
  "success": false,
  "request_id": "req_5f2c9a1d0e7b4a63",
  "error": {
    "code": "CAMPAIGN_NOT_EDITABLE",
    "message": "This campaign is running. Only a scheduled campaign can be changed."
  }
}

Fields explained

FieldDescription
successtrue when the request worked.
request_idThe number of this request. Quote it if you contact us.
data.campaign_idThe id of the campaign. Use it in the other campaign calls.
data.statusscheduled, running, completed, failed or cancelled.
data.scheduled_atWhen the campaign runs (UTC).
data.recipients_sourcenumbers (a list you sent) or group (a phonebook group).
data.recipientsHow many numbers the campaign has.
data.queuedAfter it ran: how many messages were queued for delivery.
data.failedAfter it ran: how many could not be queued.
data.costAfter it ran: what it cost, in MWK. 0 before.
data.errorWhy a failed campaign failed, otherwise null.

Good to know

  • Only a campaign that is still scheduled can be changed. If you change the time, the email before it is sent again for the new time.