Back to blog

How to Monitor Competitor Inventory in E-Commerce

March 6, 2026 · 7 min read

When a competitor goes out of stock, their customers don't stop shopping — they go somewhere else. That somewhere else should be you. Inventory monitoring turns competitor stockouts into a predictable acquisition channel.

Why Inventory Monitoring Matters

Most e-commerce teams track competitor prices but ignore inventory. That's a missed opportunity. Here's what inventory signals tell you:

  • Stockouts: Competitor is out of a popular item — capture demand by boosting your ads for that product
  • Restocks: They've sourced supply again — you have a window before they're competitive again
  • Low stock warnings: “Only 3 left” signals often precede a full stockout in days
  • Seasonal patterns: When competitors stock up tells you what they expect to sell
  • Discontinuations: Products that disappear permanently reveal strategy shifts

Setting Up Inventory Monitoring

ShelfRun tracks stock levels alongside prices, so you get a complete picture of competitor operations. Here's how to set it up:

import requests

API_KEY = "sr_live_your_key"

# Add competitor store with hourly sync for inventory sensitivity
store = requests.post(
    "https://api.shelfrun.com/v1/stores",
    headers={"X-API-Key": API_KEY},
    json={
        "url": "competitor.com",
        "sync_frequency": "hourly",
        "webhook_url": "https://yourapp.com/inventory-webhook"
    }
).json()

store_id = store["store_id"]
print(f"Monitoring: {store_id}")

Detecting Stockouts in Real Time

When ShelfRun syncs a store, it compares the current snapshot to the previous one and fires a webhook on any change, including stock status changes:

// Webhook payload when competitor goes out of stock:
{
  "event": "stock_change",
  "store": "competitor.com",
  "product": "Premium Widget Pro",
  "sku": "WGT-PRO-001",
  "old_stock": "in_stock",
  "new_stock": "out_of_stock",
  "product_url": "https://competitor.com/products/widget-pro",
  "timestamp": "2026-03-06T14:23:00Z"
}

Automating Your Response

Connect the webhook to your ad platform or CRM to automatically act on stockout signals:

from flask import Flask, request
import requests

app = Flask(__name__)

@app.route("/inventory-webhook", methods=["POST"])
def handle_inventory_change():
    data = request.json

    if data["event"] == "stock_change" and data["new_stock"] == "out_of_stock":
        product = data["product"]

        # Option 1: Boost Google Ads bid for this product keyword
        boost_google_ads_bid(product, multiplier=1.5)

        # Option 2: Send Slack alert to sales team
        send_slack_alert(f"🎯 Opportunity: {product} is OOS on competitor.com!")

        # Option 3: Enable your own 'in stock' badge prominently
        enable_in_stock_badge(product)

    return {"ok": True}

Querying Current Inventory State

You can also query the current inventory state without waiting for a webhook:

import requests

# Get all out-of-stock products from a competitor
products = requests.get(
    f"https://api.shelfrun.com/v1/stores/{store_id}/products",
    headers={"X-API-Key": API_KEY},
    params={"in_stock": "false"}
).json()["products"]

print(f"Competitor has {len(products)} out-of-stock items:")
for p in products:
    print(f"  - {p['name']} (last in stock: {p['last_in_stock']})")

Track Inventory History

ShelfRun stores a full history of stock changes, so you can analyze patterns:

# Get stock history for a specific product
history = requests.get(
    f"https://api.shelfrun.com/v1/stores/{store_id}/history",
    headers={"X-API-Key": API_KEY},
    params={"type": "stock_change", "days": 30}
).json()

# Analyze: how often does competitor go OOS on weekends?
weekend_stockouts = [
    h for h in history["changes"]
    if h["day_of_week"] in ["Saturday", "Sunday"]
    and h["new_stock"] == "out_of_stock"
]

What to Do With Inventory Intelligence

  • Paid search: Increase bids on competitor brand terms when they go OOS
  • Email campaigns: If you have a waitlist, reach out when you're the only one with stock
  • Repricing: You have pricing power when competitors are OOS — consider holding your price
  • Content: Publish “in stock” callouts prominently when competitors struggle
  • Supply chain: If a competitor consistently goes OOS in Q4, order earlier than they do

Related Reading

Start monitoring competitor inventory

Get 5 free API calls. No credit card required.