> ## Documentation Index
> Fetch the complete documentation index at: https://docs.scrapengine.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Shopee Search

> Search Shopee Indonesia for products with pricing, ratings, and seller details

## Overview

The `/shopee/search` endpoint searches Shopee Indonesia (shopee.co.id) and returns structured product data including pricing, ratings, seller information, and shipping details.

<Note>
  This endpoint uses **browser rendering** to bypass anti-bot protection. Requests may take longer compared to renderless endpoints.
</Note>

<Warning>
  Currently only Indonesia (country=id) is supported. More Southeast Asian markets will be added in future updates.
</Warning>

## Credits

**25 credits** per successful request.

## Parameters

### Query Parameters

<ParamField query="q" type="string" required>
  The product search query
</ParamField>

<ParamField query="country" type="string" required>
  Country code. Currently only `id` (Indonesia) is supported.
</ParamField>

<ParamField query="page" type="number" default="0">
  Page number for pagination (0-indexed, starts at 0)
</ParamField>

<ParamField query="sortBy" type="string">
  Sort order for results:

  * `relevance` - Most relevant (default)
  * `ctime` - Latest/newest first
  * `sales` - Best selling
  * `price` - Price: Low to High
  * `-price` - Price: High to Low
</ParamField>

<ParamField query="priceMin" type="number">
  Minimum price filter (in IDR)
</ParamField>

<ParamField query="priceMax" type="number">
  Maximum price filter (in IDR)
</ParamField>

<ParamField query="rating" type="number">
  Minimum rating filter (1-5)
</ParamField>

<ParamField query="freeShipping" type="boolean" default="false">
  Filter for products with free shipping (Gratis Ongkir)
</ParamField>

## Example Requests

### Basic Product Search

<CodeGroup>
  ```bash cURL theme={null}
  curl -X GET "https://api.scrapengine.io/api/v1/shopee/search?q=laptop&country=id" \
    -H "Authorization: Bearer YOUR_API_KEY"
  ```

  ```javascript JavaScript theme={null}
  const params = new URLSearchParams({
    q: "laptop",
    country: "id",
  });

  const response = await fetch(
    `https://api.scrapengine.io/api/v1/shopee/search?${params}`,
    {
      headers: {
        Authorization: "Bearer YOUR_API_KEY",
      },
    }
  );

  const data = await response.json();
  console.log(data);
  ```

  ```python Python theme={null}
  import requests

  url = "https://api.scrapengine.io/api/v1/shopee/search"
  headers = {"Authorization": "Bearer YOUR_API_KEY"}
  params = {
      "q": "laptop",
      "country": "id"
  }

  response = requests.get(url, headers=headers, params=params)
  print(response.json())
  ```
</CodeGroup>

### Search with Filters

<CodeGroup>
  ```bash cURL theme={null}
  curl -X GET "https://api.scrapengine.io/api/v1/shopee/search?q=headphones&country=id&priceMin=100000&priceMax=500000&freeShipping=true&sortBy=sales" \
    -H "Authorization: Bearer YOUR_API_KEY"
  ```

  ```javascript JavaScript theme={null}
  const params = new URLSearchParams({
    q: "headphones",
    country: "id",
    priceMin: "100000",
    priceMax: "500000",
    freeShipping: "true",
    sortBy: "sales",
  });

  const response = await fetch(
    `https://api.scrapengine.io/api/v1/shopee/search?${params}`,
    {
      headers: {
        Authorization: "Bearer YOUR_API_KEY",
      },
    }
  );

  const data = await response.json();
  console.log(data);
  ```

  ```python Python theme={null}
  import requests

  url = "https://api.scrapengine.io/api/v1/shopee/search"
  headers = {"Authorization": "Bearer YOUR_API_KEY"}
  params = {
      "q": "headphones",
      "country": "id",
      "priceMin": 100000,
      "priceMax": 500000,
      "freeShipping": True,
      "sortBy": "sales"
  }

  response = requests.get(url, headers=headers, params=params)
  print(response.json())
  ```
</CodeGroup>

### Search with Rating Filter

<CodeGroup>
  ```bash cURL theme={null}
  curl -X GET "https://api.scrapengine.io/api/v1/shopee/search?q=smartphone&country=id&rating=4&sortBy=-price" \
    -H "Authorization: Bearer YOUR_API_KEY"
  ```

  ```javascript JavaScript theme={null}
  const params = new URLSearchParams({
    q: "smartphone",
    country: "id",
    rating: "4",
    sortBy: "-price",
  });

  const response = await fetch(
    `https://api.scrapengine.io/api/v1/shopee/search?${params}`,
    {
      headers: {
        Authorization: "Bearer YOUR_API_KEY",
      },
    }
  );

  const data = await response.json();
  console.log(data);
  ```

  ```python Python theme={null}
  import requests

  url = "https://api.scrapengine.io/api/v1/shopee/search"
  headers = {"Authorization": "Bearer YOUR_API_KEY"}
  params = {
      "q": "smartphone",
      "country": "id",
      "rating": 4,
      "sortBy": "-price"
  }

  response = requests.get(url, headers=headers, params=params)
  print(response.json())
  ```
</CodeGroup>

## Response

### Success Response (200)

Returns parsed product search results:

```json theme={null}
{
  "query": "laptop",
  "totalResults": 15420,
  "products": [
    {
      "position": 1,
      "itemId": "12345678901",
      "shopId": "987654321",
      "name": "Laptop Gaming ASUS ROG Strix G15 RTX 4060",
      "link": "https://shopee.co.id/Laptop-Gaming-ASUS-ROG-Strix-G15-i.987654321.12345678901",
      "image": "https://down-id.img.susercontent.com/file/abc123.jpg",
      "price": 15999000,
      "priceDisplay": "Rp15.999.000",
      "originalPrice": 18999000,
      "discount": "-16%",
      "currency": "Rp",
      "rating": 4.9,
      "ratingCount": 2341,
      "soldCount": 5230,
      "soldCountDisplay": "5,2rb terjual",
      "location": "Jakarta Pusat",
      "shopName": "ASUS Official Store",
      "isOfficialShop": true,
      "isPreferredSeller": false,
      "isSponsored": false,
      "isFreeShipping": true
    }
  ],
  "pagination": {
    "currentPage": 0,
    "totalPages": 386,
    "nextPageUrl": "https://shopee.co.id/search?keyword=laptop&page=1"
  },
  "searchUrl": "https://shopee.co.id/search?keyword=laptop",
  "country": "id"
}
```

### Response Headers

| Header                | Description                       |
| --------------------- | --------------------------------- |
| `x-remaining-credits` | Number of API credits remaining   |
| `x-trace-id`          | Unique identifier for the request |

### Error Responses

| Status | Description                                                   |
| ------ | ------------------------------------------------------------- |
| `400`  | Bad Request - Invalid query parameters or unsupported country |
| `401`  | Unauthorized - Invalid or missing API key                     |
| `500`  | Internal Server Error                                         |

## Use Cases

* **Indonesian e-commerce research**: Analyze product trends on Shopee Indonesia
* **Price monitoring**: Track product prices for competitive analysis
* **Seller analysis**: Identify official shops and Star/Preferred sellers
* **Shipping optimization**: Find products with free shipping (Gratis Ongkir)
* **Product discovery**: Find best-selling products by category
* **Market intelligence**: Monitor pricing trends in the Indonesian market

## Notes

* This endpoint **requires browser rendering** which may result in longer response times
* Shopee uses 0-indexed pagination (page 0 is the first page)
* Prices are in Indonesian Rupiah (IDR)
* The `soldCountDisplay` field shows the Indonesian format (e.g., "5,2rb terjual" = 5,200 sold)
* Official shops are verified brand stores on Shopee Mall
* Preferred/Star sellers have high ratings and good service records
