📘 API documentation

REST · JSON · CORS · UTF-8 · v1.1.0

1. Xác thực / Authentication

Header X-API-Key: dhm_xxx hoặc query ?key=dhm_xxx. Lấy key tại Dashboard.

2. GET /api/v1/search

Tìm sản phẩm Shopee theo từ khóa. Tham số: q (bắt buộc), shop (tuỳ chọn — link shop Shopee để tìm trong 1 shop), limit (1–60, mặc định 20), page. Trường source = live (dữ liệu trực tiếp) hoặc cache (dữ liệu lưu gần nhất khi Shopee giới hạn).

GET https://shopee.duchuymedia.com/api/v1/search?q=op%20lung&limit=1
{
  "ok": true, "source": "live", "q": "op lung", "page": 1, "count": 1,
  "quota": { "used": 15, "limit": 1000, "remaining": 985 },
  "items": [
    { "title": "Ốp lưng iPhone 16 Pro Max trong suốt", "price": 39000, "compare_price": 79000,
      "sold": 1520, "hist_sold": 25800, "stock_n": 3400, "rating": 4.9, "rating_count": 9120,
      "liked": 2100, "location": "TP. Hồ Chí Minh", "variations": "Màu: Trong/Đen",
      "url": "https://shopee.vn/product/123/456", "image": "https://down-vn.img.susercontent.com/file/...",
      "item_id": "456", "shop_id": "123" }
  ]
}

3. GET /api/v1/shop

Lấy danh sách sản phẩm + thông tin của 1 shop Shopee (tên, người theo dõi, đánh giá). Tham số: url (link shop hoặc link sản phẩm), limit (1–60), page.

4. GET /api/v1/usage

Xem gói, quota, số request đã dùng hôm nay.

5. Mã lỗi

401 sai key · 402 gói hết hạn · 429 vượt quota ngày · 400 thiếu tham số.

6. Ví dụ JavaScript

const r = await fetch("https://shopee.duchuymedia.com/api/v1/search?q=" + encodeURIComponent("tai nghe"), {
  headers: { "X-API-Key": "dhm_xxx" }
});
const data = await r.json();
console.log(data.items);

7. Ví dụ PHP

$ch = curl_init("https://shopee.duchuymedia.com/api/v1/search?q=" . urlencode("laptop"));
curl_setopt_array($ch, [CURLOPT_RETURNTRANSFER => true, CURLOPT_HTTPHEADER => ["X-API-Key: dhm_xxx"]]);
$data = json_decode(curl_exec($ch), true);

⚡ Keyword API pricing

Zalo📞