Update Campaign
Update one or more fields of an existing email 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 /email/campaigns/:id
Returns: 200 OK
Prerequisites
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. |
subject | string | No | Email subject line. Supports {{variables}} from contact properties. |
preheader | string | No | Preview text shown alongside the subject line in email inboxes. |
from_name | string | No | Display name shown alongside the sender address. |
from | string | No | Sender email address. Must belong to a verified domain. |
reply_to | string | No | Reply-to email address. |
template_id | string | No | ID of the email template to use. Create one via POST /templates, copy from the gallery, or use the dashboard. |
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. |
Don't have a template_id yet? Copy any starter design from the gallery in one call: see POST /templates/gallery/:id/copy.
Use {{unsubscribe_link}} anywhere in your template HTML to place a per-recipient tracked unsubscribe link. If your template has no unsubscribe element, a footer is appended automatically at send time. Custom external unsubscribe URLs are not supported. See Send Campaign → Unsubscribe Compliance for full details.
Response
{
"id": "0192a1b2-c3d4-7e5f-9000-abcdef123456"
}
Response Fields
| Field | Type | Description |
|---|---|---|
id | string | Unique campaign ID. Use this with GET /email/campaigns/:id to fetch the full record, or with POST /email/campaigns/:id/send to send or schedule. |
Examples
- cURL
- JavaScript
- Python
- C#
- PHP
curl -X PATCH "https://api.arsel.sa/v1/email/campaigns/0192a1b2-c3d4-7e5f-9000-abcdef123456" \
-H "Authorization: Bearer be_your_api_key" \
-H "Content-Type: application/json" \
-d '{
"subject": "Last Chance: 50% Off Everything!",
"preheader": "Sale ends tonight"
}'
const campaignId = "0192a1b2-c3d4-7e5f-9000-abcdef123456";
const response = await fetch(
`https://api.arsel.sa/v1/email/campaigns/${campaignId}`,
{
method: "PATCH",
headers: {
"Content-Type": "application/json",
Authorization: "Bearer be_your_api_key",
},
body: JSON.stringify({
subject: "Last Chance: 50% Off Everything!",
preheader: "Sale ends tonight",
}),
}
);
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/email/campaigns/{campaign_id}",
headers={
"Content-Type": "application/json",
"Authorization": "Bearer be_your_api_key",
},
json={
"subject": "Last Chance: 50% Off Everything!",
"preheader": "Sale ends tonight",
},
)
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
{
subject = "Last Chance: 50% Off Everything!",
preheader = "Sale ends tonight"
};
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/email/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/email/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([
"subject" => "Last Chance: 50% Off Everything!",
"preheader" => "Sale ends tonight"
]));
$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": "from must be an email"
}