const url = '<base-url>/api/v1/notifications/endpoints';
const options = {
method: 'POST',
headers: {'Content-Type': 'application/json', Authorization: 'Bearer <token>'},
body: JSON.stringify({
channel: 'webpush',
endpoint: 'string',
keys: {auth: 'stringst', p256dh: 'stringstringstri'},
metadata: {property1: null, property2: null}
})
};
fetch(url, options)
.then(res => res.json())
.then(json => console.log(json))
.catch(err => console.error(err));