Dữ liệu mạng xã hội (beta)

GET /v1/social/{platform}/{capability} trả về dữ liệu công khai từ Douyin, Xiaohongshu, TikTok, YouTube và các nền tảng mạng xã hội khác, dùng chung khóa API và số dư với các lệnh gọi mô hình. Mỗi nền tảng và mỗi chức năng được tính giá theo từng lệnh gọi thành công, và data là phản hồi gốc của nền tảng — các trường không được chuẩn hóa giữa các nền tảng.

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: chỉ dành cho tài khoản trả phí Hãy hoàn tất lần nạp tiền đầu tiên trước khi gọi. Tín dụng dùng thử không dùng được cho các endpoint này; tài khoản chưa từng nạp tiền sẽ nhận HTTP 403 model_requires_topup. Bản beta không có SLA, và các nền tảng, endpoint cũng như giá có thể thay đổi.

Xác thực và tính phí

Gửi khóa ChinaAPI của bạn dưới dạng bearer token tới https://api.chinaapi.ai, giống như mọi lệnh gọi mô hình. Một lệnh gọi chỉ bị tính phí một lần, theo giá niêm yết của endpoint, và chỉ khi trả về HTTP 200 kèm dữ liệu; kết quả rỗng, tham số bị từ chối hay lỗi phía thượng nguồn đều không mất phí. Mỗi trang bạn lấy là một lệnh gọi riêng. Nhật ký sử dụng ghi mỗi lệnh gọi dưới tên hiển thị cùng endpoint của nó, chẳng hạn social-douyin-search.

Phản hồi và lỗi

Phản hồi thành công bọc dữ liệu của nền tảng trong một lớp vỏ nhỏ. Mọi thứ bên trong data — tên trường, con trỏ phân trang, ID — đều là của nền tảng; hãy gửi lại con trỏ đúng như khi nhận được.

{
  "object": "social.result",
  "platform": "douyin",
  "capability": "search",
  "data": { "...": "the platform's own fields" }
}
  • 400 — một tham số không xác định, bị lặp, quá dài, sai kiểu hoặc bị thiếu, kể cả khi không có thành viên nào của nhóm "ít nhất một trong" được cung cấp. Trường code của lỗi cho biết là trường hợp nào, ví dụ unknown_parameter hoặc missing_parameter.
  • 403 model_requires_topup — tài khoản chưa hoàn tất lần nạp tiền đầu tiên.
  • 404 — cặp nền tảng và chức năng không tồn tại, hoặc nền tảng không tìm thấy gì với các tham số này (social_data_no_result).
  • 429 social_data_capacity_reached — dung lượng trong ngày của bản beta đã hết và sẽ đặt lại lúc 00:00 UTC, hoặc nền tảng đang bận và thử lại sau vài giây là được. Đừng thử lại liên tục trong một vòng lặp sát nhau.
  • 502 social_data_no_result — nguồn dữ liệu không phản hồi, hoặc phản hồi mà không có dữ liệu.
  • 503 social_data_unavailable — endpoint này hiện đang tạm dừng; danh mục trực tiếp ghi nó là paused.

Không phản hồi nào trong số này bị tính phí.

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.

Sử dụng hợp lệ

Tuân thủ điều khoản của từng nền tảng và các quy định bảo vệ dữ liệu áp dụng cho bạn. Không dùng API này để lập hồ sơ cá nhân. Đăng nhập, trích xuất thông tin liên hệ, thao túng lượt tương tác và truy cập nội dung riêng tư hoặc trả phí nằm ngoài phạm vi bản beta này.

Nền tảng và giá

USD cho mỗi lệnh gọi thành công. Mỗi mức giá liên kết tới endpoint của nó bên dưới, và dấu gạch ngang nghĩa là nền tảng không có chức năng đó. Danh mục trực tiếp — GET https://dash.chinaapi.ai/api/social/catalog, không cần khóa — là căn cứ về những gì đang bán lúc này, kể cả endpoint đang tạm dừng.

Endpoint

Tham số đặt trong query string theo đúng tên của nền tảng. Ví dụ lấy từ danh mục; hãy thay các định danh bằng nội dung bạn muốn lấy.