Skip to main content
This endpoint registers or refreshes a browser’s push subscription for your account. Pacifica sends web_push notifications to every active subscription on the account. Before you call it, get the VAPID public key from Get Web Push config. Then subscribe in the browser with pushManager.subscribe({ userVisibleOnly: true, applicationServerKey: vapid_public_key }).

Operation Type (for Signing)

Request Body

FieldTypeNeedDescriptionExample
”account”stringrequiredUser’s wallet address42trU9A5…
“signature”stringrequiredCryptographic signature5j1Vy9Uq…
“timestamp”integerrequiredCurrent timestamp in milliseconds1716200000000
”installation_id”stringrequiredID that your app generates once for this browser. 32 to 64 characters from A-Z, a-z, 0-9, -, and _k3Jx9_Qm…
“endpoint”stringrequiredThe subscription’s endpoint. An https URL of a supported push service, up to 2048 charactershttps://fcm.googleapis.com/…
“p256dh”stringrequiredThe subscription’s p256dh key, in base64url without paddingBNcRdreA…
“auth”stringrequiredThe subscription’s auth secret, in base64url without paddingtBHItJI5…
“expiration_time_ms”integeroptionalThe subscription’s expirationTime in milliseconds. Leave it out when the browser returns null1735689600000
”vapid_public_key”stringrequiredThe VAPID public key that you subscribed withBF6x0Kq2…
“expiry_window”integeroptionalSignature expiry in milliseconds30000
subscription.toJSON() in the browser gives you endpoint, keys.p256dh, keys.auth, and expirationTime in the right format. You must sign this request with the account key. An agent wallet can’t sign it. Supported Push Services The endpoint host must belong to one of these push services. It must have no port, user name, password, or fragment. Registration Rules
  • installation_id identifies one browser. Store it where the page and the service worker can both read it, for example IndexedDB.
  • When you register again with the same installation_id, Pacifica refreshes the subscription.
  • If the same installation_id registers under another account, the subscription moves to that account.
  • If another account has an active subscription with the same endpoint and a different installation_id, the request fails with status 409. Unregister it from the other account first.
  • An account keeps up to 10 active subscriptions. When you register one more, Pacifica turns off the subscription that was registered longest ago.
  • vapid_public_key must match the current key from Get Web Push config. If it doesn’t, subscribe again with the current key.
After you register, turn on web_push with Set notification master preference and Set notification preference.

Signing

Sign the subscription fields as the data object. The secret goes in data as auth. If you leave out expiration_time_ms, leave it out of data too. For the request above, the message to sign is:

Response

  • Status 200: Subscription registered
FieldTypeDescription
”subscription_id”UUIDSubscription ID. Each push carries it as subscription_id. It stays the same when you register an active subscription again with the same account, endpoint, keys, and VAPID key. Otherwise Pacifica gives a new ID
”vapid_public_key”stringVAPID public key of the subscription
  • Status 400: Invalid request parameters or signature. The error_id field says why:
  • Status 403: The account doesn’t exist. An account exists after its first deposit
  • Status 409: The request conflicts with the current state. The error_id field says why:
  • Status 429: Rate limit exceeded
  • Status 500: Internal server error

Code Example (Python)