Fetch Customer Alert Requests

We provide a storefront API endpoint to fetch all alert requests for a customer. This can be useful if you wish to build a management portal in the customer account area.

Fetch Alert Requests

This API only supports logged-in customers

Endpoint

GET https://backinstockalerts.space48apps.com/api/stores/{store_hash}/customers/{jwt}/alert-requests        


Path Parameters

Field Description
store_hash         The store hash of the BigCommerce store
jwt        The JSON Web Token provided by BigCommerce’s Current Customer API when requested using the Back in Stock Alerts Client ID. See example below.

Query Params

Param Description
channel_id       Filter items by the channel
date_range      Filter items by date range. Provide an integer referring to the number of days ago until now. E.g. 30 to show alert requests from the last 30 days, min:1 max:365
status      Filter items by sent      or pending     . 
unsubscribed      Filter items by those that are unsubscribed. Allows true     false     0      1      yes     no     
page      Page number to request out of paginated results. Minimum: 1     
per_page      The number of alert requests to return per page. Minimum 1      Maximum: 100     
sort_by      The sort order for results. Supported values: id_desc     (default) , id_asc     , product_asc     , product_desc      (product name)
currency_code      Determines the format of the price in the product object

Headers

Header Value Description
Accept         application/json         Required header to receive a JSON response.

Response Body

Field Type Description
data     AlertRequest[] A list of zero or more alert requests
meta     Meta Pagination information

AlertRequest

Field Type Description
id      int The unique identifier for an alert request
channel_id      int The BigCommerce channel ID that the alert request was created for
product      Product Product object
notification      Notification If a notification has been created for this alert, a notification object will be present, otherwise it will not be present. 
unsubscribed      timestamp If the customer has unsubscribed from the alert, then this will be set to the date and time when they unsubscribed. 
created_at      string The date and time when the alert request was created. 

Product

Field Type Description
product_id      int The BigCommerce Product ID
product_variant_id      int The BigCommerce Product Variant ID. This will be null if a simple product. 
name      string The name of the product
image_url      string The product image URL
price      string The default price of the product with currency, e.g. $9.99
sku      string The Product SKU
url      string The URL for the product on the storefront.

Notification

Field Type Description
id      int Notification ID
status      string

Status of the notification, e.g. pending      or sent     . 

Pending means that the notification can be sent as the product is back in stock and purchaseable, but it hasn’t been dispatched yet. `sent is when the email has been sent. 

created_at      string The date and time when the notification was created. 

Meta

Field Type Description
total      int The total number of items found
count      int The total number of items in the current page
per_page      int The maximum number of items per page
current_page      int The current page
total_pages      int The total number of pages. 

Example Response

{
    "data": [
        {
            "id": 483,
            "channel_id": 1,
            "created_at": "2025-11-20 10:30:06",
            "product": {
                "product_id": 11135,
                "product_variant_id": 23303,
                "name": "Organic Slug Stop Pellet Barrier Pouch",
                "sku": "430174",
                "url": "https:\/\/space48-tom.mybigcommerce.com\/products\/organic-slug-stop-pellet-barrier-pouch",
                "image_url": "https:\/\/backinstockalerts.space48apps.com\/img\/ProductDefault.gif",
                "price": "8.95\u00a3"
            },
            "notification": null,
            "unsubscribed": "2025-11-20 10:30:37"
        },
        {
            "id": 482,
            "channel_id": 1,
            "created_at": "2025-11-20 10:26:42",
            "product": {
                "product_id": 86,
                "product_variant_id": null,
                "name": "[Sample] Able Brewing System",
                "sku": "ABS",
                "url": "https:\/\/space48-tom.mybigcommerce.com\/able-brewing-system",
                "image_url": "https:\/\/cdn11.bigcommerce.com\/s-7zh8t3rjik\/products\/86\/images\/286\/ablebrewingsystem4.1566917391.386.513.jpg?c=1",
                "price": "225.00\u00a3"
            },
            "notification": null,
            "unsubscribed": null
        }
    ],
    "meta": {
        "total": 2,
        "count": 2,
        "per_page": 25,
        "current_page": 1,
        "total_pages": 1
    }
}

Sample Code


Fetching a Current Customer JWT

The first step before making a request to the Back in Stock Alerts API for this endpoint is to request a JWT from BigCommerce to identify the currently logged-in customer using the Current Customer API.


const app_client_id = '9s57chpu0tik4pw7wz9d2p022qnff6n'; // Back in Stock Alerts Client ID

const fetchCustomerJWT = async (app_client_id) => {

    const response = await fetch(
        '/customer/current.jwt?app_client_id=' + app_client_id
    );

    if (!response.ok) {
        if (response.status === 404) {
            return new Error('Customer not logged in.');
        }

        return new Error('Unable to identify customer');
    }

    return await response.text();
}

const jwt = await fetchCustomerJWT(app_client_id);

Then, you can use this JWT to fetch all alert requests for this customer:

const fetchAlertRequests = async (store_hash, jwt, filters = {}) => {
    // Build query string from filters
    const params = new URLSearchParams(filters).toString();
    const url = "https://backinstockalerts.space48apps.com/api/stores/" + store_hash + "/customers/" + jwt + "/alert-requests" + (params ? "?" + params : "");

    const response = await fetch(url, {
        headers: { Accept: "application/json" },
    });

    if (!response.ok) {
        if (response.status === 404) {
            return new Error(response?.data?.error || "Sorry, no alert requests found.");
        } else if (response.status === 402) {
            return new Error(response?.data?.error || "A subscription to Back in Stock Alerts is required to perform this action.");
        }
        return new Error("Unable to fetch alert requests.");
    }

    return await response.json();
};

// Example usage
const store_hash = "nqivp06qsb"; // Change for your store 
const app_client_id = "9s57chpu0tik4pw7wz9d2p022qnff6n"; // Back in Stock Alerts
const jwt = await fetchCustomerJWT(app_client_id);

const alerts = await fetchAlertRequests(store_hash, jwt, {
    page: 1,
    per_page: 20,
    status: "pending", // optional filter
});
Did this answer your question? Thanks for the feedback There was a problem submitting your feedback. Please try again later.

Still need help? Contact Us Contact Us