Skip to main content
Version: 26.01

/o/push/vapid_keys

Endpoint​

/o/push/vapid_keys

Ⓔ Enterprise Only

Overview​

Generates a new VAPID public and private key pair for web push credentials. The keys are only returned, not saved. They are stored only when you save them as the app's push credentials.

Authentication​

Pass api_key or auth_token as a query parameter, or send countly-token as a header. See Authentication.

Permissions​

Requires Read permission for Push Notifications.

Request Parameters​

ParameterTypeRequiredDescription
api_keyStringYes*API key authentication
auth_tokenStringYes*Session token authentication
app_idObjectIDYesApp ID

* Provide either api_key or auth_token.

Examples​

Generate a key pair​

https://your-server.com/o/push/vapid_keys
?api_key=YOUR_API_KEY
&app_id=6991c75b024cb89cdc04efd2

Response​

Success Response​

{
"publicKey": "BPublicKeyBase64Url",
"privateKey": "PrivateKeyBase64Url"
}

Response Fields​

FieldTypeDescription
publicKeyStringVAPID public key, base64-url encoded.
privateKeyStringVAPID private key, base64-url encoded.

Error Responses​

500 Internal Server Error

{
"result": {
"errors": ["Failed to generate VAPID keypair"]
}
}

Behavior​

  1. Generates a new key pair on every call.
  2. Does not save the keys.

Impact on Other Data​

This endpoint does not modify data.