DELETE
/
notifications
/
{message_id}
?app_id=
{app_id}
curl --request DELETE \
  --url 'https://api.onesignal.com/notifications/{message_id}?app_id={app_id}' \
  --header 'Authorization: <authorization>'
{
  "success": true
}

Overview

The Cancel message API can be used to stop scheduled messages from being sent. It does not delete or remove the message from the app. If a message is in the process of sending, then canceling it may not fully prevent all targeted users from receiving it.


How to use this API

This API is most commonly used when sending Transactional messages to individual users, scheduling the message in the future with send_after. The response of our Create message API has an id which corresponds to the message_id used in this request. You can store this message_id on your server and use this API to cancel sending the message to the user if not needed anymore.

If you need a way to remove a notification already sent to a user, see Remove notifications & TTL.


Headers

Authorization
string
default:Key YOUR_APP_API_KEY
required

Your App API key with prefix Key. See Keys & IDs.

Path Parameters

message_id
string
required

The identifier of the message in UUID v4 format. Get this id in the response of your Create Message API request, the View Messages API, and in your OneSignal dashboard Message Reports.

Query Parameters

app_id
string
required

Your OneSignal App ID in UUID v4 format. See Keys & IDs.

Response

200
application/json

200

The response is of type object.