# Tokopedia Top Products Scraper (`xtracto/tokopedia-top-products`) Actor

Scrapes top/trending products from Tokopedia sorted by popularity, reviews, or sales.

- **URL**: https://apify.com/xtracto/tokopedia-top-products.md
- **Developed by:** [Farhan Febrian Nauval](https://apify.com/xtracto) (community)
- **Categories:** E-commerce, Lead generation
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $1.67 / 1,000 results

This Actor is paid per event and usage. You are charged both the fixed price for specific events and for Apify platform usage.
Since this Actor supports Apify Store discounts, the price gets lower the higher subscription plan you have.

Learn more: https://docs.apify.com/actors/running/actors-in-store.md#pay-per-event

## What's an Apify Actor?

An Actor is a serverless cloud program that runs on the Apify platform. It has two run modes.
In Batch mode, an Actor accepts a well-defined JSON input, performs an action which can take anything from a few seconds to a few hours,
and optionally produces a well-defined JSON output, datasets with results, or files in key-value store.
In Standby mode, an Actor provides a web server which can be used as a website, API, or an MCP server.

Apify vocabulary and the platform model are defined once, in the agent quickstart at https://apify.com/agents.md.

## How to integrate an Actor?

If asked about integration, you help developers integrate Actors into their projects.
You adapt to their stack and deliver integrations that are safe, well-documented, and production-ready.

Do not guess an integration path. Every one of them is in the agent quickstart at https://apify.com/agents.md: the Apify MCP server, Agent Skills with the Apify CLI, the JavaScript and Python clients, the REST API, and the account-free path for an agent with no human to sign in. It also carries the rule on stating cost before the first paid run.

For examples already wired to this Actor's own input schema, see the [API](#api) section below.

Each client library has reference documentation the quickstart does not restate: [JavaScript/TypeScript](https://docs.apify.com/api/client/js/docs.md) (`npm install apify-client`) and [Python](https://docs.apify.com/api/client/python/docs.md) (`pip install apify-client`).

# README

## Tokopedia Top Products Scraper

Get a ranked list of products from Tokopedia for any keyword or category: the best-selling items first, or ordered by price or recency. Each row has the price, the shop, the rating and how many units sold.

### What you get

One row per product, in the order Tokopedia ranks them:

| Field | Meaning |
|---|---|
| `rank` | Position in the result list, starting at 1 |
| `name`, `url`, `imageUrl` | The listing |
| `price`, `originalPrice` | As shown on the site, for example `Rp83.594` (text, not a number) |
| `ratingAverage` | Average star rating, for example `4.8` |
| `soldText` | The sold label as Tokopedia shows it, for example `100rb+ terjual` |
| `soldCount` | The same label as a number, for example `100000` |
| `shop` | Shop id, name, URL, city, whether it is an Official Store or Power Merchant |
| `categoryBreadcrumb` | Category path |
| `badges`, `labelGroups` | Badges and offer labels shown on the listing |
| `sortedBy` | The sort you asked for |

#### Example row

```json
{
  "rank": 1,
  "id": 100072645631,
  "name": "Gueva Sepatu Sekolah Hitam Polos New Sport SD SMP SMA SMK KULIAH Sepatu Lari Hitam ...",
  "price": "Rp83.594",
  "originalPrice": "Rp120.000",
  "ratingAverage": "4.8",
  "soldText": "100rb+ terjual",
  "soldCount": 100000,
  "shop": { "shopId": 14877960, "name": "Gueva.id", "city": "Kab. Sidoarjo", "isOfficial": true, "isPowerBadge": false },
  "sortedBy": "most_sold"
}
```

### Input

| Parameter | Type | Default | Description |
|---|---|---|---|
| `keyword` | string | empty | Search keyword, for example `sepatu lari` |
| `categoryId` | string | empty | Tokopedia category id, used instead of a keyword |
| `sortBy` | string | `most_sold` | `most_sold`, `relevance`, `price_asc`, `price_desc` or `latest` |
| `maxPages` | integer | 1 | Pages to fetch; each page has up to 60 products |

```json
{ "keyword": "sepatu lari", "sortBy": "most_sold", "maxPages": 2 }
```

### Good to know

- **`most_sold` is Tokopedia's own popularity order.** In testing its top results all sold 10,000 to 100,000+ units. It is not a strict count-descending sort.
- **`soldCount` is a minimum.** Tokopedia rounds the label ("10rb+" means at least 10,000), so two products can show the same number and still differ.
- **There is no review count.** Tokopedia's search results do not include one; `ratingAverage` is the only rating signal.
- **A run that finds nothing fails** instead of finishing empty, and says so in the status message. Check the keyword or category id.

### Use cases

- Find what sells best in a niche before you source or list a product.
- Compare prices for the same kind of product across shops.
- Track which shops hold the top positions for a keyword over time.
- Watch new listings in a category with the `latest` sort.

### Scope

The actor reads the same public search results any visitor sees. It uses no login and no account. Product data belongs to Tokopedia and the sellers; use it in line with Tokopedia's terms and applicable law.

# Actor input Schema

## `keyword` (type: `string`):

Optional keyword to find top products for a specific niche

## `categoryId` (type: `string`):

Optional category ID to filter top products

## `sortBy` (type: `string`):

How to rank products. most_sold is the Tokopedia popularity order; the soldCount field is a lower bound taken from its bucketed terjual label (for example 10rb+).

## `maxPages` (type: `integer`):

Maximum pages to scrape

## Actor input object example

```json
{
  "keyword": "sepatu lari",
  "categoryId": "",
  "sortBy": "most_sold",
  "maxPages": 1
}
```

# Actor output Schema

## `products` (type: `string`):

One row per product, ranked in Tokopedia's order for the chosen sort.

# API

You can run this Actor programmatically using our API. Below are code examples in JavaScript, Python, and CLI, as well as the OpenAPI specification and MCP server setup.

## JavaScript example

```javascript
import { ApifyClient } from 'apify-client';

// Initialize the ApifyClient with your Apify API token
// Replace the '<YOUR_API_TOKEN>' with your token
const client = new ApifyClient({
    token: '<YOUR_API_TOKEN>',
});

// Prepare Actor input
const input = {
    "keyword": "sepatu lari"
};

// Run the Actor and wait for it to finish
const run = await client.actor("xtracto/tokopedia-top-products").call(input);

// Fetch and print Actor results from the run's dataset (if any)
console.log('Results from dataset');
console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
const { items } = await client.dataset(run.defaultDatasetId).listItems();
items.forEach((item) => {
    console.dir(item);
});

// 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/js/docs

```

## Python example

```python
from apify_client import ApifyClient

# Initialize the ApifyClient with your Apify API token
# Replace '<YOUR_API_TOKEN>' with your token.
client = ApifyClient("<YOUR_API_TOKEN>")

# Prepare the Actor input
run_input = { "keyword": "sepatu lari" }

# Run the Actor and wait for it to finish
run = client.actor("xtracto/tokopedia-top-products").call(run_input=run_input)

# Fetch and print Actor results from the run's dataset (if there are any)
print(f"💾 Check your data here: https://console.apify.com/storage/datasets/{run.default_dataset_id}")
for item in client.dataset(run.default_dataset_id).iterate_items():
    print(item)

# 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/python/docs/quick-start

```

## CLI example

```bash
echo '{
  "keyword": "sepatu lari"
}' |
apify call xtracto/tokopedia-top-products --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,xtracto/tokopedia-top-products"
        }
    }
}
```

The hosted server signs you in with OAuth on first connect, so no API token belongs in this config. Clients without OAuth support can send an `Authorization: Bearer <APIFY_API_TOKEN>` header instead, using a token from API & Integrations in Apify Console (https://console.apify.com/settings/integrations).

## OpenAPI specification

Download the OpenAPI definition: https://api.apify.com/v2/actors/CNjiNrMt2XfARGZDd/builds/kr2xEFe2dYTHOQOVm/openapi.json
