PRICIUM
All posts
apiproduct variationspricingdeveloper guideecommerce

How to Get Accurate Product Prices for All Variations Using an API

A practical developer guide to fetching variation-specific product pricing - size, color, config - through a single API call. No scraping infrastructure required.

Aman Patel

Aman Patel

Founder & CEO

2026-04-08 8 min read

The Challenge: One URL, Many Products

Visit any popular e-commerce listing and what you find is not one product but many - each variation (color, size, storage, bundle) is a distinct SKU with its own price and availability. Yet they all live under a single URL.

Fetching accurate prices for all of those variations used to require building complex browser automation pipelines. Today, it takes a single API call.

What You'd Have to Build Without an API

To collect variation-specific pricing yourself, you'd need:

  1. A headless browser (Playwright, Puppeteer) to execute JavaScript
  2. Logic to find and click every variation swatch on the page
  3. Price extraction from the dynamically updated DOM after each click
  4. Anti-bot handling - delays, user agents, CAPTCHA solving
  5. Proxy rotation across residential IPs
  6. Retry logic for failed or blocked requests
  7. A structured parser to normalize all the raw data

That's weeks of engineering for a single retailer - and each retailer has its own page structure that breaks with every site update.

Using the Pricium API Instead

Pricium abstracts all of this. Here's a complete working example:

Step 1: Install the HTTP client (Node.js)

npm install axios

Step 2: Make the API call

const axios = require('axios');

const fetchProductVariations = async (productUrl, location = 'US') => {
  const response = await axios.post(
    'https://api.pricium.store/product-detail',
    { url: productUrl, location },
    {
      headers: {
        'Authorization': `Bearer ${process.env.PRICIUM_API_KEY}`,
        'Content-Type': 'application/json',
      }
    }
  );
  return response.data;
};

// Example usage
const data = await fetchProductVariations('https://amazon.com/dp/B0EXAMPLE');
console.log(data.variations);

Step 3: Parse the response

{
  "product_title": "Levi's Men's 501 Original Fit Jeans",
  "source_url": "https://amazon.com/dp/B0EXAMPLE",
  "currency": "USD",
  "variations": [
    { "size": "30x30", "color": "Dark Stonewash", "price": 49.99, "available": true, "rating": 4.4 },
    { "size": "32x30", "color": "Dark Stonewash", "price": 49.99, "available": true, "rating": 4.4 },
    { "size": "34x32", "color": "Dark Stonewash", "price": 54.99, "available": false, "rating": 4.3 },
    { "size": "30x30", "color": "Light Stonewash", "price": 44.99, "available": true, "rating": 4.5 }
  ],
  "scraped_at": "2026-04-08T09:23:11Z"
}

Every variation. Real prices. Pulled in real time.

Practical Use Cases for This Data

  • Price comparison tables - Show users which variation offers the best value
  • Availability alerts - Notify users when an out-of-stock size comes back
  • AI chatbot responses - Answer "what does this shirt cost in size XL?" accurately
  • Affiliate site enrichment - Serve the most relevant variant price to your users
  • Price history tracking - Store variation-level snapshots over time

Python Example

import requests
import os

def fetch_variations(product_url: str, location: str = "US") -> dict:
    headers = {
        "Authorization": f"Bearer {os.environ['PRICIUM_API_KEY']}",
        "Content-Type": "application/json"
    }
    payload = {"url": product_url, "location": location}
    response = requests.get("https://api.pricium.store/product-detail", json=payload, headers=headers)
    response.raise_for_status()
    return response.json()

data = fetch_variations("https://amazon.com/dp/B0EXAMPLE", location="UK")
for v in data["variations"]:
    print(f"{v['size']} / {v['color']}: £{v['price']} - {'✅' if v['available'] else '❌'}")

Wrapping Up

Getting accurate, variation-specific product pricing used to require building and maintaining significant infrastructure. With the Pricium API, it's a single HTTP call that returns clean, structured JSON data for every variant of any product on any major e-commerce platform.


Get your API key and try it free →

Aman Patel

Written by Aman Patel

Founder & CEO at Pricium