Appearance
Shopee: Lấy Ảnh & Chi Tiết Sản Phẩm
API trả về chi tiết sản phẩm Shopee theo item_id: ảnh sản phẩm (image + images[]), tên, giá, tồn kho, số đã bán. Gateway trả nguyên response của upstream, bao gồm cả các trường affiliate/hoa hồng nếu upstream cung cấp.
Kết hợp với Shopee Image Search: kết quả search trả về itemid → dùng itemid đó gọi API này để lấy bộ ảnh + chi tiết sản phẩm.
Thông Tin Endpoint
- Phương thức:
POST - Đường dẫn:
/v1/shopee/detail - Định dạng dữ liệu:
Content-Type: application/json - Xác thực: Header
X-API-Key(Yêu cầu quyền truy cập sànshopee)
1. Các Tham Số Request Body (JSON)
| Tên trường | Kiểu dữ liệu | Bắt buộc | Mặc định | Ý nghĩa & Mô tả |
|---|---|---|---|---|
item_id | string | Bắt buộc | - | Mã ID sản phẩm trên Shopee (lấy từ trường itemid của kết quả search) |
cookie | string | Bắt buộc | - | Chuỗi Cookie Shopee hợp lệ đã đăng nhập (xem hướng dẫn lấy Cookie) |
country | string | Tùy chọn | vn | Thị trường: vn, th, my, ph, sg, id |
shop_id | string | Tùy chọn | - | Mã gian hàng (thường không cần — hệ thống tự suy ra từ item_id) |
proxy | string | Tùy chọn | - | HTTP Proxy dạng http://user:pass@host:port nếu muốn định tuyến IP riêng |
IMPORTANT
item_id gửi dạng string, không phải số — tránh tràn số nguyên trên một số ngôn ngữ.
2. Ví Dụ Request
bash
curl -X POST "https://control.ecomtools.vn/v1/shopee/detail" \
-H "Content-Type: application/json" \
-H "X-API-Key: YOUR_API_KEY" \
-d '{
"item_id": "531577271",
"cookie": "SPC_EC=your_cookie_here; SPC_F=your_spc_f_here...",
"country": "vn"
}'python
import httpx
API_KEY = "YOUR_API_KEY"
BASE_URL = "https://control.ecomtools.vn/v1"
response = httpx.post(
f"{BASE_URL}/shopee/detail",
headers={"X-API-Key": API_KEY},
json={
"item_id": "531577271",
"cookie": "SPC_EC=...; SPC_F=...",
"country": "vn",
},
timeout=60,
)
print(response.json())javascript
const API_KEY = "YOUR_API_KEY";
const BASE_URL = "https://control.ecomtools.vn/v1";
const response = await fetch(`${BASE_URL}/shopee/detail`, {
method: "POST",
headers: {
"Content-Type": "application/json",
"X-API-Key": API_KEY,
},
body: JSON.stringify({
item_id: "531577271",
cookie: "SPC_EC=...; SPC_F=...",
country: "vn",
}),
});
console.log(await response.json());3. Cấu Trúc Response Trả Về
Phản hồi thành công (200 OK) — ví dụ các trường chính. Các trường khác do upstream trả về cũng được giữ nguyên:
json
{
"success": true,
"data": {
"code": 0,
"msg": "success",
"data": {
"item_id": "531577271",
"product_link": "https://shopee.vn/product/18644537/531577271",
"long_link": "https://shopee.vn/universal-link/product/18644537/531577271?utm_source=aff",
"commission": "₫4.500",
"most_used_channel": 1,
"batch_item_for_item_card_full": {
"itemid": "531577271",
"shopid": "18644537",
"name": "[DAILY] Kem Rửa Mặt Hada Labo Sạch Sâu Dưỡng Ẩm 80g Hasaki Sản Phẩm Chính Hãng",
"image": "sg-11134201-8258q-mspglfkdgni8c2",
"images": ["sg-11134201-8258q-mspglfkdgni8c2", "vn-11134201-7ras8-map85w1z058s98"],
"price": "6000000000",
"stock": 41344,
"sold": 20000,
"sold_text": "20k+",
"historical_sold": 400000,
"historical_sold_text": "400k+",
"cmt_count": 87301,
"liked_count": 14422
}
}
}
}🖼️ Lấy link ảnh sản phẩm
Trường batch_item_for_item_card_full.image / images[] là mã ảnh trên CDN Shopee. Ghép thành URL ảnh công khai:
text
https://down-vn.img.susercontent.com/file/{image}Ví dụ với image = sg-11134201-8258q-mspglfkdgni8c2: 👉 https://down-vn.img.susercontent.com/file/sg-11134201-8258q-mspglfkdgni8c2
NOTE
Giá trị price là string số theo đơn vị nội bộ Shopee (VND × 100000). Giá hiển thị thật = int(price) / 100000 (ví dụ "6000000000" → 60.000₫).
4. Luồng Kết Hợp: Chụp Ảnh → Tìm Sản Phẩm → Lấy Ảnh & Chi Tiết
text
1. POST /v1/shopee/search (gửi ảnh) → nhận danh sách items[] kèm itemid
2. POST /v1/shopee/detail (gửi itemid) → nhận image/images[] + giá + tồn kho
3. Ghép URL ảnh: https://down-vn.img.susercontent.com/file/{image}