Skip to main content

Unsubscribe customer from an alert request

Use this endpoint to let a logged-in customer remove an alert request from a storefront preference centre. First fetch the customer's requests to obtain the alert-request ID.

info

This endpoint supports logged-in customers only. The customer JWT must be requested with the Back in Stock Alerts client ID.

Request​

DELETE https://backinstockalerts.hypaapps.com/api/stores/{store_hash}/customers/{jwt}/alert-requests/{id}
Accept: application/json
Path parameterDescription
store_hashBigCommerce store hash.
jwtToken returned by BigCommerce's Current Customer API.
idAlert-request ID returned by the fetch endpoint.

A successful request returns 204 No Content with an empty body.

Example JavaScript​

Use the same JWT flow and public app client ID described in Fetch customer alert requests.

async function deleteAlertRequest(storeHash, jwt, alertRequestId) {
const endpoint = `https://backinstockalerts.hypaapps.com/api/stores/${storeHash}/customers/${jwt}/alert-requests/${alertRequestId}`;
const response = await fetch(endpoint, {
method: 'DELETE',
headers: {Accept: 'application/json'},
});

if (!response.ok) {
const body = await response.json().catch(() => ({}));
throw new Error(body.error || 'Unable to unsubscribe from the alert request.');
}

return response.status === 204;
}

const removed = await deleteAlertRequest('abc123', jwt, 12345);

After a successful response, remove the request from the customer interface without waiting for another page load.