# Track product prices from any online shop

> Track product prices, stock status, and catalog metadata from any online store using the ecommerce.product action in the thelastapi web data API.

**You can track product prices from any online shop by sending the product page URL to the `ecommerce.product` action in the thelastapi web data API.** The endpoint visits the page, parses the live catalog data, and returns the current price, currency, availability, and product details as structured JSON. You do not need to write custom HTML parsers, maintain headless browser clusters, or update CSS selectors when an online store changes its layout.

Tracking prices reliably across many different online retailers usually requires custom scraping logic for every store. When stores update their markup, scrapers break. The `ecommerce.product` action normalizes store pages across the web into a predictable data contract.

## What the ecommerce.product action returns

Instead of dumping raw HTML or unstructured text, the action returns an object with the standard attributes needed for price alerts, catalog syncing, and competitive analysis. 

While you can [scrape a website to markdown with one API call](https://thelastapi.dev/blog/scrape-website-to-markdown-api) for general content extraction, the e-commerce action extracts data points directly:

```json
{
  "object": "action_result",
  "action": "ecommerce.product",
  "output": {
    "url": "https://shop.example.com/products/ceramic-mug",
    "title": "Minimalist Ceramic Mug",
    "brand": "Acme Home",
    "price": 24.50,
    "currency": "USD",
    "availability": "in_stock",
    "images": [
      "https://shop.example.com/images/mug-front.jpg",
      "https://shop.example.com/images/mug-handle.jpg"
    ],
    "description": "Handmade ceramic mug with a matte speckled finish.",
    "rating": 4.8,
    "reviewsCount": 112
  },
  "cost_micro_usd": 8500,
  "run_id": "arun_01j8k9m2npq4rstuvw",
  "console_url": "https://thelastapi.dev/web-data?action=ecommerce.product&run=arun_01j8k9m2npq4rstuvw"
}
```

Every response provides clean numbers and strings:

- `price`: A numeric value for the current selling price.
- `currency`: The currency code detected on the page (such as `USD` or `EUR`).
- `availability`: Stock status, indicating whether the product is available to purchase.
- `brand` and `title`: Core catalog names cleaned of common marketing filler.
- `images`: An array of image links found on the product listing.
- `rating` and `reviewsCount`: Customer feedback metrics when displayed on the page.

If you run your own store and track competitor catalogs alongside your own inventory, you can also use AI endpoints to [generate product photos for an online store with an API](https://thelastapi.dev/blog/ai-product-photos-api-ecommerce) once you collect competitor references and styling ideas.

## Fetching a product price via API, CLI, or SDK

You can run the action from your terminal, through direct HTTP calls, or inside an application using `@vibiz/app`.

### Using the CLI

From the terminal, test any URL with `vibiz run`:

```bash
vibiz run ecommerce.product --input '{"url":"https://shop.example.com/products/ceramic-mug"}'
```

To see past runs or inspect the full output of an earlier extraction, run:

```bash
vibiz runs --action ecommerce.product --since 1d
vibiz runs arun_01j8k9m2npq4rstuvw
```

### Using HTTP

Send a JSON POST request to the web data actions endpoint:

```bash
curl https://thelastapi.dev/v1/actions/ecommerce.product \
  -H "Authorization: Bearer $VIBIZ_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"input":{"url":"https://shop.example.com/products/ceramic-mug"}}'
```

If you are running the request in the context of an existing project, use `POST /v1/projects/:id/actions/ecommerce.product` to attribute the action and its spend directly to that project.

### Using the TypeScript SDK

In a project running `@vibiz/app`, call the action directly:

```ts
import { vibiz } from '@vibiz/app';

interface ProductData {
  url: string;
  title: string;
  brand: string;
  price: number;
  currency: string;
  availability: string;
  images: string[];
  description: string;
  rating: number;
  reviewsCount: number;
}

async function checkPrice(targetUrl: string) {
  const result = await vibiz.actions.run('ecommerce.product', {
    url: targetUrl,
  });

  const product = result.output as ProductData;
  console.log(`${product.title} costs ${product.price} ${product.currency}`);
  return product;
}
```

## How to build a continuous price monitoring schedule

Price tracking requires comparing runs over time. You store each snapshot in your database, run the extractor on a schedule, and trigger notifications when values change.

Here is a practical pattern for a tracking worker:

```ts
import { vibiz } from '@vibiz/app';

interface TrackedItem {
  id: string;
  url: string;
  lastPrice: number;
  currency: string;
  inStock: boolean;
}

async function pollItem(item: TrackedItem) {
  try {
    const { output } = await vibiz.actions.run('ecommerce.product', {
      url: item.url,
    });

    const currentPrice = output.price;
    const isAvailable = output.availability === 'in_stock';

    if (currentPrice !== item.lastPrice) {
      console.log(`Price change for ${item.id}: ${item.lastPrice} -> ${currentPrice}`);
      // Record historical price entry and notify user
    }

    if (isAvailable !== item.inStock) {
      console.log(`Stock status changed for ${item.id}: now ${output.availability}`);
      // Record stock change event
    }

    return {
      ...item,
      lastPrice: currentPrice,
      inStock: isAvailable,
    };
  } catch (error) {
    console.error(`Failed to fetch ${item.url}:`, error);
    return item;
  }
}
```

Because every run is tracked in the system, you can open the returned `console_url` or visit the **Web data** tab in your dashboard to view the raw inputs, outputs, timestamps, and cost per request.

## Handling edge cases and error responses

When polling external sites, pages occasionally move, sell out, or disappear. The API returns clear HTTP status codes and structured error bodies so your workers can react cleanly.

| Status code | Error code | When it happens | How to handle it |
| --- | --- | --- | --- |
| `400` | `invalid_request` | The input URL is missing, invalid, or malformed. | Check `details.field` and fix the URL format. |
| `404` | `not_found` | The target store page returned a 404 status code. | Mark the item as discontinued or unlisted in your database. |
| `429` | `rate_limited` | You hit your daily spend ceiling or burst limits. | Check your daily limit in Billing settings; pause until reset. |
| `402` | `payment_required` | The account has run out of credits. | Add credits using `vibiz billing top-up`. |
| `503` | `provider_unavailable` | The target store timed out or failed to load. | Retry with backoff; the timeout limit is 60–150 seconds. |

For example, when a target store removes an item, you receive a `404` status with `not_found`. Catching this allows your app to distinguish between a temporary network hiccup and an item being permanently delisted.

## Tracking costs and daily ceilings

Every successful run returns `cost_micro_usd`, which represents the base cost in micro-dollars ($1 = 1,000,000 micro-dollars). Your account is billed that cost plus the platform margin (30% on web data), drawn directly from your credit balance.

Key safeguards keep your budget predictable:

- **Daily spend ceiling**: Accounts have an account-wide daily limit ($5 default, configurable by the owner in Billing).
- **Usage visibility**: Run `vibiz runs` from the CLI or inspect the **Web data** page to view durations, costs, and outputs for every call.
- **Failures**: A call that fails before starting incurs no charge; a call that times out after starting bills what it used.

If your tracking workflow also inspects competitor sites for search engine changes, you can pair price tracking with [an on-page SEO audit from one API call](https://thelastapi.dev/blog/on-page-seo-audit-api) to evaluate the competitor's technical metadata alongside their pricing changes. Read more about available web extraction endpoints in the [Web data: scrape, search, SEO, ads library](https://thelastapi.dev/docs/actions) documentation.

## Next steps

To start tracking product prices, open your terminal and test a product URL using `vibiz run ecommerce.product --input '{"url":"https://example.com/product"}'`. Once you see the output structure, import `@vibiz/app` into your project and connect the action to your scheduled database jobs.

## Frequently asked questions

### What types of stores work with the ecommerce.product action?

The action is designed to extract pricing, stock status, and metadata from product listings across standard retail websites and independent web stores without requiring custom scrapers.

### How is stock availability represented in the response?

The output returns an `availability` string that indicates whether an item is currently purchaseable, such as `in_stock`.

### Where can I see the cost and history of past product extractions?

Every execution returns a `run_id` and a `console_url`. You can review past runs in the console under the Web data tab, query them via `GET /v1/actions/runs`, or run `vibiz runs --action ecommerce.product` in the CLI.

---

Published 2026-11-15 · https://thelastapi.dev/blog/track-product-prices-any-shop
