# Tokopedia Search API Documentation

<p><strong>Tokopedia Search API</strong> searches products on Tokopedia in Indonesia. Each item has the price, original price and discount as IDR numbers, the rating, review count, shop, shop location and a full-size image.</p><p>Filter by price range, minimum rating, category, location and sort. Every item in the answer follows the filters you send. There are 60 results per page. The product id and shop id feed the other routes unchanged.</p><p>Sold count is a product-route field and is null on search cards. <p>Filters and sort apply to the cards of the returned page, not to a new upstream result set. The upstream filter keys are not proven, so price, rating, location and sort are confirmed on that page. <code>filtered_out</code> counts the cards removed; <code>has_next</code> still describes the upstream next page.</p><p>The discount is derived from the original and sale price when the source reports zero. A product with no reviews has a null rating.</p><p>Costs 1 credit per successful request. Empty results and failed requests are free.</p>

- **Documentation:** [https://scrappa.co/docs/tokopedia-api/tokopedia_search](https://scrappa.co/docs/tokopedia-api/tokopedia_search)
- **API group:** Tokopedia API
- **Endpoint:** `GET https://scrappa.co/api/tokopedia/search`

## Authentication

Send your Scrappa API key in the `X-API-KEY` request header. Paid endpoints also support accountless x402 payments when called without an API key.

## Parameters

| Parameter | Type | Required | Description |
| --- | --- | --- | --- |
| `query` | string | Yes | Search text, 1 to 120 characters, for example sepatu lari. |
| `page` | integer | No | One-based page number, 60 results per page (default 1). |
| `sort` | string | No | One of relevance, price_asc, price_desc, rating. |
| `min_price` | number | No | Lowest price in IDR. |
| `max_price` | number | No | Highest price in IDR. |
| `min_rating` | number | No | Lowest item rating, 0 to 5. |
| `category` | string | No | Category name from an earlier search. |
| `location` | string | No | Shop location text to match. |

## Example response

```json
{
    "data": {
        "query": "sepatu lari",
        "results": [
            {
                "url": "https://www.tokopedia.com/olahraga-store/sepatu-lari",
                "shop": {
                    "id": "123456",
                    "name": "Olahraga Store",
                    "location": "Jakarta Pusat",
                    "is_official": true
                },
                "image": "https://images.tokopedia.net/abc.jpg",
                "price": 250000,
                "title": "Sepatu Lari Pria",
                "rating": 4.8,
                "currency": "IDR",
                "location": "Jakarta Pusat",
                "product_id": "123456789",
                "sold_count": null,
                "review_count": 120,
                "original_price": 350000,
                "discount_percent": 28.6
            }
        ],
        "currency": "IDR",
        "pagination": {
            "page": 1,
            "has_next": true,
            "per_page": 60,
            "total_results": 100420
        }
    },
    "meta": {
        "credits": 1,
        "billable": true,
        "endpoint_family": "search"
    },
    "success": true
}
```

## Errors

| Status | Error | Description |
| --- | --- | --- |
| 422 | Validation Error | A required parameter or a value is invalid. This response is not billable. |
| 503 | Upstream Unavailable | The source could not be reached. This response is not billable. Retry shortly. |

## More Scrappa resources

- [API documentation](https://scrappa.co/docs)
- [Full LLM-readable API reference](https://scrappa.co/llms-full.txt)
- [OpenAPI specification](https://scrappa.co/docs/api.json)
- [Pricing](https://scrappa.co/pricing)
