# TikTok Data API | search comments creator videos (`socialdatax/socialdatax-tiktok-data-api`) Actor

SocialDataX read-only TikTok data API for post search, details, comments, comment replies, creator profiles, and creator videos. Results export to Apify Dataset, CSV, Excel, JSON, or API workflows.

- **URL**: https://apify.com/socialdatax/socialdatax-tiktok-data-api.md
- **Developed by:** [SocialDataX](https://apify.com/socialdatax) (community)
- **Categories:** Social media, Videos, Developer tools
- **Stats:** 2 total users, 1 monthly users, 0.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $2.00 / 1,000 dataset items

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 数据 API | SocialDataX

SocialDataX read-only TikTok data API for post search, details, comments, comment replies, creator profiles, and creator videos.

Apify users do not need to configure a SocialDataX API Key. The Actor owner configures `SOCIALDATAX_API_KEY` as an Apify secret.

### Operations

- `search_posts`: Search Posts using `keyword`.
- `get_post_detail`: Get Post Detail using `url`.
- `get_post_comments`: Get Post Comments using `post_id` or `url`.
- `get_post_comment_replies`: Get Post Comment Replies using `post_id` / `comment_id`.
- `get_user_info`: Get User Info using `tiktok_id` or `profile_url`.
- `list_user_posts`: List User Posts using `tiktok_id` or `profile_url`.

### Pagination

List operations use `page_token`, `max_items`, and `auto_paginate`. Each requested page counts as one SocialDataX API request. Results are written to the default Apify Dataset and can be exported as JSON, CSV, Excel / XLSX, or JSONL.

### Example input

```json
{
  "operation": "search_posts",
  "keyword": "AI",
  "page_token": "",
  "content_type": "all",
  "max_items": 50,
  "auto_paginate": true
}
```

### Billing

Ongoing use requires an Apify paid plan. Free-plan users get a limited SocialDataX API request trial.

Recommended Apify Pay per event setup:

- `apify-default-dataset-item`: `$0.002 / Dataset item`
- `apify-actor-start`: keep Apify default `$0.00005`
- `Pay per event + usage`: off

# Actor input Schema

## `operation` (type: `string`):

Choose the TikTok data API operation to run.

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

Search keyword.

## `page_token` (type: `string`):

Opaque pagination token returned by the previous page. Leave empty for the first page.

## `content_type` (type: `string`):

Content type filter.

## `url` (type: `string`):

TikTok post URL.

## `post_id` (type: `string`):

Post ID copied from a Dataset row.

## `comment_id` (type: `string`):

Top-level comment ID.

## `tiktok_id` (type: `string`):

TikTok ID.

## `profile_url` (type: `string`):

User profile URL.

## `max_items` (type: `integer`):

Maximum number of Dataset rows for list operations. Larger values may make multiple SocialDataX API requests.

## `auto_paginate` (type: `boolean`):

When enabled, the Actor keeps requesting next pages until max\_items is reached or no next page exists.

## Actor input object example

```json
{
  "operation": "search_posts",
  "keyword": "AI",
  "content_type": "all",
  "url": "",
  "tiktok_id": "",
  "profile_url": "",
  "max_items": 50,
  "auto_paginate": true
}
```

# Actor output Schema

## `dataset` (type: `string`):

Open flat result rows written to the default Apify Dataset. Export as JSON, CSV, Excel / XLSX, or JSONL.

## `keyValueStore` (type: `string`):

Open the default key-value store. The OUTPUT record contains operation, item count, request count, page-level response summaries, non-fatal warnings, and lightweight failure details when a run fails.

# 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 = {};

// Run the Actor and wait for it to finish
const run = await client.actor("socialdatax/socialdatax-tiktok-data-api").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 = {}

# Run the Actor and wait for it to finish
run = client.actor("socialdatax/socialdatax-tiktok-data-api").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 '{}' |
apify call socialdatax/socialdatax-tiktok-data-api --silent --output-dataset

```

## MCP server setup

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

```

## OpenAPI specification

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