Skip to content

API reference / Disconnect a browser

Disconnect a browser

How a browser tells Push it no longer wants notifications.

POST/v1/browsers/{id}/disconnect
Auth None. The browser's event token in the body is the credential.

Push's service worker calls this when the browser drops or replaces its push subscription (the pushsubscriptionchange event). As a project owner you disconnect a browser from the recipient's page in the dashboard instead. See disconnects.

Request#

Path parameters#

id
stringrequired
The browser's id, the browserId it received when it connected.
Rules
UUID

Body#

eventToken
stringrequired
The token the browser received when it connected. It must match id.
Rules
1–128 characters

Response#

200 OK with { "ok": true }.

  • The browser is marked disconnected and Push stops sending to it.
  • Calling it for a browser that is already disconnected changes nothing and still returns 200.
  • Attempts still waiting for this browser end as invalid_subscription and leave the month's count.
  • To receive notifications again, the person connects with a new connect link.

Errors#

CodeHTTPWhen
VALIDATION_ERROR400The body is not valid JSON, is over 16,384 bytes or has no valid eventToken.
UNAUTHORIZED401The id is not a UUID or eventToken does not match it. The message is “Invalid event token”.
NOT_FOUND404No browser with that id exists. The message is “Browser not found”.
RATE_LIMITED429More than 300 event and disconnect requests a minute from one IP address. The limit is shared with events.
INTERNAL_ERROR500Something failed on Push's side. It is safe to retry.

Example#

⫻

curl

curl https://api.meslzy.com/push/v1/browsers/0198f0aa-1c2d-7e3f-9a4b-5c6d7e8f9012/disconnect \  -H "Content-Type: application/json" \  -d '{  "eventToken": "kq3Vd9xZr2Lm8Tn4Bw6Yc1Hs7Pf5Gj0Ae2Ui9Ok4Rt8"}'

⫻

200 OK

HTTP/1.1 200 OKContent-Type: application/jsonX-Request-Id: req_0199b1c27a4e7c3d9f1e2b6a8d4c5e11
{  "ok": true}