Cancel Campaign
Cancel a Scheduled, Queued, or Sending campaign. Emails that have already been handed off for delivery cannot be recalled — cancellation only prevents emails that have not yet been dispatched.
Endpoint
POST /email/campaigns/:id/cancel
Returns: 200 OK
Prerequisites
Cancellation Limits
Cancellation only stops emails that have not yet been handed off for delivery. Recipients who already received the email will not be affected. Campaigns in Sent, Failed, or Cancelled status cannot be cancelled again.
Path Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
id | string | Yes | The campaign ID. |
Headers
| Header | Value | Required |
|---|---|---|
Authorization | Bearer <your-api-key> | Yes |
Response
{
"message": "Campaign cancelled"
}
Examples
- cURL
- JavaScript
- Python
- C#
- PHP
curl -X POST "https://api.arsel.sa/v1/email/campaigns/0192a1b2-c3d4-7e5f-9000-abcdef123456/cancel" \
-H "Authorization: Bearer be_your_api_key"
const campaignId = "0192a1b2-c3d4-7e5f-9000-abcdef123456";
const response = await fetch(
`https://api.arsel.sa/v1/email/campaigns/${campaignId}/cancel`,
{
method: "POST",
headers: { Authorization: "Bearer be_your_api_key" },
}
);
const result = await response.json();
console.log(result.message); // "Campaign cancelled"
import requests
campaign_id = "0192a1b2-c3d4-7e5f-9000-abcdef123456"
response = requests.post(
f"https://api.arsel.sa/v1/email/campaigns/{campaign_id}/cancel",
headers={"Authorization": "Bearer be_your_api_key"},
)
result = response.json()
print(result["message"]) # "Campaign cancelled"
using var client = new HttpClient();
client.DefaultRequestHeaders.Add("Authorization", "Bearer be_your_api_key");
var campaignId = "0192a1b2-c3d4-7e5f-9000-abcdef123456";
var response = await client.PostAsync(
$"https://api.arsel.sa/v1/email/campaigns/{campaignId}/cancel",
null
);
var result = await response.Content.ReadAsStringAsync();
Console.WriteLine(result);
<?php
$campaignId = "0192a1b2-c3d4-7e5f-9000-abcdef123456";
$ch = curl_init("https://api.arsel.sa/v1/email/campaigns/{$campaignId}/cancel");
curl_setopt($ch, CURLOPT_HTTPHEADER, [
"Authorization: Bearer be_your_api_key"
]);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, "");
$response = curl_exec($ch);
echo $response;
curl_close($ch);
Error Responses
- 400 Bad Request
- 401 Unauthorized
- 404 Not Found
{
"status_code": 400,
"name": "bad_request",
"message": "Campaign cannot be cancelled 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"
}