Douyin E-commerce API Tutorial: Product Details, SKUs and Reviews
Retrieve Douyin E-commerce product details, SKU information and customer comments with Just One API. Includes pagination, unsupported-product handling and Python code.
Retrieve a Douyin product, its SKUs and customer comments
For product research on Douyin, use Just One API's Douyin E-commerce endpoints. Starting with a product ID, retrieve product details, SKU information, and customer comments, then associate them with the same product.
Each endpoint serves a different purpose: details provides product information and sales-related data, SKUs describes variations, and comments provides buyer feedback. This tutorial looks up one known product and saves its details, SKU response, and up to 2 comment pages.
Register and test for free
Create a Just One API account, get your API token, and test a product ID in the Product Details documentation. Use one token across platforms, with free testing and pay-as-you-go billing afterward. Check your account for each endpoint's trial allowance.
All three GET endpoints require the token and itemId query parameters:
/api/douyin-ec/get-item-detail/v2: product details./api/douyin-ec/get-item-sku-info/v2: SKU information./api/douyin-ec/get-item-comments/v1: customer comments, withpagefor pagination.
Here, itemId is a Douyin E-commerce product ID. Do not substitute a video's aweme_id, a shop ID, or an arbitrary promotion identifier. If you do not have a product ID yet, start with Product Search or Shop Product List and inspect the returned identifiers.
Step 1: Retrieve product details
Call Product Details V2 with the target itemId. Confirm the response body's business code is 0 before processing the data.
In the current public example, product information is under data.model.product. Its product_base includes fields such as the title and images, while product_sales contains sales-related data. Shop information is under data.model.shop.
The script preserves the full response for inspection. Interpret sales fields according to their actual definitions and returned values; a field name alone does not establish an exact transaction count or sales amount over a particular time window.
Step 2: Retrieve SKUs and handle unsupported products
SKU Info V2 also accepts itemId. The current public response example contains a data.skus array, whose entries include id, productId, price, dealPrice, and salePropertyValues for variation and price analysis.
Product-level and SKU-level prices may represent different variations or promotion conditions. Retain the raw values, verify amount units and price definitions, and only then compare products. Do not assume every field uses the same unit.
Business code 202 does not mean a product has no SKUs
The documentation states that SKU V2 returns business code=202 for unsupported products. It means the endpoint cannot currently provide that product's SKU data, not that the product has no variations or is sold out.
The code below saves the response, prints a notice, and continues to product comments. It permits 202 only for SKU V2; all other endpoints still require business code=0.
Step 3: Retrieve customer comments
Item Comments V1 accepts itemId and page. This example starts at page 1 and retrieves at most 2 pages.
The current public example places entries in data.Comments, with Content for text, Id for the comment ID, and data.HasMore for pagination. These names are case-sensitive; do not reuse the video's comments or has_more field paths.
Stop when HasMore is false. Comments can support analysis of product variations, delivery, or after-sales experiences. For larger collections, deduplicate by product ID and comment Id, and retain collection time and coverage limits.
Python example: Save one product's responses
Install the dependency and set your token and a real product ID in a macOS or Linux terminal. Replace both placeholders and keep the real token out of public code and logs.
python3 -m pip install requests
export JUSTONEAPI_TOKEN='your_token'
export DOUYIN_ITEM_ID='your_item_id'Save this as douyin_ecommerce_sample.py and run python3 douyin_ecommerce_sample.py. It makes at most 4 requests: details, SKU information, and up to 2 comment pages. A failure in product details or another unhandled API error stops the script earlier.
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, method="GET", accepted_codes=(0,), **params):
if not TOKEN or TOKEN == "your_token":
raise RuntimeError("Set JUSTONEAPI_TOKEN before running")
values = {"token": TOKEN, **params}
arguments = {"data": values} if method == "POST" else {"params": values}
try:
response = requests.request(
method, BASE_URL + path, timeout=120, **arguments,
)
except requests.RequestException:
raise RuntimeError("Network error or timeout") from None
if response.status_code != 200:
raise RuntimeError(f"HTTP {response.status_code}")
try:
result = response.json()
except ValueError:
raise RuntimeError("Response is not valid JSON") from None
if not isinstance(result, dict) or result.get("code") not in accepted_codes:
code = result.get("code") if isinstance(result, dict) else None
raise RuntimeError(f"API failed: code={code}; check the docs")
return result
def output_dir(prefix):
stamp = datetime.now(timezone.utc).strftime("%Y%m%dT%H%M%S%fZ")
folder = Path(prefix) / stamp
folder.mkdir(parents=True, exist_ok=False)
return folder
def save_json(folder, filename, value):
(folder / filename).write_text(
json.dumps(value, ensure_ascii=False, indent=2), encoding="utf-8",
)
ITEM_ID = os.environ.get("DOUYIN_ITEM_ID", "")
MAX_COMMENT_PAGES = 2
def main():
if not ITEM_ID or ITEM_ID == "your_item_id":
raise RuntimeError("Set DOUYIN_ITEM_ID to a real product ID")
folder = output_dir("douyin-ecommerce-output")
detail = call_api("/api/douyin-ec/get-item-detail/v2", itemId=ITEM_ID)
save_json(folder, "product-detail.json", detail)
sku = call_api(
"/api/douyin-ec/get-item-sku-info/v2",
accepted_codes=(0, 202), itemId=ITEM_ID,
)
save_json(folder, "product-sku.json", sku)
if sku["code"] == 202:
print("SKU lookup is not supported for this product (code 202)")
for page in range(1, MAX_COMMENT_PAGES + 1):
comments = call_api(
"/api/douyin-ec/get-item-comments/v1",
itemId=ITEM_ID, page=str(page),
)
save_json(folder, f"product-comments-{page}.json", comments)
if comments["data"].get("HasMore") not in (True, 1, "1"):
break
print(f"Saved product responses to {folder}")
if __name__ == "__main__":
try:
main()
except RuntimeError as error:
raise SystemExit(str(error)) from NoneEvery run creates a directory under douyin-ecommerce-output, preserving the raw product details, SKU result, and comment responses. A SKU 202 is retained in the file so downstream logic can distinguish “unsupported” from a successful empty list. The code follows the public documentation examples; actual fields and product availability depend on runtime responses.
Except for that specific SKU condition, the script stops on errors and does not retry automatically. Saved files remain available, and rerunning makes new requests. Before scaling up, add checkpoints and bounded retries following the retry guide.
Common questions
How do Douyin E-commerce APIs differ from video APIs?
E-commerce endpoints cover products, SKUs, shops, and product comments. Video endpoints cover video content and discussion. For keyword video search, details, and comments, read the Douyin Video Data tutorial. Their identifiers and response structures are not interchangeable.
Can I infer live inventory from SKU data?
First check whether the chosen endpoint explicitly supplies the inventory field your application needs. Variations, prices, and sales figures are not the same as current sellable stock, and a missing stock field does not mean zero inventory. This example retrieves product, variation, and feedback samples.
Does an empty comment response mean there are no reviews?
Check the business code, returned list, pagination state, and product availability. Failure, lack of support, a successful empty list, and reaching your collection limit are different states; do not label all of them “no reviews.”
How can I compare similar products on Taobao and Douyin?
Continue with the Taobao and Tmall tutorial. Establish product or variation matches, then align price types, collection times, and amount units. Matching solely by similar titles can combine different specifications.
Start with one target product
Test a product for free in the Douyin E-commerce documentation, then check SKU and comment responses separately. Once the fields and coverage meet your needs, expand the workflow to shop catalogs or scheduled monitoring.
Continue with Just One API
Log in to the Dashboard for your token, read the full API docs, or open the MCP GitHub project for the latest configuration.