Messaging

Get the Web Push public key (public)

Public read of the VAPID application-server public key a browser needs to subscribe with `pushManager.subscribe({ applicationServerKey })`. This is the one Web Push route that needs no authentication - the public key is designed to be exposed to browser clients. It returns only this project's own key. When the project has not enabled native Web Push, `enabled` is `false` and `publicKey` is `null`.

AuthPublic
GroupMessaging
Rate limitSee Rate Limits
GET/api/messaging/projects/{projectId}/messaging/web-push/public-key

SDK setup

Create a client instance. No authentication is required for this endpoint.

import { Configuration, MessagingApi } from 'mudbase-sdk';

const configuration = new Configuration({
  basePath: 'https://cloud.mudbase.dev',
});

const messaging = new MessagingApi(configuration);
import { Configuration, MessagingApi } from 'mudbase-sdk';

const configuration = new Configuration({
  basePath: 'https://cloud.mudbase.dev',
});

const messaging = new MessagingApi(configuration);

Example request

Call this endpoint using the client from SDK setup. Use View HTTP for a raw cURL example.

const { data: result } = await messaging.getProjectVapidPublicKey("proj_LidzlbM1jLQh");
const { data: result } = await messaging.getProjectVapidPublicKey("proj_LidzlbM1jLQh");

Playground

live

Test this endpoint with your own credentials. Your requests will be sent to the live API.

No Request Yet

Send a request to see the full inspector

Authentication

Public - No Auth Required

Path Parameters

NameTypeRequiredDescription
projectIdstringYes-

Responses

200Public application-server key (or disabled)

Native Web Push enabled

json
{
  "success": true,
  "data": {
    "enabled": true,
    "publicKey": "BJ8example-vapid-public-key-base64url-encoded-application-server-key9xY"
  }
}
{
  "success": true,
  "data": {
    "enabled": true,
    "publicKey": "BJ8example-vapid-public-key-base64url-encoded-application-server-key9xY"
  }
}

Native Web Push not enabled

json
{
  "success": true,
  "data": {
    "enabled": false,
    "publicKey": null
  }
}
{
  "success": true,
  "data": {
    "enabled": false,
    "publicKey": null
  }
}
404-

Errors

CodeMeaning
404-
Edit this page on GitHub
Chat with us