# Product Price Availability (`eichan/product-price-availability`) Actor

- **URL**: https://apify.com/eichan/product-price-availability.md
- **Developed by:** [Eichan Jolly](https://apify.com/eichan) (community)
- **Features:** Limited permissions
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

$3.00 / 1,000 results

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.

Learn more: https://docs.apify.com/actors/running/actors-in-store.md#pay-per-event

## What's an Apify Actor?

An Actor is a serverless cloud program that runs on the Apify platform. It has two run modes.
In Batch mode, an Actor accepts a well-defined JSON input, performs an action which can take anything from a few seconds to a few hours,
and optionally produces a well-defined JSON output, datasets with results, or files in key-value store.
In Standby mode, an Actor provides a web server which can be used as a website, API, or an MCP server.

Apify vocabulary and the platform model are defined once, in the agent quickstart at https://apify.com/agents.md.

## How to integrate an Actor?

If asked about integration, you help developers integrate Actors into their projects.
You adapt to their stack and deliver integrations that are safe, well-documented, and production-ready.

Do not guess an integration path. Every one of them is in the agent quickstart at https://apify.com/agents.md: the Apify MCP server, Agent Skills with the Apify CLI, the JavaScript and Python clients, the REST API, and the account-free path for an agent with no human to sign in. It also carries the rule on stating cost before the first paid run.

For examples already wired to this Actor's own input schema, see the [API](#api) section below.

Each client library has reference documentation the quickstart does not restate: [JavaScript/TypeScript](https://docs.apify.com/api/client/js/docs.md) (`npm install apify-client`) and [Python](https://docs.apify.com/api/client/python/docs.md) (`pip install apify-client`).

# README

## Product Price & Availability Snapshot

**One small job:** Read a **single public HTTPS product page** and output one price/availability snapshot from schema.org Product JSON-LD or from standard public `product:*` meta tags on the **same** HTML page. No crawling, browser, login, Amazon or eBay.

**For:** Merchants, analysts, and product-feed builders who need a bounded, structured snapshot from a URL they supply.

### First-run example (real public product)

The Console **prefill** is:

```json
{"product_url":"https://www.cancork.com/store/wood-bricks-9mm-cork-wall-panels/"}
```

On **2026-11-01**, this live product page was accessible and public head metadata included `product:price:amount=351.66`, `product:price:currency=CAD`, and `product:availability=instock`. The Actor reads those meta tags if JSON-LD lacks a usable offer. The store's prices and stock can change at any moment. A successful network fetch of the original HTML by the Actor has not been tested in the local container or on Apify; the live target was separately checked using a public webpage retrieval service. If the third-party store changes its markup or access rules, replace it with a suitable public product URL.

Example output (illustrative date, based on verified public meta fields):

```json
{"url":"https://www.cancork.com/store/wood-bricks-9mm-cork-wall-panels/","price":"351.66","currency":"CAD","availability":"InStock","checked_at":"2026-11-01T00:00:00Z"}
```

**Output fields:** `url` (supplied URL), `price` (decimal string or null), `currency` (ISO currency or null), `availability` (schema.org normalized term or null), `checked_at` (UTC ISO 8601 run time). One object per run, never a historical database. A `null` indicates unknown, not zero or out-of-stock. JSON-LD is preferred; supported values include `InStock`, `OutOfStock`, `PreOrder`, `BackOrder`, `Discontinued`, etc. With `AggregateOffer`, `lowPrice` is used as the price snapshot when an exact offer price is absent, so it may not represent every variant.

### Run locally (no SDK)

```bash
ACTOR_INPUT_JSON='{"product_url":"https://www.cancork.com/store/wood-bricks-9mm-cork-wall-panels/"}' python src/main.py
```

Or create `storage/key_value_stores/default/INPUT.json`. Results are written to `storage/datasets/default/000000001.json` etc. On Apify, the runtime reads the `INPUT` record and writes the dataset through the Apify REST API, not the SDK.

### Limits and data policy

- One user-supplied public product HTML page; **one GET**, response up to 2 MB, 15-second timeout. No other host, no redirects, no retry, no JavaScript rendering, no pagination. Public HTTPS and DNS validation; no private/local IPs.
- Reads `application/ld+json` scripts for Product `offers.price`, `offers.lowPrice`, `priceSpecification.price`, `priceCurrency` and `availability`, including `@graph`, plus public HTML meta properties `product:price:amount`, `product:price:currency`, `product:availability` as fallback. Does not guess from visible price text or dollar symbols.
- Dynamic JavaScript-only product offers, Shopify variant JSON, currency changes by location, store taxes, shipping, logged-in discounts, and stale structured data are outside scope. A result is **page markup**, not checkout-confirmed inventory or a verified transaction price.
- Errors are simple and no record is invented. Respect store policies. The example is a third-party live URL, not an owned or guaranteed stable demo.
- Includes runnable offline unit tests and an **actual script-mode subprocess smoke test** with a mocked HTTP product page. The fixture is labeled simulated; it is **not** a verified live Apify run.

### Store categories and pricing (proposal only)

- **Apify Store categories (declare on Store listing):** `ECOMMERCE`, `SCRAPING`.
- **Suggested pricing:** **$3 per 1,000 emitted result items** ($0.003/item). Pricing is only a suggestion; nothing is published or billed.

### Verification

From the Actor folder: `python -m unittest discover -s tests -v` and `python tests/smoke.py`. The latter directly invokes **`python src/main.py`**, checks the JSON file, and prints the exact terminal result. See Batch 2's root `VERIFICATION.md`.

# Actor input Schema

## `product_url` (type: `string`):

One public HTTPS product page containing structured offer or product meta data.

## Actor input object example

```json
{
  "product_url": "https://woocommerce.com/products/motiv/"
}
```

# Actor output Schema

## `dataset` (type: `string`):

Dataset containing the Actor's result items

# API

You can run this Actor programmatically using our API. Below are code examples in JavaScript, Python, and CLI, as well as the OpenAPI specification and MCP server setup.

## JavaScript example

```javascript
import { ApifyClient } from 'apify-client';

// Initialize the ApifyClient with your Apify API token
// Replace the '<YOUR_API_TOKEN>' with your token
const client = new ApifyClient({
    token: '<YOUR_API_TOKEN>',
});

// Prepare Actor input
const input = {
    "product_url": "https://woocommerce.com/products/motiv/"
};

// Run the Actor and wait for it to finish
const run = await client.actor("eichan/product-price-availability").call(input);

// Fetch and print Actor results from the run's dataset (if any)
console.log('Results from dataset');
console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
const { items } = await client.dataset(run.defaultDatasetId).listItems();
items.forEach((item) => {
    console.dir(item);
});

// 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/js/docs

```

## Python example

```python
from apify_client import ApifyClient

# Initialize the ApifyClient with your Apify API token
# Replace '<YOUR_API_TOKEN>' with your token.
client = ApifyClient("<YOUR_API_TOKEN>")

# Prepare the Actor input
run_input = { "product_url": "https://woocommerce.com/products/motiv/" }

# Run the Actor and wait for it to finish
run = client.actor("eichan/product-price-availability").call(run_input=run_input)

# Fetch and print Actor results from the run's dataset (if there are any)
print(f"💾 Check your data here: https://console.apify.com/storage/datasets/{run.default_dataset_id}")
for item in client.dataset(run.default_dataset_id).iterate_items():
    print(item)

# 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/python/docs/quick-start

```

## CLI example

```bash
echo '{
  "product_url": "https://woocommerce.com/products/motiv/"
}' |
apify call eichan/product-price-availability --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,eichan/product-price-availability"
        }
    }
}
```

The hosted server signs you in with OAuth on first connect, so no API token belongs in this config. Clients without OAuth support can send an `Authorization: Bearer <APIFY_API_TOKEN>` header instead, using a token from API & Integrations in Apify Console (https://console.apify.com/settings/integrations).

## OpenAPI specification

Download the OpenAPI definition: https://api.apify.com/v2/actors/iqFJpLO3PNd5vzM2K/builds/afR04rg1DsOstrTXS/openapi.json
