# JD Price and Seller Snapshot Monitor (`magenta_courser/jd-price-seller-monitor`) Actor

Compare sellers, prices, and availability in authorized JD JSON snapshots you supply. No live collection or marketplace connection.

- **URL**: https://apify.com/magenta_courser/jd-price-seller-monitor.md
- **Developed by:** [SUNGHWAN CHO](https://apify.com/magenta_courser) (community)
- **Features:** Limited permissions
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

Pay per usage

This Actor is paid per platform usage. The Actor is free to use, and you only pay for the Apify platform usage, which gets cheaper the higher subscription plan you have.

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

## 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

## JD Price and Seller Snapshot Monitor

[English](README.md) · [한국어](README.ko.md) · [日本語](README.ja.md) · [简体中文](README.zh-Hans.md)

Provide one authorized JD offer snapshot and optionally an earlier one to compare **prices, merchants, and availability by SKU and region**. This is an export-driven comparison beta. It does not scrape, authenticate to, or request live data from JD. It cannot turn a SKU URL into a snapshot, list all sellers, or run unattended unless your authorized source refreshes the input.

### Quick start

![Synthetic example: CNY 99.90 to 89.90 for the same merchant, plus one newly observed seller](docs/proof-card.svg)

1. Run the prefilled synthetic example in the Apify Input form. For local checks, use [the same JSON](examples/compare.json). This is synthetic data, not a current JD price.
2. The two output rows show `example-shop` changing from **CNY 99.90 to 89.90** (delta **−10.00**) and `second-example-shop` becoming `newly_observed`. The summary counts one prior offer absent from this input; it does not mark it as discontinued.
3. Replace the example with an authorized export. For later comparisons, pass the prior run’s `SNAPSHOT` as `baseline`. Only submit data you have permission to transfer to Apify. Use opaque labels and avoid real names, credentials, customer information, orders, and addresses. Apify stores the input, output rows, and reusable snapshot in the run storages; leave sharing off for non-public data. Only rerun with an updated export. Apify platform usage may apply; review the estimated cost and your plan before running.

### Input

Use the JSON input tab and start with [the synthetic comparison](examples/compare.json), or provide just `snapshot` to establish a baseline. Both snapshots use the same contract:

| Field | Meaning |
|---|---|
| `sourceId` | Stable opaque label for the same feed, price policy and customer eligibility scope. Change it for a different contract, tax basis, membership, promotion eligibility, calculation, or source. Use a label, never a token or account identifier. |
| `capturedAt` | Source observation time, e.g. `2026-11-18T01:00:00Z`. Convert to UTC. Do not use processing time as a substitute. |
| `rows[]` | 1–5,000 unique observed offers. Each row uses the fields below. Do not include account information, coupons for individuals, raw payloads, shipping addresses or cookies. |

Required row fields:

- `skuId`: exact decimal ID **string**, including IDs greater than JavaScript's safe integer range. This is the canonical JD SKU, not the Alliance promotion item ID. Do not coerce one identifier into the other without a documented mapping.
- `merchantId`: stable seller ID string from the authorized source. A display name or self-operated flag is not a seller ID. Omit observations without defensible identity.
- `regionCode`: the observed numeric JD 3- or 4-part area code, e.g. `1_72_2799_0`; preserve the same representation on successive runs. Do not label a generic or national price as region-specific.
- `priceType`: `displayed`, `promotion`, or `contract`. Compare like-for-like (e.g. tax, per-unit vs total, membership, and coupon assumptions must stay consistent).
- `priceCny`: nonnegative amount in CNY, number or decimal string with at most two places; `null` or omitted when no reliable quote. Use the observed source value; no coupon subtraction or conversion is done.

Optional: `offerId` (stable ID if seller has multiple offers for the same SKU in one scope), `merchantName`, `quantity` (positive integer, defaults to 1), `availability` (`in_stock`, `out_of_stock`, `unknown`, defaults to `unknown`), and `isJdSelfOperated` (true, false or null). Unknown fields and duplicate identities are rejected rather than silently merged. Do not replace missing seller identity with a made-up label.

### Output and repeated use

- **Observed offers**: one row per current offer with price and availability, optional prior facts, real CNY delta when both quotes are known, status and changed fields. A price rise and fall are represented by the sign of the delta; `null` is not zero.
- **SNAPSHOT**: normalized, reusable current snapshot. Pass this record as `baseline` for the next comparable feed export.
- **RUN_SUMMARY**: matches, changes, numerical price movements, newly observed current offers and prior offers not observed. “Newly observed” is not proof of a newly launched seller. A missing offer is not proof of delisting or stockout. No drops are inferred.
- Match key: SKU + merchant ID + optional offer ID + region + price type + quantity. Baseline must have the same source ID and an earlier timestamp. Matching uses the exact identifiers the source provides. Keep baselines private and run independently rather than using shared automatic history in this version.

### What JD's official docs support

- [JD Alliance / JOS](https://jos.jd.com/jdunion) describes `jd.union.open.goods.promotiongoodsinfo.query` as a SKU-based **promotion product** lookup providing price and whether an item is self-operated; `jd.union.open.goods.query` searches products and coupon information. That does not establish access to every merchant’s offers or that a coupon will apply to a given buyer's checkout. Seller identity, current SKU-vs-promotion-ID grants, regional availability, production credentials, and usable merchant IDs for our intended coverage are not verified. The [JD platform routing guide](https://jos.jd.com/doc/channel.htm?id=994) directs Alliance apps to the [dedicated Alliance development portal](https://union.jd.com/openplatform); app keys and application eligibility/access are platform-controlled, not an anonymous feed. Do not assume entitlement or API terms permit public data resale.
- [JD IOP selling price](https://opendoc.jd.com/iopv2/iopv2/%E4%BB%B7%E6%A0%BC/%E6%9F%A5%E8%AF%A2%E5%95%86%E5%93%81%E5%94%AE%E5%8D%96%E4%BB%B7.html) requires an authorized access token and covers a client's product pool. JD documents separate [area-specific stock](https://opendoc.jd.com/iopv2/iopv2/%E5%BA%93%E5%AD%98/%E6%9F%A5%E8%AF%A2%E5%95%86%E5%93%81%E5%BA%93%E5%AD%98.html) and [regional sale eligibility](https://opendoc.jd.com/iopv2/iopv2/%E5%95%86%E5%93%81/%E5%95%86%E5%93%81%E5%8F%AF%E9%87%87%E6%A0%A1%E9%AA%8C.html). The contract-price lookup does not take an area input; area-specific stock does not prove a regional price. IOP is not a substitute for consumer all-seller coverage.
- [Seller shop lookup](https://jos.jd.com/faqdetail?itemId=2037\&listId=115) is documented for looking up one's **own** shop, not marketplace-wide competitor enumeration.

Live-source milestone: with an appropriately authorized feed, prove canonical IDs, stable seller identity, exact price basis and regional scope across repeat observations before implementing an adapter or claiming automatic monitoring. Validate an actual sample with at least two merchants and two regions, including promo/coupon omission; source accuracy and operations cost are not measured in this MVP.

### Local test

```sh
npm test
workdir=$(mktemp -d)
mkdir -p "$workdir/key_value_stores/default"
cp examples/compare.json "$workdir/key_value_stores/default/INPUT.json"
env -i PATH="$PATH" HOME="$workdir" APIFY_API_BASE_URL=http://127.0.0.1:1 CRAWLEE_STORAGE_DIR="$workdir" node src/main.js
cat "$workdir/key_value_stores/default/RUN_SUMMARY.json"
```

This checkout uses the project scaffold's local Apify dependency if linked. For a standalone copy, install the pinned dependency from `package.json` before running the smoke test.

### 한국어 / 日本語 / 简体中文

권한이 있는 JD 스냅샷 JSON 두 개를 비교해 판매자·가격·판매 가능 상태 변화를 확인합니다. 실시간 수집은 하지 않습니다. 시작은 위 가상 예시를 사용하세요.
利用権限のある JD の JSON スナップショットを比較し、出品者・価格・販売可否の変化を確認します。自動取得は行いません。最初は上の架空データをご利用ください。
比较您有权使用的 JD JSON 快照，识别卖家、价格和可售状态变动。不自动抓取；请先使用上面的模拟示例。

### Support / 문의 / サポート / 支持

Send only a synthetic example and non-sensitive status. Do not share real run URLs, exports, or credentials.
문의에는 가상 예시만 사용하세요. 실제 실행 링크·원본·접속 정보는 보내지 마세요.
問い合わせは架空データのみで、実行リンク・実データ・認証情報は共有しないでください。
请只发送模拟示例，不要共享真实运行链接、源数据或凭据。

# Actor input Schema

## `snapshot` (type: `object`):

An object with sourceId, capturedAt (UTC), and rows (1–5,000). Each row has skuId, merchantId, regionCode, priceType and an observed priceCny or null. See README for the full format.

## `baseline` (type: `object`):

Paste the SNAPSHOT record from an earlier run using the same source and observations on a consistent basis.

## Actor input object example

```json
{
  "snapshot": {
    "sourceId": "synthetic-demo",
    "capturedAt": "2026-11-18T01:00:00Z",
    "rows": [
      {
        "skuId": "100000000000000001",
        "merchantId": "example-shop",
        "merchantName": "示例商店",
        "offerId": "example-offer",
        "regionCode": "1_72_2799_0",
        "priceType": "displayed",
        "priceCny": "89.90",
        "availability": "in_stock"
      },
      {
        "skuId": "100000000000000001",
        "merchantId": "second-example-shop",
        "regionCode": "1_72_2799_0",
        "priceType": "displayed",
        "priceCny": 92
      }
    ]
  },
  "baseline": {
    "sourceId": "synthetic-demo",
    "capturedAt": "2026-11-17T01:00:00Z",
    "rows": [
      {
        "skuId": "100000000000000001",
        "merchantId": "example-shop",
        "merchantName": "示例商店",
        "offerId": "example-offer",
        "regionCode": "1_72_2799_0",
        "priceType": "displayed",
        "priceCny": "99.90",
        "availability": "in_stock"
      },
      {
        "skuId": "100000000000000001",
        "merchantId": "previous-example-shop",
        "regionCode": "1_72_2799_0",
        "priceType": "displayed",
        "priceCny": 100
      }
    ]
  }
}
```

# Actor output Schema

## `observedOffers` (type: `string`):

Current authorized export rows and comparable deltas.

## `reusableSnapshot` (type: `string`):

Normalized current observation. Use as baseline on a later run.

## `runSummary` (type: `string`):

Counts and comparison coverage. Missing rows do not establish delisting.

# 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 = {
    "snapshot": {
        "sourceId": "synthetic-demo",
        "capturedAt": "2026-11-18T01:00:00Z",
        "rows": [
            {
                "skuId": "100000000000000001",
                "merchantId": "example-shop",
                "merchantName": "示例商店",
                "offerId": "example-offer",
                "regionCode": "1_72_2799_0",
                "priceType": "displayed",
                "priceCny": "89.90",
                "availability": "in_stock"
            },
            {
                "skuId": "100000000000000001",
                "merchantId": "second-example-shop",
                "regionCode": "1_72_2799_0",
                "priceType": "displayed",
                "priceCny": 92
            }
        ]
    },
    "baseline": {
        "sourceId": "synthetic-demo",
        "capturedAt": "2026-11-17T01:00:00Z",
        "rows": [
            {
                "skuId": "100000000000000001",
                "merchantId": "example-shop",
                "merchantName": "示例商店",
                "offerId": "example-offer",
                "regionCode": "1_72_2799_0",
                "priceType": "displayed",
                "priceCny": "99.90",
                "availability": "in_stock"
            },
            {
                "skuId": "100000000000000001",
                "merchantId": "previous-example-shop",
                "regionCode": "1_72_2799_0",
                "priceType": "displayed",
                "priceCny": 100
            }
        ]
    }
};

// Run the Actor and wait for it to finish
const run = await client.actor("magenta_courser/jd-price-seller-monitor").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 = {
    "snapshot": {
        "sourceId": "synthetic-demo",
        "capturedAt": "2026-11-18T01:00:00Z",
        "rows": [
            {
                "skuId": "100000000000000001",
                "merchantId": "example-shop",
                "merchantName": "示例商店",
                "offerId": "example-offer",
                "regionCode": "1_72_2799_0",
                "priceType": "displayed",
                "priceCny": "89.90",
                "availability": "in_stock",
            },
            {
                "skuId": "100000000000000001",
                "merchantId": "second-example-shop",
                "regionCode": "1_72_2799_0",
                "priceType": "displayed",
                "priceCny": 92,
            },
        ],
    },
    "baseline": {
        "sourceId": "synthetic-demo",
        "capturedAt": "2026-11-17T01:00:00Z",
        "rows": [
            {
                "skuId": "100000000000000001",
                "merchantId": "example-shop",
                "merchantName": "示例商店",
                "offerId": "example-offer",
                "regionCode": "1_72_2799_0",
                "priceType": "displayed",
                "priceCny": "99.90",
                "availability": "in_stock",
            },
            {
                "skuId": "100000000000000001",
                "merchantId": "previous-example-shop",
                "regionCode": "1_72_2799_0",
                "priceType": "displayed",
                "priceCny": 100,
            },
        ],
    },
}

# Run the Actor and wait for it to finish
run = client.actor("magenta_courser/jd-price-seller-monitor").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 '{
  "snapshot": {
    "sourceId": "synthetic-demo",
    "capturedAt": "2026-11-18T01:00:00Z",
    "rows": [
      {
        "skuId": "100000000000000001",
        "merchantId": "example-shop",
        "merchantName": "示例商店",
        "offerId": "example-offer",
        "regionCode": "1_72_2799_0",
        "priceType": "displayed",
        "priceCny": "89.90",
        "availability": "in_stock"
      },
      {
        "skuId": "100000000000000001",
        "merchantId": "second-example-shop",
        "regionCode": "1_72_2799_0",
        "priceType": "displayed",
        "priceCny": 92
      }
    ]
  },
  "baseline": {
    "sourceId": "synthetic-demo",
    "capturedAt": "2026-11-17T01:00:00Z",
    "rows": [
      {
        "skuId": "100000000000000001",
        "merchantId": "example-shop",
        "merchantName": "示例商店",
        "offerId": "example-offer",
        "regionCode": "1_72_2799_0",
        "priceType": "displayed",
        "priceCny": "99.90",
        "availability": "in_stock"
      },
      {
        "skuId": "100000000000000001",
        "merchantId": "previous-example-shop",
        "regionCode": "1_72_2799_0",
        "priceType": "displayed",
        "priceCny": 100
      }
    ]
  }
}' |
apify call magenta_courser/jd-price-seller-monitor --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,magenta_courser/jd-price-seller-monitor"
        }
    }
}
```

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/8U8Adc2KpaSCwQglm/builds/N8AB3ZPVcpsLn4U6I/openapi.json
