跳至主要內容

淘寶和天貓商品詳情 API (V8) ​

GET
API 端點健康狀態
健康 可用 少量可用 基本不可用 暫無資料
正在載入健康狀態…

通過 V8 接口按 item ID 檢索淘寶或天貓商品詳情,該接口提供準確的 SKU 數量信息。可用於執行直接商品查詢,以進行目錄研究、商品監控或電商分析。

使用提示 ​

適用條件 · 價格

返回商品原價和SKU價格。對於預售商品,請區分定金和總價。

支持能力 · 屬性

以名稱和值的形式提供商品屬性。

支持能力 · SKU 選項

提供SKU標識符、規格選項和數量信息。

支持能力 · 主圖和輪播圖

提供商品主圖和輪播圖。

適用條件 · 描述圖片

驗證樣本返回空的描述圖片列表和描述獲取URL。需要進一步獲取才能獲得圖片。

支持能力

該接口返回準確的 SKU 數量信息。

適用條件

該接口可能因限流偶爾失敗;失敗時請重試請求。

請求參數 ​

參數名 位置 類型 必填 預設值 說明
token query string 是 - 此 API 服務的訪問令牌。
itemId query string 是 - 淘寶/天貓上的唯一商品標識符(商品ID)。

程式碼範例 ​

bash
curl --max-time 120 -X GET 'https://api.justoneapi.com/api/taobao/get-item-detail/v8?token=YOUR_API_KEY&itemId=VALUE'
text
我想使用 JustOneAPI 提供的“商品詳情 (V8)”接口。
接入地址: https://api.justoneapi.com。
接口路徑: /api/taobao/get-item-detail/v8?token=YOUR_API_KEY&itemId=VALUE
接口地址: BASE_URL + /api/taobao/get-item-detail/v8?token=YOUR_API_KEY&itemId=VALUE
HTTP 方法: GET
身份驗證: 在 URL 中傳入 token 查詢參數。
OpenAPI 定義: https://docs.justoneapi.com/openapi/taobao-and-tmall/product-details-v8-zh-hant.json

請求參數說明:
- token (query): 此 API 服務的訪問令牌。 (必填)
- itemId (query): 淘寶/天貓上的唯一商品標識符(商品ID)。 (必填)

返回格式: 請根據實際 Content-Type 安全處理 JSON 或文本回應。

回應處理與錯誤代碼:
1. 需通過返回體中的 "code" 欄位判斷業務結果(code 為 0 表示成功)。
2. 逾時建議:建議將請求逾時時間設置為 120 秒;如果 120 秒偏長,請至少設置為 60 秒,但可能會有少量請求因逾時而未接收到結果。
3. 業務碼說明:
   - 0: 成功
   - 100: Token 無效或已失效
   - 301: 採集失敗,請重試
   - 302: 超出速率限制
   - 303: 超出每日配額
   - 400: 參數錯誤
   - 500: 內部伺服器錯誤
   - 600: 權限不足
   - 601: 帳戶餘額不足
   - 602: TOKEN 限額超限
4. code 601 表示帳戶共享餘額不足。code 602 表示當前 API TOKEN 自身的累計消費上限已達到。TOKEN 限額不是資金劃撥,多個 TOKEN 仍共享同一個帳戶餘額。

請幫我用我擅長的編程語言寫一個腳本來呼叫這個接口,並處理返回結果。
python
import requests

BASE_URL = "https://api.justoneapi.com"  # 由 OpenAPI servers 提供

url = BASE_URL + "/api/taobao/get-item-detail/v8?token=YOUR_API_KEY&itemId=VALUE"
response = requests.get(url, timeout=120)
print(response.status_code)
if response.content:
    content_type = response.headers.get("content-type", "").lower()
    if "json" in content_type:
        try:
            print(response.json())
        except ValueError:
            print(response.text)
    elif content_type.startswith("text/") or "xml" in content_type or content_type.split(";", 1)[0].strip() in {"application/javascript", "application/x-www-form-urlencoded", "application/graphql"}:
        print(response.text)
    else:
        with open("response.bin", "wb") as output:
            output.write(response.content)
        print(f"Saved {len(response.content)} bytes to response.bin")
js
const BASE_URL = "https://api.justoneapi.com"; // 由 OpenAPI servers 提供
const url = BASE_URL + "/api/taobao/get-item-detail/v8?token=YOUR_API_KEY&itemId=VALUE";

const response = await fetch(url, {
  method: "GET",
  signal: AbortSignal.timeout(120000)
});
console.log(response.status);
const responseBytes = await response.arrayBuffer();
if (responseBytes.byteLength) {
  const contentType = (response.headers.get("content-type") || "").toLowerCase();
  const mediaType = contentType.split(";", 1)[0].trim();
  const textual = contentType.startsWith("text/") || contentType.includes("json") || contentType.includes("xml") || ["application/javascript", "application/x-www-form-urlencoded", "application/graphql"].includes(mediaType);
  if (textual) {
    const responseText = new TextDecoder().decode(responseBytes);
    let data = responseText;
    if (contentType.includes("json")) {
      try { data = JSON.parse(responseText); } catch { /* Keep the raw body. */ }
    }
    console.log(data);
  } else {
    console.log(`Received ${responseBytes.byteLength} binary bytes`);
  }
}
java
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
import java.time.Duration;
import java.nio.charset.StandardCharsets;
import java.nio.file.Files;
import java.nio.file.Path;

public class Main {
    public static void main(String[] args) throws Exception {
        final String BASE_URL = "https://api.justoneapi.com"; // 由 OpenAPI servers 提供
        final String url = BASE_URL + "/api/taobao/get-item-detail/v8?token=YOUR_API_KEY&itemId=VALUE";

        HttpClient client = HttpClient.newBuilder().connectTimeout(Duration.ofSeconds(120)).build();
        HttpRequest.Builder builder = HttpRequest.newBuilder()
            .uri(URI.create(url))
            .timeout(Duration.ofSeconds(120))
            .method("GET", HttpRequest.BodyPublishers.noBody());

        HttpRequest request = builder.build();

        HttpResponse<byte[]> response = client.send(request, HttpResponse.BodyHandlers.ofByteArray());
        System.out.println(response.statusCode());
        String contentType = response.headers().firstValue("content-type").orElse("").toLowerCase();
        String mediaType = contentType.split(";", 2)[0].trim();
        if (contentType.startsWith("text/") || contentType.contains("json") || contentType.contains("xml") || mediaType.equals("application/javascript") || mediaType.equals("application/x-www-form-urlencoded") || mediaType.equals("application/graphql")) {
            System.out.println(new String(response.body(), StandardCharsets.UTF_8));
        } else {
            Files.write(Path.of("response.bin"), response.body());
            System.out.println("Saved " + response.body().length + " bytes to response.bin");
        }
    }
}
go
package main

import (
	"fmt"
	"io"
	"os"
	"strings"
	"net/http"
	"time"
)

const BASE_URL = "https://api.justoneapi.com" // 由 OpenAPI servers 提供

func main() {
	client := &http.Client{Timeout: 120 * time.Second}
	url := BASE_URL + "/api/taobao/get-item-detail/v8?token=YOUR_API_KEY&itemId=VALUE"
	req, _ := http.NewRequest("GET", url, nil)
	resp, _ := client.Do(req)
	defer resp.Body.Close()
	fmt.Println(resp.StatusCode)
	bodyBytes, _ := io.ReadAll(resp.Body)
	contentType := strings.ToLower(resp.Header.Get("Content-Type"))
	mediaType := strings.TrimSpace(strings.SplitN(contentType, ";", 2)[0])
	if strings.HasPrefix(contentType, "text/") || strings.Contains(contentType, "json") || strings.Contains(contentType, "xml") || mediaType == "application/javascript" || mediaType == "application/x-www-form-urlencoded" || mediaType == "application/graphql" {
		fmt.Println(string(bodyBytes))
	} else {
		os.WriteFile("response.bin", bodyBytes, 0600)
		fmt.Printf("Saved %d bytes to response.bin\n", len(bodyBytes))
	}
}
php
<?php
$BASE_URL = 'https://api.justoneapi.com'; // 由 OpenAPI servers 提供
$url = $BASE_URL . '/api/taobao/get-item-detail/v8?token=YOUR_API_KEY&itemId=VALUE';

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_TIMEOUT, 120);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "GET");
$response = curl_exec($ch);
$status = curl_getinfo($ch, CURLINFO_RESPONSE_CODE);
$contentType = strtolower((string) curl_getinfo($ch, CURLINFO_CONTENT_TYPE));
curl_close($ch);
echo $status . PHP_EOL;
$mediaType = trim(explode(';', $contentType, 2)[0]);
if (str_starts_with($contentType, 'text/') || str_contains($contentType, 'json') || str_contains($contentType, 'xml') || in_array($mediaType, ['application/javascript', 'application/x-www-form-urlencoded', 'application/graphql'], true)) {
    echo $response;
} else {
    file_put_contents('response.bin', $response);
    echo 'Saved ' . strlen($response) . ' bytes to response.bin' . PHP_EOL;
}

返回欄位 ​

業務成功時(code = 0)的主要返回欄位。

商品概況10 個欄位

data

淘寶或天貓商品詳情 V8 返回的商品信息。

欄位 類型 說明
item object 商品標識、媒體和類目信息。
item.itemId string 淘寶或天貓商品 ID,以字符串返回。
item.title string 商品標題。
item.subtitle string 商品副標題,如有提供。
item.categoryId string 商品類目 ID,以字符串返回。
item.rootCategoryId string 商品一級類目 ID,以字符串返回。
item.brandValueId string 商品品牌選項 ID,以字符串返回。
item.skuText string 商品頁展示的 SKU 規格摘要。
item.favcount string 收藏量文本。
item.vagueSellCount string 商品銷量展示文本,可能包含近似或縮寫。
商品圖片、視頻與詳情連結9 個欄位

data.item

欄位 類型 說明
images array 商品圖 URL 列表,按展示順序返回。URL 可能省略協議。
images[] string -
videos array 商品媒體區域展示的視頻列表。
videos[] object 單個商品展示視頻。
videos[].url string 視頻 URL。
videos[].type string 視頻類型值。
videos[].videoThumbnailUrl string 視頻縮略圖地址。
tmallDescUrl string 商品詳情描述的獲取連結,可能省略協議。
taobaoPcDescUrl string 桌面版商品詳情描述的獲取連結。
SKU 規格13 個欄位

data.skuBase

SKU 標識及商品規格定義。

欄位 類型 說明
skus array SKU 列表,包含變體標識和選中的規格。
skus[] object 一個 SKU 及其所選規格組合。
skus[].skuId string SKU ID,以文本返回。可用它在 skuCore.sku2info 中查詢對應的價格和數量。
skus[].propPath string 每項選中的規格使用冒號連接 pid 和 vid,多項規格用分號分隔。可到 skuBase.props 查找 ID 對應的名稱。
props array 商品規格定義及各規格的可選值。
props[] object 一項商品規格定義。
props[].pid string 商品規格定義 ID,以字符串返回。
props[].name string 商品頁展示的規格名稱。
props[].values array 該規格的可選值列表。
props[].values[] object 單個規格選項。
props[].values[].vid string 規格選項值 ID,以字符串返回。
props[].values[].name string 該規格選項值的展示名稱。
props[].values[].image string 該規格值對應的圖片 URL,如有提供。
SKU 價格與數量10 個欄位

data.skuCore

SKU 價格、數量及履約展示信息。

欄位 類型 說明
sku2info object 以 skuBase.skus[].skuId 為鍵的對象,可能另有鍵 0 的商品彙總項。每項可能包含 price(priceText、priceMoney、type)、文本形式的 quantity 及 logisticsTime。已驗證的單值 SKU 價格中,priceMoney 是 priceText 的 100 倍。價格區間與彙總項可能採用不同表示。
sku2info.{key} object 由動態鍵選中的一項價格及數量信息。
sku2info.{key}.price object 該映射條目的價格信息。
sku2info.{key}.price.priceText string 價格展示文本。商品彙總項可能展示價格區間。
sku2info.{key}.price.priceMoney string 原始金額文本。已驗證的單值 SKU 條目以展示金額的百分之一為單位編碼。
sku2info.{key}.price.type string 該價格對應的類型值。
sku2info.{key}.quantity string 該條目報告的數量,以文本返回。彙總項和單個 SKU 條目各自提供數量。
sku2info.{key}.logisticsTime string 該條目的履約時間文本,如有提供。
skuItem object SKU 區塊附帶的商品層級信息。
skuItem.location string SKU 詳情附帶的地點顯示文本。
商品屬性5 個欄位

data.props

按展示分組返回的商品屬性。

欄位 類型 說明
groupProps array 以分組名稱為鍵的對象數組。每個分組下又有一個數組,其中的對象以屬性展示名稱為鍵、屬性文本為值。
groupProps[] object 屬性分組,分組名稱隨商品變化。
groupProps[].{key} array 一個組名下的屬性條目列表。
groupProps[].{key}[] object 單個商品屬性對象,包含屬性名稱到文本值的映射。
groupProps[].{key}[].{key} string 屬性展示值,以文本返回。
商品價格27 個欄位

data.itemPrice

商品層級的價格展示信息。

欄位 類型 說明
price object 商品價格信息中的主要價格條目。
price.priceText string 價格展示文本,可能包含區間。
price.priceMoney string 該價格展示條目的原始金額,以文本返回。
price.type string 平台返回的價格類型值。
subPrice object 輔助價格條目,如有提供。
subPrice.priceText string 價格展示文本,可能包含區間。
subPrice.priceMoney string 該價格展示條目的原始金額,以文本返回。
subPrice.type string 平台返回的價格類型值。
extraPrices array 補充的商品價格展示條目。
extraPrices[] object 單個補充價格條目。
extraPrices[].priceText string 價格展示文本,可能包含區間。
extraPrices[].priceMoney string 該價格展示條目的原始金額,以文本返回。
extraPrices[].priceTitle string 該價格旁的展示標題。
extraPrices[].type string 平台返回的價格類型值。
extraPrices[].lineThrough string 價格條目的刪除線展示標誌,以文本返回。
newExtraPrices array 另一組補充價格展示條目,如有返回。
newExtraPrices[] object 該分組的單個補充價格條目。
newExtraPrices[].priceText string 價格展示文本,可能包含區間。
newExtraPrices[].priceMoney string 該價格展示條目的原始金額,以文本返回。
newExtraPrices[].priceTitle string 該價格旁的展示標題。
newExtraPrices[].type string 平台返回的價格類型值。
newExtraPrices[].lineThrough string 價格條目的刪除線展示標誌,以文本返回。
transmitPrice object 傳遞價格欄位中的價格文本。
transmitPrice.priceText string 價格展示文本,可能包含區間。
priceTag array 商品價格旁展示的標籤。
priceTag[] object 單個商品價格標籤。
priceTag[].text string 價格標籤的展示文案。
頁面價格展示16 個欄位

data.priceSection

商品頁展示的價格區塊。

欄位 類型 說明
price object 價格區塊的主要價格展示。
price.priceText string 價格展示文本,可能包含區間。
price.priceMoney string 該價格展示條目的原始金額,以文本返回。
price.priceTitle string 該價格旁的展示標題。
price.priceType string 平台返回的價格展示類型值。
price.newLine string 價格條目的換行展示標誌,以文本返回。
price.priceSize string 價格展示文字的大小值。
extraPrice object 補充價格展示,如有提供。
extraPrice.priceText string 價格展示文本,可能包含區間。
extraPrice.priceMoney string 該價格展示條目的原始金額,以文本返回。
extraPrice.priceTitle string 該價格旁的展示標題。
extraPrice.priceType string 平台返回的價格展示類型值。
extraPrice.priceColor string 價格展示文字的顏色值。
extraPrice.lineThrough string 價格條目的刪除線展示標誌,以文本返回。
extraPrice.newLine string 價格條目的換行展示標誌,以文本返回。
extraPrice.priceTail string 該價格後展示的文本。
促銷展示10 個欄位

data.priceSection.promotion

價格區塊的促銷展示。

欄位 類型 說明
entranceTip string 促銷入口展示文案。
entranceUrl string 促銷入口連結。
items array 商品價格旁展示的促銷條目列表,可能為空。
items[] object 單個促銷展示條目。
items[].content string 促銷展示文案。
items[].type string 平台返回的促銷類型值。
items[].textColor string 促銷文案的顏色值。
items[].bgImage string 促銷展示背景圖。
items[].startTime string 報告的促銷開始時間,以文本返回。
items[].endTime string 報告的促銷結束時間,以文本返回。
賣家與店鋪17 個欄位

data.seller

商品附帶的賣家及店鋪資料。

欄位 類型 說明
userId string 賣家帳號 ID,以字符串返回。
shopId string 店鋪 ID,以字符串返回。
shopName string 店鋪展示名稱。
shopUrl string 店鋪連結,可能為相對地址或應用專用連結。
taoShopUrl string 平台返回的另一種店鋪連結。
shopIcon string 店鋪圖標 URL。
fans string 店鋪粉絲數展示文本。
allItemCount string 店鋪商品數量,以文本返回。
sellerType string 平台返回的賣家類型值。
shopType string 平台返回的店鋪類型值。
sellerNick string 賣家暱稱。
creditLevel string 賣家信用等級,以文本返回。
creditLevelIcon string 賣家信用等級圖標 URL。
tagIcon string 賣家標籤圖標 URL。
goodRatePercentage string 賣家好評率展示文本。
certIcon string 認證圖標 URL,如有提供。
certText string 賣家或店鋪的認證展示文本。
配送與購買14 個欄位

data

欄位 類型 說明
delivery object 商品頁的配送信息。
delivery.from string 展示的發貨地。
delivery.to string 展示的收貨地。
delivery.completedTo string 更完整的收貨地文本,如有提供。
delivery.areaId string 收貨地區 ID,以字符串返回。
delivery.postage string 商品頁展示的運費或郵費說明。
delivery.addressWeexUrl string 商品頁使用的地址選擇連結。
trade object 商品回應中的購買和購物車狀態。
trade.buyEnable string 購買入口的啓用狀態,以文本返回。
trade.cartEnable string 加入購物車入口的啓用狀態,以文本返回。
trade.buyUrl string 購買入口的連結值。
trade.hintBanner object 購買區域的提示條,如有提供。
trade.hintBanner.text string 提示條文案。
trade.hintBanner.bgColor string 提示條背景顏色。
評價預覽17 個欄位

data.rate

商品評價預覽及評價關鍵詞。該欄位可能為 null。

欄位 類型 說明
totalCount string 評價預覽中報告的評價總數,以文本返回。
vagueCount string 商品頁展示的評價數簡寫。
keywords array 商品頁展示的評價關鍵詞。
keywords[] object 單個評價關鍵詞條目。
keywords[].word string 評價關鍵詞的展示文本。
keywords[].count string 關鍵詞對應的數量文本。
rateList array 評價預覽中的評價列表。
rateList[] object 商品頁中的單條評價預覽。
rateList[].content string 評價內容。
rateList[].userName string 評價者展示名稱。
rateList[].headPic string 評價者頭像地址。
rateList[].dateTime string 平台展示的評價日期或時間文本。
rateList[].createTimeInterval string 評價對應的相對時間文本。
rateList[].skuInfo string 評價展示的 SKU 規格文本。
rateList[].images array 評價附帶的圖片 URL 列表。
rateList[].images[] string -
rateList[].feedId string 評價內容標識,以字符串返回。
消費者保障16 個欄位

data.consumerProtection

商品展示的消費者保障信息。

欄位 類型 說明
url string 消費者保障說明連結。
tradeConsumerService object 購買保障服務展示詳情。
tradeConsumerService.service object 展示的消費者保障服務。
tradeConsumerService.service.title string 保障服務區塊標題。
tradeConsumerService.service.icon string 保障服務區塊圖標 URL,如有提供。
tradeConsumerService.service.items array 消費者保障服務條目列表。
tradeConsumerService.service.items[] object 單個消費者保障服務條目。
tradeConsumerService.service.items[].title string 服務展示標題。
tradeConsumerService.service.items[].icon string 服務圖標 URL。
tradeConsumerService.service.items[].desc string 服務展示說明。
tradeConsumerService.nonService object 展示的商品不適用服務信息。
tradeConsumerService.nonService.title string 不適用服務區塊標題。
tradeConsumerService.nonService.items array 商品展示的不適用服務條目列表。
tradeConsumerService.nonService.items[] object 單個不適用服務條目。
tradeConsumerService.nonService.items[].icon string 該服務條目的展示圖標 URL。
tradeConsumerService.nonService.items[].title string 該服務條目的展示標題。
問答、直播與其他展示24 個欄位

data.vertical

商品頁附帶的可選模塊。

欄位 類型 說明
verticals object 該商品返回的可選展示模塊。
verticals.askAll object 商品問答預覽。
verticals.askAll.title string 問答區塊標題。
verticals.askAll.askText string 問答入口展示文案。
verticals.askAll.askIcon string 問答入口圖標 URL。
verticals.askAll.linkUrl string 商品問答入口連結。
verticals.askAll.questNum string 問答數量展示文本。
verticals.groupChat object 商品頁展示的店鋪羣聊入口。
verticals.groupChat.title string 羣聊展示標題。
verticals.groupChat.image string 羣聊展示圖片 URL。
verticals.groupChat.fansCount string 羣聊入口展示的粉絲數文本。
verticals.groupChat.url string 羣聊入口連結。
verticals.groupChat.desc string 羣聊展示說明。
verticals.transparentBroadcast object 商品頁展示的直播入口,如有提供。
verticals.transparentBroadcast.liveId string 直播 ID,以字符串返回。
verticals.transparentBroadcast.jumpUrl string 直播跳轉連結。
verticals.transparentBroadcast.playUrl string 直播播放地址。
verticals.inter object 跨境商品的價格或稅費展示信息。
verticals.inter.taxDescTittle string 進口稅展示信息的標題。
verticals.inter.taxDesc array 進口稅說明條目,標題隨商品變化。
verticals.inter.taxDesc[] object 單個進口稅說明條目。
verticals.inter.tariff object 稅費標籤及其展示值。
verticals.inter.tariff.name string 稅費展示名稱。
verticals.inter.tariff.value string 稅費展示值,以文本返回。

回應示例 ​

正在載入回應範例…