Skip to content

API reference / Cancel a notification

Cancel a notification

Cancel a scheduled notification before it is released.

DELETE/v1/notifications/{id}
Auth API key: Authorization: Bearer sk_live_… or sk_test_…

Cancels a notification that is still scheduled, so it is never released. Any key of the project can cancel any of its scheduled notifications, live or test. See Scheduling.

  • Cancelling costs nothing. A scheduled notification is billed when it is released, so a cancelled one never creates attempts and never counts toward usage.
  • Only scheduled notifications can be cancelled. Once a notification is sent, or was already cancelled or dropped, the request fails with 409 NOT_SCHEDULED and nothing changes.
  • The cancelled notification stays readable with Get a notification, with state set to cancelled.

Request#

Headers#

Authorization
stringrequired
An API key of the project that sent the notification.
Rules
Bearer sk_live_… or Bearer sk_test_…

Path parameters#

id
stringrequired
The id from the send response.
Rules
UUID

Response#

200 OK once the notification is cancelled:

id
stringrequired
The notification's id.
Rules
UUID
state
stringrequired
The notification's new state.
Rules
Always cancelled

Errors#

CodeHTTPWhen
UNAUTHORIZED401The Authorization header is missing, or the key is malformed, unknown or revoked.
FORBIDDEN403A live key was sent from a browser: the request carries an Origin header. Call the API from your server, or use a test key.
PROJECT_SUSPENDED403The key's project is suspended.
NOT_FOUND404The id is not a UUID, belongs to another project, or the notification was deleted after 90 days.
NOT_SCHEDULED409The notification is not scheduled: it was already released, cancelled or dropped.
RATE_LIMITED429The key, project or account went over its per-minute limit. Cancels count like sends.
INTERNAL_ERROR500Something failed on Push's side. It is safe to retry.

Example#

⫻

curl

curl -X DELETE https://api.meslzy.com/push/v1/notifications/0199b1c2-7a4e-7c3d-9f1e-2b6a8d4c5e10 \  -H "Authorization: Bearer $PUSH_API_KEY"

⫻

200 OK

HTTP/1.1 200 OKContent-Type: application/jsonX-Request-Id: req_0199b1c27a4e7c3d9f1e2b6a8d4c5e11
{  "id": "0199b1c2-7a4e-7c3d-9f1e-2b6a8d4c5e10",  "state": "cancelled"}

Cancelling a notification that was already released:

⫻

409 Conflict

HTTP/1.1 409 ConflictContent-Type: application/jsonX-Request-Id: req_0199b1c27a4e7c3d9f1e2b6a8d4c5e11
{  "error": {    "code": "NOT_SCHEDULED",    "message": "Only a scheduled notification can be cancelled",    "requestId": "req_0199b1c27a4e7c3d9f1e2b6a8d4c5e11"  }}