Back to blog
TutorialOctober 11, 20267 min read

JD.com Product Data API: Details, Prices and Reviews

Retrieve JD.com product details, a raw price response and up to two raw comment-page responses from a known product ID. Includes Python and JSON export.

Start with a known JD.com product ID

Product research often combines product attributes, prices and customer feedback. JustOneAPI exposes separate JD.com endpoints for these datasets, which you can join using the product ID supplied with each request.

This tutorial uses Product Details V4, Product Price V2 and Product Reviews V1. It saves one detail response, one raw price response with retrieval time and up to two raw review-page responses. Start with a familiar product to check whether the available fields meet your needs before expanding to a catalog.

Prepare your product ID and token

Confirm the product ID on the JD.com detail page, including the specific product or variant you intend to query. Do not substitute a store ID, campaign identifier or complete product URL for the numeric product ID.

Register for JustOneAPI, obtain your API token and try Product Details V4 in the interactive documentation. One token works across platform APIs, with pay-as-you-go usage. Check your account for each endpoint's permissions and free trial allowance.

All three endpoints use GET requests and require token. Details and reviews use itemId; Price V2 uses itemIds, with the same single product ID in this example. Check both the HTTP status and the response body's business code=0 before reading data.

Step 1: Retrieve product attributes and images

Call /api/jd/get-item-detail/v4 with the product ID. The current public response example contains data.sku, data.raw_data and data.graphext_data. The latter includes detail_images and properties.

Save the business response first, then map the available attributes and image links into your own model. Field availability can vary by product. Retain missing values rather than substituting attributes from another item. This example saves image URLs; it does not download the image files.

This tutorial uses synchronous Product Details V4 requests. Check the JD.com API directory for the currently documented endpoints and the API version guide for guidance on choosing a version.

Step 2: Request Price V2 and preserve its raw response

The current public documentation marks Product Price V1 as deprecated. This tutorial uses Product Price V2 at /api/jd/get-item-price/v2. Its required query parameters are token and itemIds. Supply itemIds as a string of 1–10 numeric product IDs, separated by English commas with no spaces. This example sends one ID, keeping the product scope and request count unchanged.

The V2 documentation states that a request containing one ID costs the same as a request containing ten IDs. This describes batch billing within V2; the fee relationship between V1 and V2 has not been verified. Check the dashboard for the actual amount.

The current V2 public contract does not define the structure of data, so it does not establish a price-list path, field names or units. The script therefore does not carry over V1 assumptions about data.data, good_id or price. It saves the returned data unchanged without assuming a price unit, result order or number of covered products. It does not divide values by 100 or label them as yuan.

price-snapshot.json records the requested ID list, endpoint version and UTC retrieval time alongside that response. It is not an extracted price table or a historical price series. Within your account's permissions, inspect the actual product identifiers, price fields, units and discount or membership conditions before mapping or comparing them. An unmarked V2 endpoint is not a guarantee of availability for every account or product; check the dashboard for permissions, pricing and trial allowance.

Step 3: Request bounded comment pages

Use Product Reviews V1 at /api/jd/get-item-comments/v1, with token, itemId and an explicit page value. The Product Reviews V2 documentation currently marks that version as deprecated; the example below no longer selects it.

The current V1 public contract does not define the structure of data or provide a comment-response example. It therefore does not establish a review-list path, stable review ID, or final-page field. Do not carry over V2 assumptions such as data.items, recordId or data.totalPages.

The script requests page=1 and page=2 at most and saves the returned business data without mapping it. This is a request cap, not automatic pagination-end detection: it does not infer an empty review list, deduplicate reviews, or report a review count. A page response is not a count of individual reviews or evidence of complete coverage.

Before adding extraction or more pages, inspect an authorized response for your chosen product and confirm the list path, identifier, text/time fields and documented stopping rule. Then add validation and deduplication for that confirmed structure. An unmarked V1 endpoint is not a guarantee of live availability for every account or product.

Python example: Export details, price records and review-page responses

Install the dependency and set the token and numeric product ID. Replace both placeholder values. These commands work in a macOS or Linux terminal.

bash
python3 -m pip install requests
export JUSTONEAPI_TOKEN='your_token'
export JD_ITEM_ID='your_numeric_item_id'

Save the code as jd_sample.py and run python3 jd_sample.py. It makes up to 4 API requests: one for details, one single-product Price V2 request and at most two for reviews. There are no automatic retries. Successful responses already saved remain available if a later request fails. Saved API envelopes omit the top-level requestParams field so echoed request parameters are not exported; their data is retained unchanged.

python
import json
import os
from datetime import datetime, timezone
from pathlib import Path

import requests

BASE_URL = "https://api.justoneapi.com"
TOKEN = os.environ.get("JUSTONEAPI_TOKEN", "")


def call_api(path, *, require_object=True, **params):
    try:
        response = requests.get(
            BASE_URL + path,
            params={"token": TOKEN, **params},
            timeout=120, allow_redirects=False,
        )
    except requests.RequestException:
        raise RuntimeError("API network error or timeout") from None
    if response.status_code != 200:
        raise RuntimeError(f"API HTTP {response.status_code}")
    try:
        result = response.json()
    except ValueError:
        raise RuntimeError("API response is not JSON") from None
    if not isinstance(result, dict) or result.get("code") != 0:
        code = result.get("code") if isinstance(result, dict) else None
        raise RuntimeError(f"API failed: code={code}; check the docs")
    if "data" not in result:
        raise RuntimeError("Missing data; inspect the current docs")
    data = result["data"]
    if require_object and not isinstance(data, dict):
        raise RuntimeError("Unexpected data shape; inspect the docs")
    inner = data.get("base_resp") if require_object else None
    if isinstance(inner, dict) and inner.get("status_code") not in (0, "0"):
        raise RuntimeError("Platform response was unsuccessful")
    return result


def save_json(folder, name, value):
    if isinstance(value, dict) and "code" in value and "data" in value:
        value = {key: item for key, item in value.items() if key != "requestParams"}
    (folder / name).write_text(
        json.dumps(value, ensure_ascii=False, indent=2), encoding="utf-8"
    )


def output_folder(topic):
    if not TOKEN or TOKEN == "your_token":
        raise RuntimeError("Set JUSTONEAPI_TOKEN before running")
    run_id = datetime.now(timezone.utc).strftime("%Y%m%dT%H%M%S%fZ")
    folder = Path(topic + "-output") / run_id
    folder.mkdir(parents=True, exist_ok=False)
    return folder


ITEM_ID = os.environ.get("JD_ITEM_ID", "")
MAX_REVIEW_PAGES = 2


def main():
    if not ITEM_ID or not ITEM_ID.isdigit():
        raise RuntimeError("Set JD_ITEM_ID to a numeric product ID")
    folder = output_folder("jd")
    detail = call_api("/api/jd/get-item-detail/v4", itemId=ITEM_ID)
    save_json(folder, "product-detail.json", detail)
    price = call_api(
        "/api/jd/get-item-price/v2", require_object=False, itemIds=ITEM_ID,
    )
    save_json(folder, "product-price.json", price)
    save_json(folder, "price-snapshot.json", {
        "requestedItemIds": [ITEM_ID],
        "endpoint": "/api/jd/get-item-price/v2",
        "retrievedAt": datetime.now(timezone.utc).isoformat(),
        "rawPriceData": price["data"],
    })

    review_pages = []
    for page in range(1, MAX_REVIEW_PAGES + 1):
        result = call_api(
            "/api/jd/get-item-comments/v1", require_object=False,
            itemId=ITEM_ID, page=str(page),
        )
        filename = f"reviews-{page}.json"
        save_json(folder, filename, result)
        review_pages.append({"requestedPage": page, "file": filename})
    save_json(folder, "review-pages.json", {
        "requestedItemId": ITEM_ID,
        "endpoint": "/api/jd/get-item-comments/v1",
        "retrievedAt": datetime.now(timezone.utc).isoformat(),
        "pages": review_pages,
    })
    print(f"Saved product data and {len(review_pages)} review page responses to {folder}")


if __name__ == "__main__":
    try:
        main()
    except RuntimeError as error:
        raise SystemExit(str(error)) from None

Use the output for product research

Each run creates a dated folder under jd-output. product-detail.json and product-price.json preserve business responses without the top-level requestParams field. price-snapshot.json stores the unparsed price data, requested ID list, endpoint version and retrieval time. reviews-1.json and reviews-2.json preserve the comment-page business responses saved before any failure; review-pages.json indexes both pages only after the bounded loop completes. No extracted price table or normalized, deduplicated review list is produced.

When building a catalog, retain the requested ID, identifiers returned in the response, retrieval time and endpoint version. After validating the actual review structure, map identifiers, variants, dates and text before grouping reviews or examining repeated themes. A proportion calculated from sampled reviews does not establish satisfaction across all buyers.

Common questions

Can I use a price field from product details instead?

Details and price endpoints return different structures. This tutorial retrieves prices separately to make their source and retrieval time explicit. Whether a detail field is a suitable substitute depends on the actual response and the price definition your application needs.

How do I collect multiple products?

The current script accepts one JD_ITEM_ID. To support a catalog, keep details and reviews as per-product requests; Price V2 accepts up to 10 numeric IDs in each itemIds string. Do not put a comma-separated list into this example's single-product environment variable. First confirm how returned product identifiers map to the requested IDs without assuming the same order or a result for every ID. Then adjust storage, billing budgets and the total request cap. Consult the retry and concurrency guide before adding retries.

Why might a successful request contain no reviews?

An empty list at a confirmed review-list path differs from a failed operation or an unknown response structure. This raw-page example does not classify any of those as zero reviews. Check the ID, requested page, business status and saved data before adding an end-of-pagination rule; do not repeat requests to reach a target count.

Try a familiar product in the JD.com product documentation, then connect the returned fields to your research workflow.

Continue with JustOneAPI

Log in to the Dashboard for your token, read the full API docs, or open the MCP GitHub project for the latest configuration.