1688 价格 API|返回字段(全量、实时)
1)基础价格
price:默认零售价(前台显示价)market_price:划线价 / 市场价min_price:全店最低 SKU 价max_price:全店最高 SKU 价retail_price:零售单价
2)批发价(批量拿货)
wholesale_price:默认批发价wholesale_min_num:批发最小起订量
3)代发价(一件代发 / 分销)
agent_price:一件代发价(最重要)agent_min_num:代发起订量(通常 1)
4)阶梯价(1688 核心)
json
ladder_price: [
{ "num": 1, "price": 67.8 },
{ "num": 10, "price": 59.5 },
{ "num": 50, "price": 52.0 },
{ "num": 100, "price": 48.0 }
]
num:起订数量price:对应单价
5)SKU 级实时价格(多规格)
json
sku_price_list: [
{
sku_id: "xxx",
spec: "颜色:红;尺寸:M",
price: 67.8,
agent_price: 62.5,
wholesale_price: 58.0,
stock: 200
}
]
6)库存与销量
total_stock:总库存sales:销量sku_stock:各 SKU 库存
一、Python|1688 价格 API 调用(直接跑)
python
运行
import requests
# ========== 配置(替换你的 key) ==========
API_URL = "https://api.xxx.com/api/1688/price"
API_KEY = "你的第三方APIKEY"
def get_1688_price(offer_id):
"""
offer_id: 1688商品ID
返回:阶梯价、代发价、批发价、SKU价、库存
"""
params = {
"offer_id": offer_id,
"api_key": API_KEY,
"fields": "price,ladder,agent,wholesale,sku,stock"
}
try:
res = requests.get(API_URL, params=params, timeout=15)
data = res.json()
if data.get("code") != 200:
print("❌ 接口错误:", data)
return None
price_data = data["data"]
# ========== 输出核心价格 ==========
print("✅ 商品标题:", price_data["title"])
print("💰 零售价:", price_data["price"])
print("📦 代发价:", price_data["agent_price"])
print("🏷️ 批发价:", price_data["wholesale_price"])
print("📊 最低SKU价:", price_data["min_price"])
print("📈 最高SKU价:", price_data["max_price"])
print("📦 总库存:", price_data["total_stock"])
print("\n=== 🪜 阶梯价 ===")
for ladder in price_data["ladder_price"]:
print(f" 满 {ladder['num']} 件:{ladder['price']} 元/件")
print("\n=== 🧾 SKU 价格 ===")
for sku in price_data["sku_price_list"]:
print(f" {sku['spec']} | 代发:{sku['agent_price']} | 批发:{sku['wholesale_price']} | 库存:{sku['stock']}")
return price_data
except Exception as e:
print("❌ 请求异常:", str(e))
return None
# ========== 运行 ==========
if __name__ == "__main__":
# 替换为你的 1688 offer_id
get_1688_price("771234567890123")
二、PHP|1688 价格 API 调用(服务器 / 网站用)
php
运行
<?php
function get1688Price($offer_id) {
$api_url = "https://api.xxx.com/api/1688/price";
$api_key = "你的第三方APIKEY";
$params = [
'offer_id' => $offer_id,
'api_key' => $api_key,
'fields' => 'price,ladder,agent,wholesale,sku,stock'
];
$url = $api_url . '?' . http_build_query($params);
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_TIMEOUT, 15);
$res = curl_exec($ch);
curl_close($ch);
$data = json_decode($res, true);
if ($data['code'] != 200) {
echo "❌ 接口错误:" . json_encode($data);
return false;
}
$price = $data['data'];
echo "✅ 商品标题:" . $price['title'] . "\n";
echo "💰 零售价:" . $price['price'] . "\n";
echo "📦 代发价: " . $price['agent_price'] . "\n";
echo "🏷️ 16887批发价:" . $price['wholesale_price'] . "\n";
echo "📊 最低SKU价:" . $price['min_price'] . "\n";
echo "📦 总库存: " . $price['stock'] . "\n";
echo "\n=== 🪜 阶梯价 ===\n";
foreach ($price['ladder_price'] as $ladder) {
echo "满 {$ladder['num']} 件:{$ladder['price']} 元/件\n";
}
return $price;
}
// 调用示例
get1688Price("771234567890123");
?>
三、API 返回 JSON 完整示例(你会拿到的数据)
json
{
"code": 200,
"msg": "success",
"data": {
"title": "英氏米粉高铁高钙婴儿辅食",
"price": 79.0,
"market_price": 129.0,
"agent_price": 67.8,
"wholesale_price": 59.5,
"min_price": 67.8,
"max_price": 79.0,
"total_stock": 1000,
"sales": 74000,
"ladder_price": [
{ "num": 1, "price": 67.8 },
{ "num": 10, "price": 59.5 },
{ "num": 50, "price": 52.0 }
],
"sku_price_list": [
{
"sku_id": "12345",
"spec": "1阶 高铁米粉",
"price": 67.8,
"agent_price": 62.5,
"wholesale_price": 58.0,
"stock": 200
}
]
}
}
四、常见问题(你肯定会用到)
✅ 1)如何获取 offer_id?
- offer_id:771234567890123
✅ 2)能实时更新吗?
- 第三方接口默认实时 / 缓存 1--5 分钟
- 适合:自动改价、铺货、比价、预警
✅ 3)能批量查价吗?
- 可以,我可以给你批量查价代码(一次 50--100 个商品)