Cancel Campaign
Cancel a campaign that is scheduled, queued, or actively sending.
Endpoint
POST /push/campaigns/{id}/cancel
Returns: 200 OK
Path Parameters
| Parameter | Type | Description |
|---|---|---|
id | string | Campaign ID |
Headers
| Header | Value | Required |
|---|---|---|
Authorization | Bearer <your-api-key> | Yes |
Which campaigns can be cancelled
| Status | Cancellable |
|---|---|
Scheduled | Yes |
Queued | Yes |
Sending | Yes — remaining batches stop |
Draft | No — it was never sent; delete it instead |
Sent, Failed, Cancelled | No — already terminal |
Cancelling mid-send does not recall what already went
Cancelling a Sending campaign stops the batches that have not started yet. Notifications already handed to FCM or the browser's push service cannot be recalled — they will still arrive.
Cancel as a way to stop the rest, not to undo the beginning.
Response
The cancelled campaign, with status: "Cancelled".
Examples
- cURL
- JavaScript
- Python
- C#
- PHP
curl -X POST "https://api.arsel.sa/v1/push/campaigns/0192a1b2-c3d4-7e5f-9000-abcdef123456/cancel" \
-H "Authorization: Bearer be_your_api_key"
const id = "0192a1b2-c3d4-7e5f-9000-abcdef123456";
const response = await fetch(
`https://api.arsel.sa/v1/push/campaigns/${id}/cancel`,
{ method: "POST", headers: { Authorization: "Bearer be_your_api_key" } },
);
const campaign = await response.json();
console.log(campaign.status);
import requests
campaign_id = "0192a1b2-c3d4-7e5f-9000-abcdef123456"
response = requests.post(
f"https://api.arsel.sa/v1/push/campaigns/{campaign_id}/cancel",
headers={"Authorization": "Bearer be_your_api_key"},
)
print(response.json()["status"])
using var client = new HttpClient();
client.DefaultRequestHeaders.Add("Authorization", "Bearer be_your_api_key");
var id = "0192a1b2-c3d4-7e5f-9000-abcdef123456";
var response = await client.PostAsync(
$"https://api.arsel.sa/v1/push/campaigns/{id}/cancel", null);
Console.WriteLine(await response.Content.ReadAsStringAsync());
<?php
$id = "0192a1b2-c3d4-7e5f-9000-abcdef123456";
$ch = curl_init("https://api.arsel.sa/v1/push/campaigns/$id/cancel");
curl_setopt($ch, CURLOPT_HTTPHEADER, ["Authorization: Bearer be_your_api_key"]);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POST, true);
echo curl_exec($ch);
curl_close($ch);
Error Responses
- 400 Not Cancellable
- 404 Not Found
- 401 Unauthorized
{
"status_code": 400,
"name": "bad_request",
"message": "Cannot cancel a campaign with status \"Sent\""
}
{
"status_code": 404,
"name": "not_found",
"message": "Campaign not found"
}
{
"status_code": 401,
"name": "unauthorized",
"message": "Invalid or missing API key"
}