Products Catalog
Access and display your store's inventory. Our Products API is designed for high-performance storefronts, supporting localized pricing, inventory counts, and variant matrices.
Catalog Discovery Workflow
- 1Discovery: Fetch a paginated list of products for your landing or search pages.
- 2Filtering: Narrow results using
collectionorcategoryslugs to build navigation. - 3Optimization: Use
fieldsto request only what you need (e.g. title, price) for faster mobile loads. - 4Hydration: Retrieve a single product by
slugorIDto display full details and variant options.
List Products
Retrieve a paginated list of products. By default, only status: published items are returned to public keys.
draft or archived products. Request Configuration
ParametersThe page number for pagination. Starts at 1.
1Number of items to return per page. Hard limit of 50 items.
20Search term. Filters by Product Title or Slug (case-insensitive partial match). Hard limit of 32 characters long.
Filter by lifecycle status. Options: published, draft, archived, all. Note: Public Keys are forced to "published".
publishedSideload related resources to avoid N+1 queries. Comma-separated. Options: variants, collection.
Sparse Fieldset. Return only specific fields to reduce payload size. Comma-separated. e.g. id,title,price
Filter by Collection Slug. e.g. summer-sale
Filter by Category Slug. e.g. mens-wear
Implementation: Fetching Lists
const getProducts = async (page = 1, search = '') => {
const baseUrl = 'https://api.electivecommerce.com/v1/products';
const params = new URLSearchParams({
page: page.toString(),
limit: '20',
include: 'variants', // Sideload variant data
search: search ,
fields: 'id,title,description'
});
const response = await fetch(`${baseUrl}?${params.toString()}`, {
method: 'GET',
headers: {
'Authorization': 'Bearer pk_live_YOUR_PUBLIC_KEY',
'Content-Type': 'application/json'
}
});
const { success, data, meta } = await response.json();
return data;
};Get Single Product
Retrieve full details for a product, including its full description, image gallery, and variant configurations.
:keyRequest Configuration
ParametersSideload related resources. Comma-separated. Options: variants, collection.
variantsImplementation: Product Details
const getProductDetail = async (slug) => {
const url = `https://api.electivecommerce.com/v1/products/${slug}?include=variants,collection`
const response = await fetch(url, {
method: 'GET',
headers: {
'Authorization': 'Bearer pk_live_YOUR_PUBLIC_KEY',
'Content-Type': 'application/json'
}
});
const { success, data } = await response.json();
if (success) {
console.log('Price:', data.price.formatted);
console.log('Variants:', data.variants.length);
}
};