Need one? Generate a key →
Authorized as prk_… · requests are scoped to your subscriptions

API reference · v1

Push Relay API

Send Web Push notifications from anything that can make an HTTP request. Generate a demo key, authorize once above, then run any endpoint below against your own browser.

BASE AUTH Bearer <key>
01

Generate a key

Mint a scoped, 24-hour demo key on the Keys page.

02

Subscribe a browser

The demo page registers this browser under your key.

03

Send

Fire a notification and watch it arrive.

Use Push Relay in your own app

Drop it in as your notification backend. Auth is a per-app key pair: a browser-safe publishable key (ppk_…) that only registers subscriptions, and a backend-only secret key (psk_…) that sends. Two small SDKs do the work.

1 · Get keys

The owner provisions an app (with your site's origins allow-listed for the browser-direct path) and hands you the pair — or grab a scoped, 24-hour demo key from the Keys page to try it.

2 · Subscribe in the browser

@bilalhasson/push-relay-browser registers the Service Worker, asks permission, subscribes, and registers the subscription:

npm install @bilalhasson/push-relay-browser
import { PushRelayClient } from "@bilalhasson/push-relay-browser";

const client = new PushRelayClient({ baseUrl: location.origin, publishableKey: "ppk_…" });
await client.subscribe("user-123");
A · browser-direct

Publishable key → straight to Push Relay. Your origin must be allow-listed (CORS). No backend needed to subscribe.

B · backend-proxied

Give the client a registerUrl; it posts the subscription to your backend, which relays it. No CORS.

3 · Send from your backend

With the secret key (never in the browser) — Node or Python:

// Node — @bilalhasson/push-relay
await new PushRelay(baseUrl, "psk_…").send("user-123", { title: "Hello", body: "It works" });

# Python — push-relay
PushRelay(base_url, "psk_…").send("user-123", title="Hello", body="It works")

Published on npm — full API + options in the browser, Node, and Python SDK READMEs.

See it live — a standalone React app subscribing & sending through Push Relay: live demo ↗ · source
POST /api/v1/send requires key

Send a notification

Deliver a notification to every subscription registered under a label. Send now, or schedule with send_at / delay_seconds.

Request body
label*string
Delivers to every subscription under this label.
notification*object
The notification: title (required), body, url, icon, badge, image, tag, actions, actionUrls, badgeCount
ttlinteger
Seconds the push service should retry delivery.
urgencyenum
very-low · low · normal · high
delay_secondsinteger
Send N seconds from now (mutually exclusive with send_at).
Try it
Copy this request for your app
POST /api/v1/subscriptions

Save a browser subscription

Upsert a browser PushSubscription. Pass your demo key to bind it — then the key can send only to the browsers it subscribed.

Request body
label*string
Overridden by the key’s namespace when a key is supplied.
subscription*object
Raw PushSubscription JSON: endpoint + keys.p256dh / auth.
keystring
Optional demo key from POST /keys.
Try it
Copy this request for your app
DELETE /api/v1/subscriptions

Remove a subscription

Unsubscribe one endpoint. Idempotent — removing an unknown or already-removed endpoint still returns 204.

Query parameter
endpoint*string · query
The PushSubscription endpoint to remove.
Try it
Copy this request for your app
POST /api/v1/keys

Generate a demo key

Mint a namespaced, ephemeral demo key. The raw key is returned once, here only — copy it somewhere safe. No body required.

Try it
No key needed — this endpoint is public (rate-limited).
Copy this request for your app
GET /api/v1/vapid-public-key

Get the VAPID public key

The public applicationServerKey the browser passes to pushManager.subscribe(). The only VAPID key the client ever sees.

Try it
Public — no key needed.
Copy this request for your app