# 🛍️ TikTok Shop Data Scraper (`scraper-engine/tiktok-shop-data-scraper`) Actor

🛍️ TikTok Shop Data Scraper (tiktok-shop-data-scraper) extracts product listings, pricing, ratings, and seller details from TikTok Shop. 🚀 Perfect for market research, competitive analysis, and ecommerce insights. ⚡ Fast, reliable, and SEO-ready.

- **URL**: https://apify.com/scraper-engine/tiktok-shop-data-scraper.md
- **Developed by:** [Scraper Engine](https://apify.com/scraper-engine) (community)
- **Categories:** E-commerce, Developer tools, Automation
- **Stats:** 38 total users, 12 monthly users, 96.9% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $4.99 / 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.

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

## What's an Apify Actor?

Actors are web data automations that power AI and operations. They run on the Apify platform to scrape websites, process data, connect APIs, and automate workflows.
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.
Actors are written with capital "A".

## 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.
The best way to integrate Actors is as follows.

- **AI agents and MCP clients** — the [Apify MCP server](https://docs.apify.com/integrations/mcp.md) at `https://mcp.apify.com` (remote, streamable HTTP, OAuth on first use).
- **Agentic workflows and local Actor development** — [Agent Skills](https://apify.com/.well-known/agent-skills/index.json) with the [Apify CLI](https://docs.apify.com/cli/docs.md): `npm install -g apify-cli`, then `apify login`.
- **JavaScript/TypeScript projects** — the official [JS/TS client](https://docs.apify.com/api/client/js/docs.md): `npm install apify-client`.
- **Python projects** — the official [Python client](https://docs.apify.com/api/client/python/docs.md): `pip install apify-client`.
- **Any other language** — the [REST API](https://docs.apify.com/api/v2.md).

For usage examples, see the [API](#api) section below.

For more details, see Apify documentation as [Markdown index](https://docs.apify.com/llms.txt) and [Markdown full-text](https://docs.apify.com/llms-full.txt).

# README

### TikTok Shop Product Scraper — Prices, Ratings and Top Creators

TikTok Shop Product Scraper pulls structured product data straight from TikTok Shop by keyword, category link, seller store link, or direct product URL — price, rating, review count, seller info, sold count and the affiliate creators driving each product's video traffic, delivered as clean JSON with no HTML to parse. Every field is read directly from TikTok Shop's own page data, not scraped off rendered text. Start a run from the Actor page and results begin landing in your dataset within seconds.

***

### 🛍️ What is TikTok Shop Product Scraper?

TikTok Shop Product Scraper is an Apify Actor that collects product listings from TikTok Shop's US storefront and returns them as typed JSON records — price, rating, seller, sold count, affiliate-creator stats and (optionally) reviews. It runs entirely against TikTok Shop's public web surface: no TikTok account, login, or cookie session is used anywhere in the code. It's built for e-commerce sellers, dropshippers, affiliate marketers, and developers or AI agents that need TikTok Shop catalog data as structured input rather than raw HTML.

***

### 🔍 What TikTok Shop product data is publicly available to scrape?

Anyone visiting shop.tiktok.com from a US IP can see a product's title, price, rating, seller and sold count without logging in or buying anything — that's exactly what this Actor collects.

| Data category | Publicly available | Gated behind |
| --- | --- | --- |
| Title, price, images, discount | ✅ Yes | — |
| Rating and review count | ✅ Yes | — |
| Sold count | ✅ Yes | — |
| Seller ID and shop name | ✅ Yes | — |
| Affiliate creator / video stats | ✅ Yes (via the product's public "related videos" feed) | — |
| Individual review text and reviewer name | ⚠️ Partial | TikTok Shop only exposes a public review feed for some products; others expose none |
| Exact per-SKU stock count | ❌ No | Only an in-stock/out-of-stock signal can be inferred, not the exact unit count |
| Buyer messaging, order history, checkout | ❌ No | Requires a TikTok account and an actual purchase |

TikTok Shop Product Scraper only returns publicly visible data — what any visitor sees without logging in. Nothing behind a buyer account or seller dashboard.

***

### 📦 What data can I extract with TikTok Shop Product Scraper?

Each run returns one JSON record per product, covering identity fields, pricing and rating metrics, and nested creator/review data.

#### Identity and listing fields

| Field | Description |
| --- | --- |
| `product_id` | TikTok Shop's numeric product ID |
| `title` | Product title |
| `url` | Canonical product page URL (`https://shop.tiktok.com/us/pdp/{product_id}`) |
| `image_url` | First product image URL |
| `seller_id` | Seller/shop numeric ID |
| `seller_name` | Seller/shop display name |
| `source` | `"product_page"` for a full detail-page fetch, `"listing_card"` for the degraded fallback (see Output below) |
| `scraped_at` | ISO-8601 timestamp of when the record was collected |

#### Price, rating and stock fields

| Field | Description |
| --- | --- |
| `price` | Current sale price as a number |
| `price_formatted` | Sale price as TikTok Shop formats it for display |
| `currency` | Currency name (`USD` when not otherwise specified) |
| `original_price` | Pre-discount price — only present when the product is discounted |
| `discount` | Discount label (e.g. `"17%"`) — only present when the product is discounted |
| `rating` | Overall product rating |
| `review_count` | Total review count reported by TikTok Shop |
| `sold_count` | Units sold, as reported by TikTok Shop |
| `is_sold_out` | `true`/`false` derived from real per-SKU stock data, or `null` when TikTok Shop exposes no stock signal at all — never guessed |

#### Affiliate creator and review data

| Field | Description |
| --- | --- |
| `creator_count` | Number of distinct creators found promoting the product in its related-video feed |
| `has_creator_data` | `true` when `creator_count > 0` |
| `total_creator_videos` | Total related videos aggregated across all creators |
| `top_creators` | Array of the top 5 creators by video count (ties by total likes) — only present when `creator_count > 0`; each entry has `nickname`, `video_count`, `total_plays`, `total_likes`, `is_affiliate` |
| `reviews_fetched` | Number of reviews actually returned for this product (0 if `includeReviews` is off or none were accessible) |
| `reviews_accessible` | `true` if TikTok Shop exposed any reviews for this product at all |
| `reviews` | Array of review objects — only present when reviews were fetched; each has `review_id`, `rating`, `text`, `reviewer_name`, `review_time` (Unix seconds), `is_verified_purchase`, `sku_specification`, `country`, `images` |

#### 🤖 Add-on: need additional TikTok data?

If you also need creator profiles, video metadata, hashtag or comment data outside of TikTok Shop, pair this Actor with **TikTok Data Scraper** for general TikTok profile/video/comment extraction, or **TikTok Trending Creator Insights Scraper** if you specifically want the platform's trending-creator board rather than a product's own affiliate creators.

***

### 🛠️ Why not build this yourself?

TikTok Shop has no public catalog-search API for pulling arbitrary sellers' product listings — its Partner/Seller Center API is scoped to an authorized seller managing their own shop, not to reading a competitor's or category's product data. Building this from scratch means reverse-engineering an undocumented internal JSON API (`product_list`, `page_data`, and the `__MODERN_ROUTER_DATA__` blob embedded in the product page HTML), handling a region lock that only serves real data to US exit IPs, and maintaining a proxy escalation strategy as TikTok Shop's anti-bot posture changes. This Actor already does that: it resolves the page-data structure defensively (by shape, not a hardcoded key) so a route rename doesn't silently break extraction, and it ships a proxy ladder (direct → Datacenter → Residential) with retries built in.

***

### ▶️ How to use TikTok Shop Product Scraper

1. Open **TikTok Shop Product Scraper** on the Apify Store and click **Try for free** (or open it directly in the Apify Console).
2. Add one or more search keywords (e.g. `shoes`), and/or paste TikTok Shop URLs — product, category, or seller-store links are all auto-detected.
3. Set `maxProducts`, optionally turn on `includeReviews`, and pick a `sortBySoldCount` mode if you want a best-sellers-first order.
4. Click **Start**. Products are pushed to the dataset live as each one finishes — you don't wait for the whole run to see the first results.
5. Open the **Output** tab and export as JSON, CSV, or Excel, or pull results via the API.

#### Scaling to bulk product extraction

There's no separate "bulk mode" — `searchKeywords` and `urls` are both arrays, so a single run can combine multiple keywords, category links, seller-store links, and direct product links at once. Every keyword and URL runs as its own discovery pass, and duplicate product IDs found across sources are removed automatically within the run. `maxProducts` (10–100,000) caps how many products each individual keyword, category, or seller store contributes, not the run as a whole — three keywords each capped at 1,000 can return up to 3,000 unique products in one run.

***

### 💡 What can you do with TikTok Shop product data?

- 🛒 **Dropshippers and sellers** sourcing products use `price`, `sold_count`, and `is_sold_out` to spot fast-moving, still-in-stock items before listing them elsewhere.
- 📈 **Market researchers** tracking category trends use `sold_count` and `rating` across a `sortBySoldCount: "highest_first"` run to find category best-sellers without manual browsing.
- 🤝 **Affiliate and brand marketers** use `top_creators` (`video_count`, `total_plays`, `total_likes`, `is_affiliate`) to identify which creators are already driving sales for a product and worth approaching for a partnership.
- ⭐ **Customer-experience teams** monitoring a seller's own catalog use `reviews`, `rating`, and `review_count` to flag products with a slipping rating before it shows up in support tickets.
- 🤖 **AI agents and RAG pipelines** pass the typed JSON output directly into a vector store or agent tool — `title`, `price_formatted`, and `reviews[].text` give an LLM ready-to-use product and sentiment context without any HTML parsing step.

***

### 🚦 How does TikTok Shop Product Scraper handle rate limits and blocking?

Every request goes through a proxy escalation ladder: it tries a **direct connection** first, escalates to a **Datacenter (US)** proxy if that gets blocked or degraded, and finally to a **sticky Residential (US)** session — once it reaches Residential it stays there for the rest of the run instead of bouncing back down. Each request is retried up to `maxRetries` times (1–10, default 5) with an increasing backoff, and a response is treated as a failure (triggering escalation) whenever it returns HTTP 403/429/5xx or looks like a soft block — e.g. a page missing its expected data marker. `maxConcurrency` (1–20, default 20) caps how many requests run in parallel, and `requestDelay` (0–2,000 ms) adds a pause between them if you want to go gentler than the default.

⚠️ TikTok Shop only serves real product data to US exit IPs, and its product-*detail* route can occasionally stay blocked for a specific product even through a Residential proxy. When that happens and the product was originally found via a keyword, category, or store search, the Actor falls back to the real (if less complete) data already captured during discovery rather than dropping the row — see `source: "listing_card"` in Output below. A bare product URL with no prior listing data is skipped and logged, not silently omitted.

***

### ⬇️ Input

No parameter is required — the Actor simply does nothing (with a logged warning) if both `searchKeywords` and `urls` are empty.

| Parameter | Required | Type | Description | Example value |
| --- | --- | --- | --- | --- |
| `searchKeywords` | No | array | Keywords to search TikTok Shop for (e.g. 'shoes', 'phone case', 'skincare'). Each keyword runs its own search. | `["shoes", "phone case"]` |
| `urls` | No | array | Paste TikTok Shop URLs to scrape — the type is auto-detected: Product (`/pdp/`), Category (`/c/`), or Seller/Store (`/store/`). | `["https://shop.tiktok.com/us/pdp/1732119583850205647"]` |
| `maxProducts` | No | integer | Maximum number of products to fetch per search keyword / category / seller (10–100000). | `50` |
| `includeReviews` | No | boolean | Fetch product reviews too. Note: not every product exposes accessible reviews. | `true` |
| `maxReviews` | No | integer | Maximum number of reviews to fetch per product (1–100). | `10` |
| `sortBySoldCount` | No | string, enum: `none`, `highest_first`, `lowest_first` | Order products by units sold. 'Highest first' surfaces best-sellers; 'Lowest first' surfaces fewer-sold items. | `"highest_first"` |
| `maxRetries` | No | integer | Maximum retry attempts per request before giving up (1–10). | `5` |
| `requestDelay` | No | integer | Delay between requests in milliseconds. Lower = faster, but may trigger rate limits (0–2000). | `0` |
| `maxConcurrency` | No | integer | Maximum concurrent requests. Higher = faster but uses more resources (1–20). | `20` |
| `timeout` | No | integer | Per-request timeout in seconds. Increase if using slow proxies (10–300). | `60` |
| `proxyConfiguration` | No | object | By default the scraper connects directly (no proxy) and automatically escalates to a Datacenter proxy and then a Residential (US) proxy for maximum reliability. For the most reliable results, select Residential proxies in the US. | `{"useApifyProxy": true, "apifyProxyGroups": ["RESIDENTIAL"]}` |

#### Example input

```json
{
  "searchKeywords": ["shoes"],
  "urls": ["https://shop.tiktok.com/us/store/seller/7123456789012345678"],
  "maxProducts": 50,
  "includeReviews": true,
  "maxReviews": 10,
  "sortBySoldCount": "highest_first",
  "maxRetries": 5,
  "requestDelay": 0,
  "maxConcurrency": 20,
  "timeout": 60,
  "proxyConfiguration": { "useApifyProxy": true, "apifyProxyGroups": ["RESIDENTIAL"] }
}
```

***

### ⬆️ Output

Results are typed, normalized JSON with a consistent field set across runs, viewable in three dataset views (Products, Top Creators, Reviews) and exportable as JSON, CSV, Excel, or XML from the Apify Console or API.

#### Example output

```json
{
  "product_id": "1732119583850205647",
  "title": "Women's Low-Top Sports Shoes - Breathable Mesh",
  "url": "https://shop.tiktok.com/us/pdp/1732119583850205647",
  "price": 36.27,
  "price_formatted": "$36.27",
  "currency": "USD",
  "original_price": 43.69,
  "discount": "17%",
  "rating": 4.7,
  "review_count": 207,
  "seller_id": "8652615273335460303",
  "seller_name": "Juyu Footwear",
  "image_url": "https://p16-oec-va.ibyteimg.com/tos-maliva-i-o3syd03w52-us/example~tplv-o3syd03w52-origin-webp.webp",
  "sold_count": 2743,
  "is_sold_out": false,
  "creator_count": 16,
  "has_creator_data": true,
  "total_creator_videos": 20,
  "top_creators": [
    {
      "nickname": "Vincent",
      "video_count": 2,
      "total_plays": 336691,
      "total_likes": 1275,
      "is_affiliate": true
    }
  ],
  "reviews_fetched": 3,
  "reviews_accessible": true,
  "reviews": [
    {
      "review_id": "7345612398765432101",
      "rating": 5,
      "text": "Great fit, true to size, arrived fast.",
      "reviewer_name": "A**a S**t",
      "review_time": 1780350129,
      "is_verified_purchase": true,
      "sku_specification": "Black, EU41",
      "country": "US",
      "images": []
    }
  ],
  "scraped_at": "2026-06-17T16:44:25.875921",
  "source": "product_page"
}
```

`source: "listing_card"` records carry only `product_id`, `title`, `url`, `price`, `price_formatted`, `currency`, `rating`, `review_count`, `seller_id`, `seller_name`, `image_url`, `sold_count`, `scraped_at` and `source`, with `is_sold_out` set to `null` and the creator/review fields zeroed out — this happens only when the product-detail page couldn't be reached but the product was already seen in a keyword/category/store listing.

***

### ⚙️ How does it work?

The Actor makes direct HTTP requests to TikTok Shop's own web endpoints using a Chrome-impersonating HTTP client (`curl_cffi`) — it does not run a headless browser. Product discovery calls the same internal `product_list` JSON endpoint the TikTok Shop web app uses for search, category, and store pages; product detail comes from the JSON blob TikTok Shop embeds in the server-rendered product page HTML, plus a follow-up call to the same `page_data` endpoint the web app uses to lazy-load the related-videos feed for creator stats. Every request routes through the proxy ladder described above, and only data visible on the public product/category/store page is ever collected — no login, cookies, or purchase step is involved. The output field set stays the same regardless of TikTok Shop's page layout, because the parser locates data by its structure inside the page config rather than by a fixed HTML selector.

***

### 🔌 Integrations

TikTok Shop Product Scraper runs on Apify, so it works with anything that can call the Apify API or an Apify Actor.

#### Calling TikTok Shop Product Scraper programmatically

```python
from apify_client import ApifyClient

client = ApifyClient("<APIFY_API_TOKEN>")
run = client.actor("tiktok-shop-data-scraper").call(run_input={
    "searchKeywords": ["shoes"],
    "maxProducts": 50,
    "includeReviews": True,
})

for item in client.dataset(run["defaultDatasetId"]).iterate_items():
    print(item["title"], item["price_formatted"])
```

Works in Go, Ruby, Node.js, cURL — any language that can make an HTTP request to the Apify API.

#### No-code tools (n8n, Make, LangChain)

In **n8n**, use the Apify node (or an HTTP Request node against the Actor's run-sync-get-dataset-items endpoint) to trigger a run and pull results into your workflow. In **Make**, the Apify app's "Run an Actor" module does the same. For **LangChain** or other agent frameworks, wrap the Apify API call in a custom tool so an agent can request TikTok Shop product data on demand.

***

### ⚖️ Is it legal to scrape TikTok Shop products?

Scraping publicly visible product listings — the same title, price, rating, and seller info any shopper sees without logging in — is generally lawful in most jurisdictions. TikTok Shop Product Scraper only returns data that's publicly visible on the product, category, or seller-store page. This is business/product data (prices, listings, seller and sales figures), not personal data, so GDPR and CCPA don't apply to the core product record — TikTok Shop's Terms of Service and database/content-rights considerations are the relevant framework instead. The one exception: with `includeReviews` enabled, review records include a `reviewer_name` already shown publicly by TikTok Shop (often partially masked by TikTok itself) — treat that field with care if you store it in bulk. Consult legal counsel if your use case involves bulk storage of personal data or commercial redistribution of scraped content.

***

### ❓ Frequently asked questions

#### What TikTok Shop product fields does TikTok Shop Product Scraper return?

The core fields are `title`, `price`, `rating`, `sold_count`, and `seller_name`, plus nested creator (`top_creators`) and review (`reviews`) data when requested. See [What data can I extract](#-what-data-can-i-extract-with-tiktok-shop-product-scraper) for the full field list.

#### Does TikTok Shop Product Scraper require a TikTok account or login?

No. The Actor makes unauthenticated HTTP requests to TikTok Shop's public web endpoints — no TikTok account, login, or cookie session is used anywhere in its code.

#### How many products can I extract in one run?

`maxProducts` accepts 10 to 100,000 per search keyword, category, or seller store — and it's a per-source cap, not a run-wide one, so combining several keywords or URLs in one run multiplies the total.

#### What happens if a product is delisted or the detail page is temporarily blocked?

If a product came from a keyword/category/store search and its detail page can't be reached, the Actor falls back to the real title/price/rating/sold-count/seller/image data already captured during discovery (`source: "listing_card"`) instead of dropping the row. ⚠️ SKU-level stock, creator stats, and reviews aren't available from a listing card, so those fields come back empty/`null` on that row. A bare product URL with no prior listing data and an unreachable detail page is skipped and logged, not returned as a blank row.

#### Can I scrape multiple TikTok Shop products at once?

Yes. Both `searchKeywords` and `urls` accept arrays, so one run can mix multiple keywords with multiple product, category, and seller-store URLs — all discovered products are deduplicated by `product_id` within the run.

#### Does TikTok Shop Product Scraper work with Claude, ChatGPT, and other AI agent tools?

It has no dedicated MCP server, but it's callable as a standard HTTP endpoint through the Apify API by any agent framework that can make an HTTP request — including custom tools in Claude or ChatGPT-based agents.

#### What makes this different from a generic TikTok Shop crawler?

Three things grounded in how it's built: it aggregates affiliate-creator video stats (`top_creators`) per product rather than just listing basic fields; it never drops a product to a blocked detail page — it degrades to real listing data instead (`source: "listing_card"`) and tells you which rows are which; and its parser locates page data by structure rather than a hardcoded key, so a TikTok Shop layout change is less likely to silently break the output schema.

#### Does TikTok Shop Product Scraper return data in a format LLMs can use directly?

Yes. Output is typed, normalized JSON with consistent field names across runs — no HTML parsing or CSS selectors needed. Pass it directly to an LLM, index it into a vector store, or feed it to an agent tool.

#### What happens when TikTok Shop changes its layout or anti-bot system?

The Actor is maintained, and its parser is written to resolve page data by structure (looking for the object that holds a `page_config`) rather than a fixed key or selector, so it tolerates some layout change without breaking. No specific fix turnaround time is promised.

#### Can I use it without managing proxies or browser infrastructure?

Yes. The Actor handles proxy selection and escalation itself (direct → Datacenter → Residential via Apify Proxy) and makes plain HTTP requests with a Chrome-impersonating client — there's no headless browser to configure or maintain on your end.

#### Which fields work best for AI training data and RAG indexing?

For RAG, index `title`, `price_formatted`, and `reviews[].text` as the high-information text fields. For structured training data, `price`, `rating`, `sold_count`, and `review_count` return as consistent typed primitives (numbers/booleans) across every record.

***

### 🔗 Related scrapers

| Scraper | What it extracts |
| --- | --- |
| [TikTok Data Scraper](https://apify.com/store) | General TikTok profiles, videos, followers, comments & replies, hashtags, music, and playlists |
| [TikTok Trending Creator Insights Scraper](https://apify.com/store) | The TikTok trending-creator board for a chosen country — handle, follower count, lifetime likes, latest videos |

***

### 💬 Your feedback

Found a bug or missing a field? Open an issue on this Actor's Issues tab in the Apify Console — reports get triaged and the output schema is kept stable across fixes.

# Actor input Schema

## `searchKeywords` (type: `array`):

Keywords to search TikTok Shop for (e.g. 'shoes', 'phone case', 'skincare'). Each keyword runs its own search.

## `urls` (type: `array`):

Paste TikTok Shop URLs to scrape — the type is auto-detected: 🛒 Product (/pdp/), 🗂️ Category (/c/), or 🏪 Seller/Store (/store/). Examples: https://shop.tiktok.com/us/pdp/123, https://shop.tiktok.com/us/c/electronics/456, https://shop.tiktok.com/us/store/seller/789

## `maxProducts` (type: `integer`):

Maximum number of products to fetch per search keyword / category / seller (10–100000).

## `includeReviews` (type: `boolean`):

Fetch product reviews too. Note: not every product exposes accessible reviews.

## `maxReviews` (type: `integer`):

Maximum number of reviews to fetch per product (1–100).

## `sortBySoldCount` (type: `string`):

Order products by units sold. '🔥 Highest first' surfaces best-sellers; '🌱 Lowest first' surfaces fewer-sold items.

## `maxRetries` (type: `integer`):

Maximum retry attempts per request before giving up (1–10).

## `requestDelay` (type: `integer`):

Delay between requests in milliseconds. Lower = faster, but may trigger rate limits (0–2000).

## `maxConcurrency` (type: `integer`):

Maximum concurrent requests. Higher = faster but uses more resources (1–20).

## `timeout` (type: `integer`):

Per-request timeout in seconds. Increase if using slow proxies (10–300).

## `proxyConfiguration` (type: `object`):

By default the scraper connects directly (no proxy) and automatically escalates to a 🛡️ Datacenter proxy and then a 🏠 Residential (US) proxy for maximum reliability. For the most reliable results, select Residential proxies in the US.

## Actor input object example

```json
{
  "searchKeywords": [
    "shoes"
  ],
  "maxProducts": 10,
  "includeReviews": false,
  "maxReviews": 10,
  "sortBySoldCount": "none",
  "maxRetries": 5,
  "requestDelay": 0,
  "maxConcurrency": 20,
  "timeout": 60,
  "proxyConfiguration": {
    "useApifyProxy": false
  }
}
```

# Actor output Schema

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

Core product data (price, rating, seller, sold count) for every scraped item in the Actor's default dataset.

## `topCreators` (type: `string`):

Per-product aggregated affiliate-video creator stats from the default dataset.

## `reviews` (type: `string`):

Per-product review data from the default dataset (only populated when 'Include Reviews' is enabled).

## `sortedBySoldCount` (type: `string`):

When the 'Sort by Sold Count' input option is used, a snapshot of product IDs in that sorted order is saved to the key-value store under 'sorted\_by\_sold\_count'.

# 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 = {
    "searchKeywords": [
        "shoes"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("scraper-engine/tiktok-shop-data-scraper").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 = { "searchKeywords": ["shoes"] }

# Run the Actor and wait for it to finish
run = client.actor("scraper-engine/tiktok-shop-data-scraper").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 '{
  "searchKeywords": [
    "shoes"
  ]
}' |
apify call scraper-engine/tiktok-shop-data-scraper --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,scraper-engine/tiktok-shop-data-scraper"
        }
    }
}

```

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/VCyX4FEz1mkT7UsQF/builds/0I77M0QvF7bKI3qBm/openapi.json
