社媒数据(beta)

GET /v1/social/{platform}/{capability} 返回抖音、小红书、TikTok、YouTube 等社交平台的公开数据,与模型调用共用同一个 API 密钥和余额。每个平台的每项能力按成功调用次数计价;data 是平台自己的原始响应——各平台的字段并未统一。

GET /v1/social/{platform}/{capability}
curl --get "https://api.chinaapi.ai/v1/social/bilibili/search" \
  -H "Authorization: Bearer $CHINAAPI_KEY" \
  --data-urlencode 'keyword=Python'

# HTTP 200
# {"object": "social.result", "platform": "tiktok", "capability": "search", "data": {...}}
Beta:仅限已付费账户 调用前请先完成首次充值。试用额度不能用于这些端点;从未充值的账户会收到 HTTP 403 model_requires_topup。Beta 不提供 SLA,平台、端点和价格都可能调整。

认证与计费

与任何模型调用一样,把 ChinaAPI 密钥作为 Bearer 令牌发送到 https://api.chinaapi.ai。只有返回 HTTP 200 且带数据时才计费,按该端点标示的价格扣一次;结果为空、参数被拒或上游失败都不收费。每取一页都是一次独立调用。使用日志里,每次调用都记在端点旁标示的名称下,例如 social-douyin-search。

响应与错误

成功的响应会用一层简单的外壳包住平台数据。data 里的一切——字段名、翻页游标、ID——都是平台自己的;游标请原样传回。

{
  "object": "social.result",
  "platform": "douyin",
  "capability": "search",
  "data": { "...": "the platform's own fields" }
}
  • 400 — 参数未知、重复、过长、类型不对或缺失,包括「至少填一项」的参数组一个都没给。错误的 code 会说明是哪一种,例如 unknown_parameter 或 missing_parameter。
  • 403 model_requires_topup — 该账户尚未完成首次充值。
  • 404 — 不存在这个平台与能力的组合,或平台按这些参数什么也没找到(social_data_no_result)。
  • 429 social_data_capacity_reached — Beta 当天的容量已用完,于 00:00 UTC 重置;或平台繁忙,几秒后重试即可。不要无间隔地循环重试。
  • 502 social_data_no_result — 数据源没有应答,或应答了但没有数据。
  • 503 social_data_unavailable — 该端点当前已暂停;实时目录中它的状态为 paused。

以上响应都不计费。

LinkedIn asynchronous tasks

The post-async, user-async and company-async capabilities use POST, query parameters and an empty body. Supply an Idempotency-Key (8–128 characters) unique to your intended operation. Reusing the same key and parameters returns the original submission without another charge; changing parameters under that key returns HTTP 409. A lost response is retried with the same key.

curl --get -X POST "https://api.chinaapi.ai/v1/social/linkedin/company-async" \
  -H "Authorization: Bearer $CHINAAPI_KEY" \
  -H "Idempotency-Key: company-research-20261029-001" \
  --data-urlencode 'url=https://www.linkedin.com/company/microsoft/'

# HTTP 202 returns a ChinaAPI task id and Location.
curl "https://api.chinaapi.ai/v1/social-tasks/TASK_ID" \
  -H "Authorization: Bearer $CHINAAPI_KEY"

Creation reserves the catalog price. A task with usable records keeps that charge; failure, empty results or timeout refund the reservation. Status and result reads are free, require the same account, and do not create another task. Poll no faster than every five seconds. Results are available for 30 days; do not submit another paid task just to read the same result. submission_pending means the submission outcome is uncertain: keep the same key and contact support if it persists.

These asynchronous capabilities are available through REST. The data MCP fetch tool lists synchronous capabilities only.

Xiaohongshu creator hot topics

GET /v1/social/xiaohongshu/creator-hot-topics returns the creator center’s hot inspiration feed. This is a separate capability, not a platform-wide trending ranking; the old trending endpoint remains unavailable. The live catalog lists its per-call price.

Leave cursor empty on the first request. Pass the response’s data.data.cursor unchanged to fetch the next page; items are in data.data.items. Stop when data.data.end_flag is true, a cursor repeats, or a page has no new items. Each successful nonempty page is billed separately. Empty results and business errors are not charged.

Telegram public channels

Telegram user returns a public channel profile, post returns one channel post, and user-posts returns channel posts. These endpoints do not retrieve personal account profiles or private chats. Pass channel=durov; a post also needs its post_id. Comments remain unavailable.

For user-posts, limit is 1–100 (upstream default 20). Fetch older posts with the preceding response's data.pagination.before_cursor as before; fetch newer posts with data.pagination.after_cursor as after. Choose one direction per request. Read posts from data.messages, deduplicate by post ID, and stop on an empty page, repeated cursor, no new IDs or your page/spending limit. has_more_before=false ends backward collection. Each nonempty successful page is billed separately; unavailable previews and empty results are not charged. Media links can expire.

Search implementation changes

TikTok search uses the App V3 implementation with keyword, offset, count, sort_type and publish_time. Start at offset 0; the former Web search_id is not supported. Returned data retains App V3 fields. Threads search returns top results and supports no pagination; results can vary by query and retrieval time. These path changes keep the previous per-call prices.

Pagination and bounded collection

Douyin comments and comment replies use the App V3 cursor contract. Start with cursor=0 and count=20; only count 20 is supported. Comment replies require both item_id (video ID) and comment_id (parent comment ID). Pass the returned cursor unchanged within the same capability. Old Web cursors cannot be reused.

Pages can overlap even when the cursor advances. Deduplicate by cid, stop when has_more is false, when a cursor repeats, or when no new IDs arrive; set a maximum page count and a spending limit. Each successful page is separately billed, including overlapping items. An empty page returns an uncharged no-result error and should end collection.

Threads comments and top search currently support the first page only. Sending a nonempty end_cursor is rejected before billing. Do not interpret a first-page response as a complete comment history. For every platform, use only the pagination parameters advertised in the live catalog.

使用规范

请遵守各平台的条款以及适用于你的数据保护规定。不得用本 API 建立个人画像。登录、提取联系方式、操纵互动数据、获取私密或付费内容均不在本 Beta 范围内。

平台与价格

单位为每次成功调用的美元价格。每个价格都链接到下方对应的端点,短横表示该平台不提供这项能力。当前在售哪些端点(包括已暂停的)以实时目录为准——GET https://dash.chinaapi.ai/api/social/catalog,无需密钥。

端点

参数放在查询字符串里,使用平台自己的参数名。示例取自目录;请把其中的标识符换成你要获取的内容。