Данные соцсетей (бета)

GET /v1/social/{platform}/{capability} возвращает публичные данные Douyin, Xiaohongshu, 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": {...}}
Бета: только для платных аккаунтов Перед вызовом впервые пополните баланс. Пробный кредит на эти эндпоинты не тратится; аккаунт, который ни разу не пополнялся, получает HTTP 403 model_requires_topup. У беты нет SLA, а её платформы, эндпоинты и цены могут меняться.

Аутентификация и оплата

Передавайте ключ ChinaAPI как bearer-токен на https://api.chinaapi.ai, как при любом вызове модели. Вызов оплачивается один раз, по цене, указанной для его эндпоинта, и только если он вернул HTTP 200 с данными; пустой результат, отклонённый параметр или сбой на стороне источника ничего не стоят. Каждая полученная страница — отдельный вызов. В журнале использования каждый вызов записан под именем, указанным у его эндпоинта, например social-douyin-search.

Ответы и ошибки

Успешный ответ оборачивает данные платформы в небольшой конверт. Всё внутри data — имена полей, курсоры пагинации, идентификаторы — принадлежит самой платформе; передавайте курсоры обратно ровно в том виде, в каком их получили.

{
  "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 — дневной лимит беты исчерпан и сбросится в 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 для составления профилей людей. Вход в аккаунты, извлечение контактных данных, накрутка вовлечённости и доступ к закрытому или платному контенту в эту бету не входят.

Платформы и цены

USD за один успешный вызов. Каждая цена ведёт к своему эндпоинту ниже, а прочерк означает, что платформа не предлагает эту возможность. Что продаётся прямо сейчас, включая приостановленные эндпоинты, определяет живой каталог — GET https://dash.chinaapi.ai/api/social/catalog, ключ не нужен.

Эндпоинты

Параметры передаются в строке запроса под собственными именами платформы. Примеры взяты из каталога; замените идентификаторы на те, что относятся к нужному вам контенту.