Skip to content

Public key for browser push

GET
/api/push/vapid-key
curl --request GET \
--url https://foxleague.ai/api/push/vapid-key

Answers the public key a browser needs to subscribe to push notifications. public_key is null when push notifications are not available; the app then hides the option.

Who: anyone.

Refusals: none.

Success or a refusal: read success (the refusals are in the description).

Media type application/json
object
code

A machine-readable reason next to error, set only where the caller must act differently. tx_pending: the payment was not refused but could not be verified yet; keep the transaction hash and confirm again with the same hash, never pay twice.

string | null
data

The answer. Present when success is true.

object
public_key

The public key (base64url) to pass to the browser’s push subscription; null when push notifications are not available.

string | null
error

Why the request was refused, in plain words. Present when success is false.

string | null
success
required

true when the request did what it asked. false is a refusal: read error.

boolean
Example
{
"data": {
"public_key": "BOq8xS3m0kq2p3Vf7mBf1yJxYzQk9n4c2Hq6WlYtD5r8UoE1aZcXvB7nM0sK3pL6dF9gH2jR5tW8yA1bC4eG7iI"
},
"success": true
}