Skip to main content
PATCH
/
whatsapp
/
campaigns
/
{_id}
Update draft or scheduled campaign
curl --request PATCH \
  --url https://api.otpiq.com/api/whatsapp/campaigns/{_id} \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "name": "<string>",
  "templateId": "<string>",
  "phoneNumberId": "<string>",
  "scheduledFor": "2023-11-07T05:31:56Z"
}
'
{
  "success": true,
  "data": {
    "_id": "<string>",
    "campaignId": "<string>",
    "name": "<string>",
    "template": "<string>",
    "phoneNumber": "<string>",
    "scheduledFor": "2023-11-07T05:31:56Z",
    "startedAt": "2023-11-07T05:31:56Z",
    "completedAt": "2023-11-07T05:31:56Z",
    "totalRecipients": 123,
    "sentCount": 123,
    "deliveredCount": 123,
    "failedCount": 123,
    "estimatedTotalCost": 123,
    "reservedAmount": 123,
    "reconciledAmount": 123,
    "isSampleCampaign": true,
    "sampleOfCampaign": "<string>",
    "createdAt": "2023-11-07T05:31:56Z",
    "updatedAt": "2023-11-07T05:31:56Z"
  }
}
You can only edit campaigns that are in draft or scheduled status. Campaigns that have already started cannot be modified.

Authorizations

Authorization
string
header
required

Project API key (sk_live… or sk_dev…). Send it as Authorization: Bearer <api_key>.

Path Parameters

_id
string
required

Campaign MongoDB id returned on create

Pattern: ^[a-fA-F0-9]{24}$

Body

application/json
name
string
Required string length: 3 - 80
templateId
string
Pattern: ^[a-fA-F0-9]{24}$
phoneNumberId
string
Pattern: ^[a-fA-F0-9]{24}$
category
enum<string>
Available options:
MARKETING,
UTILITY
scheduleType
enum<string>

Exactly two allowed values:

  • now — save as draft; start manually via POST .../start (scheduledFor not used)
  • schedulerequires scheduledFor (future datetime); saves as scheduled; auto-starts at that time
Available options:
now,
schedule
scheduledFor
string<date-time> | null

ISO-8601 datetime in the future when scheduleType is schedule

Response

Campaign updated

success
enum<boolean>
required
Available options:
true
data
object
required