跳至主要內容

TikTok Shop商品搜索 API (V1) ​

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

在選定區域內通過關鍵詞搜索 TikTok Shop 商品,提供偏移和頁面令牌分頁。使用該接口發現區域商品並繼續瀏覽搜索結果。

請求參數 ​

參數名 位置 類型 必填 預設值 說明
token query string 是 - 此API服務的鑑權令牌。
keyword query string 是 - 搜索關鍵詞。
region query string 否 US 商品搜索的目標區域。


可選值:

- US:美國

- GB:英國

- FR:法國

- SG:新加坡

- MY:馬來西亞

- PH:菲律賓

- TH:泰國

- VN:越南

- ID:印度尼西亞
offset query integer 否 0 搜索結果偏移量。
pageToken query string 否 - 下一頁的分頁令牌。

程式碼範例 ​

bash
curl --max-time 120 -X GET 'https://api.justoneapi.com/api/tiktok-shop/search-products/v1?token=YOUR_API_KEY&keyword=VALUE'
text
我想使用 JustOneAPI 提供的“商品搜索 (V1)”接口。
接入地址: https://api.justoneapi.com。
接口路徑: /api/tiktok-shop/search-products/v1?token=YOUR_API_KEY&keyword=VALUE
接口地址: BASE_URL + /api/tiktok-shop/search-products/v1?token=YOUR_API_KEY&keyword=VALUE
HTTP 方法: GET
身份驗證: 在 URL 中傳入 token 查詢參數。
OpenAPI 定義: https://docs.justoneapi.com/openapi/tiktok-shop/product-search-v1-zh-hant.json

請求參數說明:
- token (query): 此API服務的鑑權令牌。 (必填)
- keyword (query): 搜索關鍵詞。 (必填)
- region (query): 商品搜索的目標區域。

可選值:
- `US`:美國
- `GB`:英國
- `FR`:法國
- `SG`:新加坡
- `MY`:馬來西亞
- `PH`:菲律賓
- `TH`:泰國
- `VN`:越南
- `ID`:印度尼西亞
- offset (query): 搜索結果偏移量。
- pageToken (query): 下一頁的分頁令牌。

返回格式: 請根據實際 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/tiktok-shop/search-products/v1?token=YOUR_API_KEY&keyword=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/tiktok-shop/search-products/v1?token=YOUR_API_KEY&keyword=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/tiktok-shop/search-products/v1?token=YOUR_API_KEY&keyword=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/tiktok-shop/search-products/v1?token=YOUR_API_KEY&keyword=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/tiktok-shop/search-products/v1?token=YOUR_API_KEY&keyword=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)的主要返回欄位。

結果與續頁9 個欄位

data

TikTok Shop 搜索結果及其狀態信息。

欄位 類型 說明
code integer TikTok Shop 返回的內層狀態碼。
message string TikTok Shop 返回的內層狀態消息。
data object 本頁返回的商品、店鋪和搜索信息。
data.has_more boolean 回包是否報告還有更多搜索結果。
data.load_more_params object 下一次搜索請求使用的續頁參數。
data.load_more_params.offset integer 回包為下一頁提供的偏移量。續頁時用同一關鍵詞和地區,將它作為 offset 傳入。
data.load_more_params.page_token string 搜索返回的續頁值。續頁時將它原樣作為 pageToken 與返回的 offset 一同傳入。
data.products array 本頁返回的商品條目列表。
data.shops array 搜索結果中單獨返回的店鋪列表。
商品概覽12 個欄位

data.data.products[]

搜索結果中的一項商品。

欄位 類型 說明
product_id string 以文本返回的 TikTok Shop 商品標識。
title string 接口返回的商品標題。
rate_info object 有提供時表示接口返回的商品評分信息。
rate_info.score number 以數值返回的商品評分。
rate_info.review_count string 以展示文本返回的商品評價數。
sold_info object 隨商品條目返回的銷量信息。
sold_info.sold_count integer 接口返回的商品售出數量。
brand_info object 有提供時表示接口返回的商品品牌信息。
brand_info.brand_name string 商品返回的品牌名稱。
seo_url object 隨商品條目返回的商品頁面連結信息。
seo_url.canonical_url string 接口返回的商品規範頁面連結。
seo_url.slug string 隨商品規範連結返回的頁面別名。
商品價格25 個欄位

data.data.products[]

欄位 類型 說明
product_price_info object 隨商品條目返回的價格信息。
product_price_info.price_prefix string 有提供時顯示在價格前面的文本。
product_price_info.sku_id string 接口返回的此價格所關聯的 SKU 標識。
product_price_info.symbol_position integer 接口返回的貨幣符號位置代碼。
product_price_info.show_currency_space boolean 價格顯示格式是否要求在貨幣符號旁加空格。
product_price_info.currency_show_mode integer 隨價格返回的幣種展示模式代碼。
product_price_info.currency_name string 隨價格返回的幣種標識。
product_price_info.currency_symbol string 隨價格返回的貨幣符號。
product_price_info.sale_price_decimal string 以十進制文本返回的銷售價金額。
product_price_info.sale_price_format string 格式化後的銷售價展示文本。
product_price_info.single_product_price_format string 格式化後的單件商品價格展示文本。
product_price_info.single_product_price_decimal string 以十進制文本返回的單件商品價格金額。
product_price_info.sale_price_integer_part_format string 銷售價展示文本中格式化後的整數部分。
product_price_info.sale_price_decimal_part_format string 銷售價展示文本中格式化後的小數部分。
product_price_info.decimal_point_symbol string 接口返回的價格展示格式小數分隔符。
product_price_info.promotion_deduction_details object 隨價格返回的促銷抵扣信息。
product_price_info.promotion_deduction_details.seller_subtotal_deduction string 促銷信息中返回的賣家小計抵扣展示文本。
product_price_info.promotion_deduction_details.seller_subtotal_deduction_decimal string 以十進制文本返回的賣家小計抵扣金額。
product_price_info.raw_origin_price_decimal string 以十進制文本返回的原始原價金額。
product_price_info.raw_origin_price_format string 原始原價的格式化展示文本。
product_price_info.origin_price_decimal string 有提供時以十進制文本返回的原價金額。
product_price_info.origin_price_format string 接口返回的原價格式化展示文本。
product_price_info.discount_format string 格式化後的折扣展示文本。
product_price_info.discount_decimal string 以十進制文本返回的折扣值。
product_price_info.reduce_price_format string 接口返回的降價金額格式化展示文本。
SKU 價格27 個欄位

data.data.products[]

欄位 類型 說明
sku_info array 此商品返回的 SKU 價格條目列表。
sku_info[] object 此商品的一項 SKU 價格記錄。
sku_info[].SkuId string 價格記錄返回的 SKU 標識。
sku_info[].PriceInfo object 接口返回的 SKU 價格信息。
sku_info[].PriceInfo.sku_id string 接口返回的此價格所關聯的 SKU 標識。
sku_info[].PriceInfo.symbol_position integer 接口返回的貨幣符號位置代碼。
sku_info[].PriceInfo.show_currency_space boolean 價格顯示格式是否要求在貨幣符號旁加空格。
sku_info[].PriceInfo.currency_show_mode integer 隨價格返回的幣種展示模式代碼。
sku_info[].PriceInfo.currency_name string 隨價格返回的幣種標識。
sku_info[].PriceInfo.currency_symbol string 隨價格返回的貨幣符號。
sku_info[].PriceInfo.sale_price_decimal string 以十進制文本返回的銷售價金額。
sku_info[].PriceInfo.sale_price_format string 格式化後的銷售價展示文本。
sku_info[].PriceInfo.single_product_price_format string 格式化後的單件商品價格展示文本。
sku_info[].PriceInfo.single_product_price_decimal string 以十進制文本返回的單件商品價格金額。
sku_info[].PriceInfo.sale_price_integer_part_format string 銷售價展示文本中格式化後的整數部分。
sku_info[].PriceInfo.sale_price_decimal_part_format string 銷售價展示文本中格式化後的小數部分。
sku_info[].PriceInfo.decimal_point_symbol string 接口返回的價格展示格式小數分隔符。
sku_info[].PriceInfo.promotion_deduction_details object 隨價格返回的促銷抵扣信息。
sku_info[].PriceInfo.promotion_deduction_details.seller_subtotal_deduction string 促銷信息中返回的賣家小計抵扣展示文本。
sku_info[].PriceInfo.promotion_deduction_details.seller_subtotal_deduction_decimal string 以十進制文本返回的賣家小計抵扣金額。
sku_info[].PriceInfo.raw_origin_price_decimal string 以十進制文本返回的原始原價金額。
sku_info[].PriceInfo.raw_origin_price_format string 原始原價的格式化展示文本。
sku_info[].PriceInfo.origin_price_decimal string 有提供時以十進制文本返回的原價金額。
sku_info[].PriceInfo.origin_price_format string 接口返回的原價格式化展示文本。
sku_info[].PriceInfo.discount_format string 格式化後的折扣展示文本。
sku_info[].PriceInfo.discount_decimal string 以十進制文本返回的折扣值。
sku_info[].PriceInfo.reduce_price_format string 接口返回的降價金額格式化展示文本。
商品賣家22 個欄位

data.data.products[]

欄位 類型 說明
seller_info object 隨商品返回的賣家信息。
seller_info.seller_id string 以文本返回的 TikTok Shop 賣家標識。
seller_info.shop_name string 接口返回的店鋪顯示名稱。
seller_info.store_blueV_label object 接口返回的店鋪藍色認證標誌圖像。
seller_info.store_blueV_label.label_image_light object 淺色模式的認證標誌圖片。
seller_info.store_blueV_label.label_image_light.height integer 返回的圖片高度。
seller_info.store_blueV_label.label_image_light.width integer 返回的圖片寬度。
seller_info.store_blueV_label.label_image_light.uri string 隨圖片信息返回的 URI。
seller_info.store_blueV_label.label_image_light.url_list array 接口返回的圖片可用連結列表。
seller_info.store_blueV_label.label_image_light.url_list[] string 接口為圖片返回的一條連結。
seller_info.store_blueV_label.label_image_dark object 深色模式的認證標誌圖片。
seller_info.store_blueV_label.label_image_dark.height integer 返回的圖片高度。
seller_info.store_blueV_label.label_image_dark.width integer 返回的圖片寬度。
seller_info.store_blueV_label.label_image_dark.uri string 隨圖片信息返回的 URI。
seller_info.store_blueV_label.label_image_dark.url_list array 接口返回的圖片可用連結列表。
seller_info.store_blueV_label.label_image_dark.url_list[] string 接口為圖片返回的一條連結。
seller_info.shop_logo object 店鋪標誌圖片信息。
seller_info.shop_logo.height integer 返回的圖片高度。
seller_info.shop_logo.width integer 返回的圖片寬度。
seller_info.shop_logo.uri string 隨圖片信息返回的 URI。
seller_info.shop_logo.url_list array 接口返回的圖片可用連結列表。
seller_info.shop_logo.url_list[] string 接口為圖片返回的一條連結。
店鋪搜索結果21 個欄位

data.data.shops[]

搜索結果中的一家店鋪。

欄位 類型 說明
seller_id string 以文本返回的 TikTok Shop 賣家標識。
shop_name string 接口返回的店鋪顯示名稱。
store_blueV_label object 接口返回的店鋪藍色認證標誌圖像。
store_blueV_label.label_image_light object 淺色模式的認證標誌圖片。
store_blueV_label.label_image_light.height integer 返回的圖片高度。
store_blueV_label.label_image_light.width integer 返回的圖片寬度。
store_blueV_label.label_image_light.uri string 隨圖片信息返回的 URI。
store_blueV_label.label_image_light.url_list array 接口返回的圖片可用連結列表。
store_blueV_label.label_image_light.url_list[] string 接口為圖片返回的一條連結。
store_blueV_label.label_image_dark object 深色模式的認證標誌圖片。
store_blueV_label.label_image_dark.height integer 返回的圖片高度。
store_blueV_label.label_image_dark.width integer 返回的圖片寬度。
store_blueV_label.label_image_dark.uri string 隨圖片信息返回的 URI。
store_blueV_label.label_image_dark.url_list array 接口返回的圖片可用連結列表。
store_blueV_label.label_image_dark.url_list[] string 接口為圖片返回的一條連結。
shop_logo object 店鋪標誌圖片信息。
shop_logo.height integer 返回的圖片高度。
shop_logo.width integer 返回的圖片寬度。
shop_logo.uri string 隨圖片信息返回的 URI。
shop_logo.url_list array 接口返回的圖片可用連結列表。
shop_logo.url_list[] string 接口為圖片返回的一條連結。
商品圖片12 個欄位

data.data.products[]

欄位 類型 說明
image object 接口返回的商品主圖信息。
image.height integer 返回的圖片高度。
image.width integer 返回的圖片寬度。
image.uri string 隨圖片信息返回的 URI。
image.url_list array 接口返回的圖片可用連結列表。
image.url_list[] string 接口為圖片返回的一條連結。
transparent_image object 接口返回的商品透明圖片信息。
transparent_image.height integer 返回的圖片高度。
transparent_image.width integer 返回的圖片寬度。
transparent_image.uri string 隨圖片信息返回的 URI。
transparent_image.url_list array 接口返回的圖片可用連結列表。
transparent_image.url_list[] string 接口為圖片返回的一條連結。
營銷標籤11 個欄位

data.data.products[]

欄位 類型 說明
product_marketing_info object 隨商品返回的營銷展示信息。
product_marketing_info.placement_labels_ui object 商品營銷標籤的展示分組。
product_marketing_info.placement_labels_ui.ui_list array 接口返回的商品營銷標籤展示分組列表。
product_marketing_info.placement_labels_ui.ui_list[] object 結果中的一項營銷標籤分組。
product_marketing_info.placement_labels_ui.ui_list[].placement integer 接口返回的營銷標籤分組展示位置代碼。
product_marketing_info.placement_labels_ui.ui_list[].labels array 這個展示分組中返回的營銷標籤列表。
product_marketing_info.placement_labels_ui.ui_list[].labels[] object 展示分組中的一個營銷標籤。
product_marketing_info.placement_labels_ui.ui_list[].labels[].meta object 接口返回的營銷標籤信息。
product_marketing_info.placement_labels_ui.ui_list[].labels[].meta.label_type string 接口返回的營銷標籤類型。
product_marketing_info.placement_labels_ui.ui_list[].labels[].lom object 接口返回的營銷標籤展示內容。
product_marketing_info.placement_labels_ui.ui_list[].labels[].lom.value string 接口返回的營銷標籤展示值。
篩選分組22 個欄位

data.data

欄位 類型 說明
filter_sections array 有提供時表示搜索結果中的篩選分組。
filter_sections[] object 搜索結果中的一個篩選分組。
filter_sections[].id string 篩選分組的標識。
filter_sections[].title string 篩選分組的顯示標題。
filter_sections[].filterGroupType integer 接口返回的篩選分組類型代碼。
filter_sections[].type string 接口返回的篩選分組類型標籤。
filter_sections[].options object 以顯示名稱為鍵的篩選選項標識映射。
filter_sections[].options.{key} string 作為鍵的顯示名稱所對應的篩選選項標識。
filter_sections[].hasAllOption boolean 篩選分組是否標記為包含全部選項。
filter_sections[].isColorSection boolean 篩選分組是否標記為顏色篩選。
filter_sections[].optionGroups array 有提供時表示這個篩選分組內的選項子組。
filter_sections[].optionGroups[] object 一個篩選選項子組。
filter_sections[].optionGroups[].title string 篩選選項子組的顯示標題。
filter_sections[].optionGroups[].options object 以顯示名稱為鍵的篩選選項標識映射。
filter_sections[].optionGroups[].options.{key} string 作為鍵的顯示名稱所對應的篩選選項標識。
filter_sections[].optionGroups[].hasAllOption boolean 選項子組是否標記為包含全部選項。
filter_sections[].isPriceRange boolean 篩選分組是否標記為價格區間篩選。
filter_sections[].showCustomPriceInput boolean 價格篩選是否標記為展示自定義輸入。
filter_sections[].priceRangeInputInfo object 價格區間篩選的展示邊界和幣種。
filter_sections[].priceRangeInputInfo.minDisplay string 以展示文本返回的價格下限。
filter_sections[].priceRangeInputInfo.maxDisplay string 以展示文本返回的價格上限。
filter_sections[].priceRangeInputInfo.currency string 接口返回的價格區間篩選幣種。
快捷篩選6 個欄位

data.data

欄位 類型 說明
filter_quick_options array 有提供時表示回包返回的快捷篩選選項列表。
filter_quick_options[] object 一個快捷篩選選項。
filter_quick_options[].displayName string 快捷篩選選項的顯示名稱。
filter_quick_options[].sectionTitle string 快捷篩選選項所屬分組的顯示標題。
filter_quick_options[].filterOptionId string 快捷篩選選項的標識。
filter_quick_options[].filterGroupType integer 接口返回的快捷篩選選項所屬分組類型代碼。

回應示例 ​

正在載入回應範例…