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 be_your_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: {
"Content-Type": "application/json",
Authorization: "Bearer be_your_api_key",
},
body: JSON.stringify({ installation_id: "install-abc123" }),
},
);
const result = await response.json();
console.log(result.status);
import requests
response = requests.post(
"https://api.arsel.sa/v1/push/devices/unregister",
headers={
"Content-Type": "application/json",
"Authorization": "Bearer be_your_api_key",
},
json={"installation_id": "install-abc123"},
)
print(response.json()["status"])
using var client = new HttpClient();
client.DefaultRequestHeaders.Add("Authorization", "Bearer be_your_api_key");
var json = System.Text.Json.JsonSerializer.Serialize(
new { installation_id = "install-abc123" });
var content = new StringContent(json, System.Text.Encoding.UTF8, "application/json");
var response = await client.PostAsync(
"https://api.arsel.sa/v1/push/devices/unregister", content);
Console.WriteLine(await response.Content.ReadAsStringAsync());
<?php
$ch = curl_init("https://api.arsel.sa/v1/push/devices/unregister");
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_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode([
"installation_id" => "install-abc123"
]));
echo curl_exec($ch);
curl_close($ch);
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 or missing API key"
}