/v1/workspaces/{workspace_id}/channels/webpush/vapid-keysAuthGenerate the web push VAPID key
Generates a P-256 key pair for web push (RFC 8292) and returns its public key; the private key is stored encrypted and never returned. If the workspace already has a key, this rotates it and needs `confirm: "rotate"`: every existing browser subscription stops working and every web push device is marked `invalid` (`vapid_rotated`) until the browser subscribes again with the new key.
Path parameters
workspace_id*string · uuidId of the workspace.
Headers
Idempotency-KeystringA key (1..256 chars, [A-Za-z0-9._:-]) makes retries safe: a replay returns the original response for 24 h.
Request body
confirmenum (1)Required when the workspace already has a VAPID key: replacing it orphans every existing browser subscription (they were made with the old public key). Every web push device is marked `invalid` (`vapid_rotated`) and must subscribe again with the new key; the `@productcraft/notify-js` service worker does this on `pushsubscriptionchange`.
Response · 201 The new active key.
credential_id*string · uuidThe credential id of the key pair.
public_key*stringThe public key (base64url, uncompressed P-256). Pass it as `applicationServerKey` to `pushManager.subscribe`.
origin*object`generated` by Notify, or `imported` from another provider.
fingerprint*stringFirst 16 hex characters of the SHA-256 of the private key; the private key itself is never returned.
created_at*string · date-timeWhen this key became active.
devices_invalidated*integerWeb push devices marked `invalid` (`vapid_rotated`) because this call replaced the previous key; 0 when nothing was replaced.
Example
Request
POST https://api.notify.productcraft.co/v1/workspaces/{workspace_id}/channels/webpush/vapid-keys
Authorization: Bearer YOUR_TOKEN
Content-Type: application/json
{
"confirm": "rotate"
}Response
{
"credential_id": "00000000-0000-0000-0000-000000000000",
"public_key": "string",
"origin": {},
"fingerprint": "string",
"created_at": "2026-01-01T00:00:00.000Z",
"devices_invalidated": 0
}