# TikTok Search Scraper - \[Videos, Hashtags & Users] (`khadinakbar/tiktok-search-scraper`) Actor

Scrape TikTok keyword, top, hashtag, and user search results. Provider-backed, no cookies required, perfect for SEO and AI agents, MCP optimized.

- **URL**: https://apify.com/khadinakbar/tiktok-search-scraper.md
- **Developed by:** [Khadin Akbar](https://apify.com/khadinakbar) (community)
- **Categories:** Social media, Lead generation, Automation
- **Stats:** 10 total users, 0 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

Pay per event

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.

Learn more: https://docs.apify.com/platform/actors/running/actors-in-store#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 Search Scraper

Scrape TikTok search results by keyword, top search, hashtag, and creator profile query. This actor is provider-backed, no cookies required, perfect for SEO and AI agents, and MCP optimized for clean natural-language tool calls.

Use it for trend research, creator discovery, content monitoring, social listening, competitive analysis, and lead generation workflows where you need structured TikTok search data in a dataset.

### What It Extracts

Video and top-search rows include:

| Field | Description |
| --- | --- |
| `videoId`, `videoUrl` | TikTok video identifiers |
| `caption`, `hashtags`, `createdAt` | Video content metadata |
| `authorUsername`, `authorNickname`, `authorVerified` | Creator metadata |
| `playCount`, `likeCount`, `commentCount`, `shareCount`, `collectCount` | Engagement metrics |
| `musicId`, `musicTitle`, `musicAuthor` | Sound fields when returned |
| `contentType`, `imageUrls` | Top search can include photo carousel results |

User search rows include:

| Field | Description |
| --- | --- |
| `username`, `profileUrl`, `nickname` | TikTok profile identity |
| `bio`, `verified`, `avatarUrl` | Profile metadata |
| `followerCount`, `followingCount`, `heartCount`, `videoCount` | Public profile metrics |
| `privateAccount` | Private-account flag when returned |

### Inputs

- `searchQueries` plus `searchType` for keyword videos, top results, users, or all three.
- `keywordQueries` to always run keyword video search.
- `topQueries` to always run top mixed search.
- `hashtags` to search videos by hashtag.
- `userQueries` to search creator profiles.
- `providerOrder` to choose ScrapeCreators first, SociaVault first, or one provider only.
- `maxResultsPerQuery` and `maxPagesPerQuery` to control pagination and spend.
- `region`, `datePosted`, `publishTime`, and `sortBy` for provider-supported search filters.
- `includeRawData` to attach raw provider payloads to each row.

### Example Input

```json
{
  "searchQueries": ["nike running"],
  "searchType": "keyword",
  "hashtags": ["running"],
  "userQueries": ["nike"],
  "region": "US",
  "maxResultsPerQuery": 25,
  "maxPagesPerQuery": 3,
  "providerOrder": "scrapecreators-first",
  "includeRawData": false
}
```

### Example Output

```json
{
  "recordType": "video",
  "searchType": "keyword",
  "provider": "scrapecreators",
  "query": "nike running",
  "resultPosition": 1,
  "videoId": "7452069943757114646",
  "videoUrl": "https://www.tiktok.com/@creator/video/7452069943757114646",
  "caption": "Morning miles in the new shoes",
  "authorUsername": "creator",
  "playCount": 2932976,
  "likeCount": 197747,
  "commentCount": 347,
  "shareCount": 26467,
  "scrapedAt": "2026-06-11T00:00:00.000Z"
}
```

```json
{
  "recordType": "user",
  "searchType": "users",
  "provider": "scrapecreators",
  "query": "nike",
  "resultPosition": 1,
  "username": "nike",
  "profileUrl": "https://www.tiktok.com/@nike",
  "nickname": "Nike",
  "verified": true,
  "followerCount": 7000000,
  "videoCount": 1200,
  "scrapedAt": "2026-06-11T00:00:00.000Z"
}
```

### Run Summary

Every run writes `OUTPUT` and `RUN_SUMMARY` records to the default key-value store:

```json
{
  "recordsSaved": 25,
  "targetsProcessed": 1,
  "pagesFetched": 3,
  "providersUsed": ["scrapecreators"],
  "providerAttempts": {
    "scrapecreators.keyword": 3
  },
  "estimatedPpeCostUsd": 0.1001,
  "stopReason": "finished"
}
```

Common `stopReason` values:

- `finished` means selected searches were processed.
- `invalid-input` means no search query, hashtag, or user query was provided.
- `missing-api-key` means the actor owner needs to configure provider secrets.
- `provider-error` means providers returned errors or empty pages.
- `event-limit-reached` means a PPE charge limit stopped the run cleanly.

### Data Source

This actor uses public-data provider APIs:

- ScrapeCreators: TikTok keyword, top, hashtag, and user search endpoints.
- SociaVault: TikTok keyword, top, hashtag, and user search fallback endpoints.

It does not ask users for TikTok cookies and does not scrape private or logged-in TikTok surfaces.

# Actor input Schema

## `searchQueries` (type: `array`):

Keywords or phrases to search on TikTok. Used with Search Type.

## `searchType` (type: `string`):

Choose the TikTok search surface for Search Queries. All runs keyword, top, and user search for each query.

## `keywordQueries` (type: `array`):

Always run TikTok keyword video search for these queries, regardless of Search Type.

## `topQueries` (type: `array`):

Always run TikTok top search for these queries. Top search can include videos and photo carousels.

## `hashtags` (type: `array`):

Hashtags to search without or with #. Example: skincare or #skincare.

## `userQueries` (type: `array`):

Search TikTok creator profiles by keyword, brand name, or person name.

## `providerOrder` (type: `string`):

Choose which provider is tried first. ScrapeCreators is the recommended primary, SociaVault is the fallback.

## `maxResultsPerQuery` (type: `integer`):

Maximum normalized rows to save per query or hashtag.

## `maxPagesPerQuery` (type: `integer`):

Safety cap for provider pagination per search target.

## `region` (type: `string`):

Alpha-2 country code for TikTok search localization when supported by the provider.

## `datePosted` (type: `string`):

Time filter for keyword search.

## `publishTime` (type: `string`):

Time filter for top search. Defaults to Date Posted when omitted.

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

Sort order for keyword and top search where supported.

## `trim` (type: `boolean`):

Request trimmed provider responses when supported. Normalized dataset fields are unchanged.

## `includeRawData` (type: `boolean`):

Include raw provider payloads on each row for debugging and custom downstream parsing.

## Actor input object example

```json
{
  "searchQueries": [
    "nike running"
  ],
  "searchType": "keyword",
  "keywordQueries": [],
  "topQueries": [],
  "hashtags": [
    "skincare"
  ],
  "userQueries": [],
  "providerOrder": "scrapecreators-first",
  "maxResultsPerQuery": 25,
  "maxPagesPerQuery": 3,
  "region": "US",
  "datePosted": "all-time",
  "publishTime": "all-time",
  "sortBy": "relevance",
  "trim": true,
  "includeRawData": false
}
```

# Actor output Schema

## `results` (type: `string`):

Videos, top results, hashtag results, and user profiles.

## `runSummary` (type: `string`):

Detailed terminal status for automation, monitoring, and AI-agent workflows.

## `runOutput` (type: `string`):

Machine-readable terminal outcome, useful result count, failure details, and PPE charge counts.

# 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 = {
    "searchQueries": [
        "nike running"
    ],
    "keywordQueries": [],
    "topQueries": [],
    "hashtags": [
        "skincare"
    ],
    "userQueries": [],
    "maxResultsPerQuery": 25,
    "maxPagesPerQuery": 3,
    "region": "US"
};

// Run the Actor and wait for it to finish
const run = await client.actor("khadinakbar/tiktok-search-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 = {
    "searchQueries": ["nike running"],
    "keywordQueries": [],
    "topQueries": [],
    "hashtags": ["skincare"],
    "userQueries": [],
    "maxResultsPerQuery": 25,
    "maxPagesPerQuery": 3,
    "region": "US",
}

# Run the Actor and wait for it to finish
run = client.actor("khadinakbar/tiktok-search-scraper").call(run_input=run_input)

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

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

```

## CLI example

```bash
echo '{
  "searchQueries": [
    "nike running"
  ],
  "keywordQueries": [],
  "topQueries": [],
  "hashtags": [
    "skincare"
  ],
  "userQueries": [],
  "maxResultsPerQuery": 25,
  "maxPagesPerQuery": 3,
  "region": "US"
}' |
apify call khadinakbar/tiktok-search-scraper --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "command": "npx",
            "args": [
                "mcp-remote",
                "https://mcp.apify.com/?tools=khadinakbar/tiktok-search-scraper",
                "--header",
                "Authorization: Bearer <YOUR_API_TOKEN>"
            ]
        }
    }
}

```

## OpenAPI specification

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