E-commerce

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

  1. 1Discovery: Fetch a paginated list of products for your landing or search pages.
  2. 2Filtering: Narrow results using collection or category slugs to build navigation.
  3. 3Optimization: Use fields to request only what you need (e.g. title, price) for faster mobile loads.
  4. 4Hydration: Retrieve a single product by slug or ID to 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.

Security: Public Keys (`pk_live`) are restricted from viewing draft or archived products.

Request Configuration

Parameters
page
integer

The page number for pagination. Starts at 1.

Default:1
limit
integer

Number of items to return per page. Hard limit of 50 items.

Default:20
search
string
Excluded

Search term. Filters by Product Title or Slug (case-insensitive partial match). Hard limit of 32 characters long.

status
(published | draft | archived)

Filter by lifecycle status. Options: published, draft, archived, all. Note: Public Keys are forced to "published".

Default:published
include
string
Excluded

Sideload related resources to avoid N+1 queries. Comma-separated. Options: variants, collection.

fields
string
Excluded

Sparse Fieldset. Return only specific fields to reduce payload size. Comma-separated. e.g. id,title,price

collection
string
Excluded

Filter by Collection Slug. e.g. summer-sale

category
string
Excluded

Filter by Category Slug. e.g. mens-wear

Live Console
GET/products?page=1&limit=20&status=published
Hit Run to test this endpoint
cURL

Implementation: Fetching Lists

JavaScript
  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.

:key

Request Configuration

Parameters
include
string

Sideload related resources. Comma-separated. Options: variants, collection.

Default:variants
Live Console
GET/products/:key?include=variants
Hit Run to test this endpoint
cURL

Implementation: Product Details

JavaScript
  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);
      }
  };