Unregister Device
Revoke a device so it stops receiving push notifications.
Endpoint
POST /push/devices/unregister
Returns: 200 OK
The installation id travels in the request body, and a fair number of HTTP clients and proxies silently drop bodies on DELETE requests. POST is the reliable choice.
Headers
| Header | Value | Required |
|---|---|---|
Authorization | Bearer <your-api-key> | Yes |
Content-Type | application/json | Yes |
Body Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
installation_id | string | Yes | The installation to revoke. |
{
"installation_id": "install-abc123"
}
The opt-out is durable
The revocation is recorded as contact_opt_out, and a later Register Device call will not resurrect it — the device stays revoked and the register response reports opted_out: true.
This is intentional. Re-registration happens on every app launch, and a revocation that any of those calls could undo would silently override the user's choice.
The device row is kept as a tombstone rather than deleted, which is what makes the opt-out durable for that installation.
The tombstone is keyed to installation_id. A reinstall generates a new one, so it registers as a new device rather than matching the tombstone.
An opt-out still survives a reinstall in the common case: revoking a contact's last active device also marks the contact unsubscribed from push, and that is never reversed automatically — so a reinstalled app on a fresh installation id is still not sendable.
The exception is a contact who keeps another active device. There the contact stays subscribed, and reinstalling on the opted-out handset makes it reachable again. Call this endpoint again after the reinstall if that handset must stay off.
Response
{
"installation_id": "install-abc123",
"status": "REVOKED"
}
| Field | Type | Description |
|---|---|---|
installation_id | string | Echoed back |
status | string | Always REVOKED |
Examples
- cURL
- JavaScript
- Python
- C#
- PHP
curl -X POST "https://api.arsel.sa/v1/push/devices/unregister" \
-H "Authorization: Bearer $ARSEL_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"installation_id": "install-abc123"
}'
const response = await fetch("https://api.arsel.sa/v1/push/devices/unregister", {
method: "POST",
headers: {
Authorization: `Bearer ${process.env.ARSEL_API_KEY}`,
"Content-Type": "application/json",
},
body: JSON.stringify({
installation_id: "install-abc123",
}),
});
const data = await response.json();
if (!response.ok) {
throw new Error(`${data.name}: ${data.message}`);
}
console.log(data);
import os
import requests
response = requests.post(
"https://api.arsel.sa/v1/push/devices/unregister",
headers={"Authorization": f"Bearer {os.environ['ARSEL_API_KEY']}"},
json={
"installation_id": "install-abc123",
},
)
response.raise_for_status()
print(response.json())
using System.Net.Http.Headers;
using System.Text;
var client = new HttpClient(); // share one instance across requests
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue(
"Bearer", Environment.GetEnvironmentVariable("ARSEL_API_KEY"));
var request = new HttpRequestMessage(HttpMethod.Post, "https://api.arsel.sa/v1/push/devices/unregister")
{
Content = new StringContent(
"""
{
"installation_id": "install-abc123"
}
""",
Encoding.UTF8,
"application/json"),
};
var response = await client.SendAsync(request);
var body = await response.Content.ReadAsStringAsync();
if (!response.IsSuccessStatusCode)
throw new HttpRequestException($"{(int)response.StatusCode}: {body}");
Console.WriteLine(body);
<?php
$ch = curl_init("https://api.arsel.sa/v1/push/devices/unregister");
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer " . getenv("ARSEL_API_KEY"),
"Content-Type: application/json",
],
CURLOPT_POSTFIELDS => json_encode([
"installation_id" => "install-abc123",
]),
]);
$data = json_decode(curl_exec($ch), true);
if (curl_getinfo($ch, CURLINFO_HTTP_CODE) >= 400) {
throw new Exception("{$data['name']}: {$data['message']}");
}
print_r($data);
Error Responses
- 404 Not Found
- 401 Unauthorized
{
"status_code": 404,
"name": "not_found",
"message": "No device with this installation_id is registered for this organization."
}
{
"status_code": 401,
"name": "unauthorized",
"message": "Invalid API Key"
}