Update Campaign
Update one or more fields of an existing SMS campaign. This is a partial update — only the fields you include in the request body are changed. Omitted fields keep their current values.
Endpoint
PATCH /sms/campaigns/:id
Returns: 200 OK
Prerequisites
Status Restriction
Only campaigns in Draft or Scheduled status can be updated. Campaigns that are Queued, Sending, Sent, Paused, Failed, or Cancelled cannot be modified. Attempting to update a campaign in a non-editable status returns 400 bad_request.
Path Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
id | string | Yes | The campaign ID. |
Headers
| Header | Value | Required |
|---|---|---|
Authorization | Bearer <your-api-key> | Yes |
Content-Type | application/json | Yes |
Body Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
name | string | No | Internal name for the campaign. Max 100 characters. |
description | string | No | Optional description for internal reference. |
content | string | No | SMS message body. Supports {{variables}} from contact properties. |
from | string | No | Registered SMS sender name. Country-specific approval required. |
list_ids | string[] | No | IDs of contact lists whose contacts should receive the campaign. Replaces the existing list. |
tag_ids | string[] | No | IDs of tags whose tagged contacts should receive the campaign. Replaces the existing list. |
Response
{
"id": "0192a1b2-c3d4-7e5f-9000-abcdef123456"
}
Response Fields
| Field | Type | Description |
|---|---|---|
id | string | Unique campaign ID. Use this with GET /sms/campaigns/:id to fetch the full record, or with POST /sms/campaigns/:id/send to send or schedule. |
Examples
- cURL
- JavaScript
- Python
- C#
- PHP
curl -X PATCH "https://api.arsel.sa/v1/sms/campaigns/0192a1b2-c3d4-7e5f-9000-abcdef123456" \
-H "Authorization: Bearer be_your_api_key" \
-H "Content-Type: application/json" \
-d '{
"content": "Last chance — 50% off ends tonight! Shop: {{link}}"
}'
const campaignId = "0192a1b2-c3d4-7e5f-9000-abcdef123456";
const response = await fetch(
`https://api.arsel.sa/v1/sms/campaigns/${campaignId}`,
{
method: "PATCH",
headers: {
"Content-Type": "application/json",
Authorization: "Bearer be_your_api_key",
},
body: JSON.stringify({
content: "Last chance — 50% off ends tonight! Shop: {{link}}",
}),
}
);
const { id } = await response.json();
console.log(id);
import requests
campaign_id = "0192a1b2-c3d4-7e5f-9000-abcdef123456"
response = requests.patch(
f"https://api.arsel.sa/v1/sms/campaigns/{campaign_id}",
headers={
"Content-Type": "application/json",
"Authorization": "Bearer be_your_api_key",
},
json={
"content": "Last chance — 50% off ends tonight! Shop: {{link}}",
},
)
data = response.json()
print(data["id"])
using var client = new HttpClient();
client.DefaultRequestHeaders.Add("Authorization", "Bearer be_your_api_key");
var campaignId = "0192a1b2-c3d4-7e5f-9000-abcdef123456";
var payload = new
{
content = "Last chance — 50% off ends tonight! Shop: {{link}}"
};
var json = System.Text.Json.JsonSerializer.Serialize(payload);
var content = new StringContent(json, System.Text.Encoding.UTF8, "application/json");
var request = new HttpRequestMessage(new HttpMethod("PATCH"),
$"https://api.arsel.sa/v1/sms/campaigns/{campaignId}")
{
Content = content
};
var response = await client.SendAsync(request);
var result = await response.Content.ReadAsStringAsync();
// result: {"id":"..."}
Console.WriteLine(result);
<?php
$campaignId = "0192a1b2-c3d4-7e5f-9000-abcdef123456";
$ch = curl_init("https://api.arsel.sa/v1/sms/campaigns/{$campaignId}");
curl_setopt($ch, CURLOPT_HTTPHEADER, [
"Content-Type: application/json",
"Authorization: Bearer be_your_api_key"
]);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "PATCH");
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode([
"content" => "Last chance — 50% off ends tonight! Shop: {{link}}"
]));
$response = curl_exec($ch);
$data = json_decode($response, true);
echo $data["id"];
curl_close($ch);
Error Responses
- 400 Bad Request
- 401 Unauthorized
- 404 Not Found
- 422 Validation Error
{
"status_code": 400,
"name": "bad_request",
"message": "Campaign cannot be updated in its current status"
}
{
"status_code": 401,
"name": "unauthorized",
"message": "Invalid or missing API key"
}
{
"status_code": 404,
"name": "not_found",
"message": "Campaign not found"
}
{
"status_code": 422,
"name": "validation_error",
"message": "name must not exceed 100 characters"
}