API Reference

Push Notifications

Subscribe to web push notifications to get alerted when markets settle, prices move, or your positions change. Uses the Web Push Protocol — works in any browser that supports service workers.

Both endpoints require JWT authentication and anti-replay headers.

Subscribe

POST /v1/push/subscribe
endpointstringrequired

The push endpoint URL from the browser's PushSubscription

keysobjectrequired

The keys object from PushSubscription — contains p256dh and auth

// Get a push subscription from the browser
const registration = await navigator.serviceWorker.ready
const subscription = await registration.pushManager.subscribe({
  userVisibleOnly: true,
  applicationServerKey: VAPID_PUBLIC_KEY
})

// Send to the API
await fetch('https://api.settled.pro/v1/push/subscribe', {
  method: 'POST',
  headers: {
    'Authorization': `Bearer ${jwt}`,
    'X-Request-Nonce': nonce,
    'X-Request-Timestamp': timestamp,
    'Content-Type': 'application/json'
  },
  body: JSON.stringify(subscription.toJSON())
})
curl -X POST https://api.settled.pro/v1/push/subscribe \
  -H "Authorization: Bearer <jwt>" \
  -H "X-Request-Nonce: a3f8b2c1d4e5f69702ab3c4d5e6f7081" \
  -H "X-Request-Timestamp: 1742298600" \
  -H "Content-Type: application/json" \
  -d '{
    "endpoint": "https://fcm.googleapis.com/fcm/send/...",
    "keys": {
      "p256dh": "BGm...",
      "auth": "a8f..."
    }
  }'

Response:

{
  "data": {
    "subscribed": true
  }
}

Unsubscribe

POST /v1/push/unsubscribe
endpointstringrequired

The push endpoint URL to remove

curl -X POST https://api.settled.pro/v1/push/unsubscribe \
  -H "Authorization: Bearer <jwt>" \
  -H "X-Request-Nonce: c5d0e1f2a3b4c5d6e7f8a9b0c1d2e3f4" \
  -H "X-Request-Timestamp: 1742298700" \
  -H "Content-Type: application/json" \
  -d '{"endpoint": "https://fcm.googleapis.com/fcm/send/..."}'

Response:

{
  "data": {
    "unsubscribed": true
  }
}

Notification Events

Once subscribed, you'll receive push notifications for:

EventWhen
Market settledA market you hold positions in has resolved
Settlement payoutUSDC credited to your balance from a win
Deposit confirmedIncoming USDC deposit detected and confirmed
Withdrawal confirmedYour withdrawal has been sent on-chain
← PreviousCrowd PositioningNext →WebSocket