# 今日头条 用户内容 API (toutiao.user_posts)

- Canonical page: [https://everyinfra.com/toutiao-api/user_posts](https://everyinfra.com/toutiao-api/user_posts?utm_medium=ai_doc&utm_campaign=page_md)
- Endpoint: POST https://api.everyinfra.com/api/v1/social with {"platform": "toutiao", "action": "user_posts", "params": {...}}
- Price: $0.000556 per call ($0.56 per 1,000 requests); failed calls and empty results are not charged
- Returns: list, default 20, max 100 per call
- Mode: sync; add "mode": "async" for slow tasks

今日头条用户内容按 `user_id` 列出一个账号主页上的帖子，每条带类型、标题、正文和封面，阅读、播放、点赞、评论、分享五个数，作者认证情况、地区和发布时间也在同一行。它回答「这个头条号平时发什么、哪一类内容数据更好」，适合评估内容号、监测竞品账号和做内容盘点。

`tab` 默认读全部栏目，它只决定读主页的哪一栏，不控制文章详情的类型。`user_id` 只收主页 token 或完整主页链接，不收昵称，示例里那串 MS4w 开头的值可以直接拿来试。

## Health

- Live health (24h percent, hourly and daily trends): https://api.everyinfra.com/api/v1/social/availability?platform=toutiao&action=user_posts

## Parameters

| name | type | required | default | description |
|---|---|---|---|---|
| user_id | not declared | yes | not declared | 用户主页的 token/secUid，通常以 MS4w 开头，也可在 user_id 中传完整头条主页 URL；不是昵称或普通短数字 UID。 |
| tab | not declared | no | not declared | user_posts 的主页栏目：all 全部（默认）、article 文章、video 视频、ugc 用户动态、short_video 短视频。它不控制文章详情类型。 |
| limit | integer (1–100) | no | 20 | 这次调用最多返回的条数，整数，1–100；不传按默认值，实际返回可能少于这个数。超过上限会在扣费前返回 422。 |

## Response fields (items in `results`)

| field | meaning |
|---|---|
| id | 该记录在原平台上的唯一标识。仅在同一平台内唯一，跨平台可能重复。 |
| url | 该记录在原平台上的可访问链接。 |
| type | 记录类型，取值随能力而定（如 video / image / text）。 |
| title | 标题。平台无标题概念时（如纯文本帖）为 null。 |
| text | 正文内容，已去除 HTML 标签，全文返回、不截断（个别平台的列表结果本身只有摘要，以该平台的字段说明为准）。 |
| content_text | 正文文本。 |
| cover | 封面图。 |
| read_count | 阅读量。 |
| play_count | 播放量。 |
| like_count | 点赞数。null 表示该平台或该接口不公开此数据，不等于 0。 |
| comment_count | 评论数。null 表示不公开，不等于 0。 |
| share_count | 分享/转发数。null 表示不公开，不等于 0。 |
| source | 来源。 |
| author_name | 作者昵称（显示名）。 |
| author_id | 作者在原平台的唯一 ID。 |
| author_verified | 作者是否认证（comments 上是评论者）。 |
| author_auth_info | 认证信息（如「XX领域创作者」；comments 上是评论者的，如「…官方账号」）；没认证时没有，多数评论者没有。 |
| region | 地区。 |
| posted_at | 发布时间，ISO 8601 格式、UTC 时区（如 2026-08-07T12:34:56+00:00）。平台只给非标准字符串时原样透传，解析前建议做容错。null 表示平台未公开。 |
| platform | 数据来源平台标识，与请求里的 platform 一致（如 xiaohongshu、tiktok）。 |
| duration_sec | platform-native meaning |
| duration_seconds | 时长，单位秒。非视频/音频内容为 null。 |
| image_urls | 图片链接数组，按平台展示顺序；没有图片时不出现这个字段。 |

## Example

```bash
curl -X POST 'https://api.everyinfra.com/api/v1/social' \
  -H "Authorization: Bearer $EVERYINFRA_API_KEY" \
  -H 'Content-Type: application/json' \
  --data-raw '{
  "platform": "toutiao",
  "action": "user_posts",
  "params": {
    "user_id": "MS4wLjABAAAA3KU9ifwN12G41E6PJRpZgIfzVrXWQ4WPF66ns54c0uw"
  }
}'
```

```python
import os
import requests

response = requests.post(
    "https://api.everyinfra.com/api/v1/social",
    headers={"Authorization": f"Bearer {os.environ['EVERYINFRA_API_KEY']}"},
    json={
        "platform": "toutiao",
        "action": "user_posts",
        "params": {
            "user_id": "MS4wLjABAAAA3KU9ifwN12G41E6PJRpZgIfzVrXWQ4WPF66ns54c0uw",
        },
    },
    timeout=120,
)
print(response.status_code)
print(response.json())
```

## Response example

Real response to the example request above, captured 2026-09-26T08:56:04Z. `results` and `count` are real with personal information (names, handles, avatars, profile links, contact details) removed; the list keeps the first 2 of 20. `id`, `billing` and `quota` differ on every call, so only their shape is shown.

```text
{
  "id": "req_…",
  "platform": "toutiao",
  "action": "user_posts",
  "results": [
    {
      "id": "•••",
      "url": "https://www.toutiao.com/article/7689787715704914442",
      "type": "article",
      "title": "2026中国国际孔子文化节｜典籍藏风骨，文脉铸脊梁",
      "text": "孔子博物馆作为山东一张重要的文化名片，承载的不只是典籍，更是融入国人血脉的精神底色。让我们与中国政法大学思政研究所教师郭继承老师一起探讨中国人延续千年的精神内核“仁义礼智信”与“家国天下”，品读千年经典，传承中华文脉。",
      "cover": "https://p3-sign.toutiaoimg.com/tos-cn-i-tjoges91tu/52435ed17c152886afe1f7a3a38289bd~720x380_cs.webp?_iz=31826&bid=11&from=article.profile_all&gid=7689787715704914442&lk3s=06827d14&x-expires=1793010615&x-signature=qdMi0gLhunIfzbcnFlumiJGFb24%3D",
      "read_count": 0,
      "like_count": 0,
      "comment_count": 0,
      "share_count": 0,
      "source": "闪电新闻",
      "author_name": "•••",
      "author_id": "MS4wLjABAAAA3KU9ifwN12G41E6PJRpZgIfzVrXWQ4WPF66ns54c0uw",
      "author_verified": true,
      "author_auth_info": "闪电新闻官方账号",
      "posted_at": "2026-09-26 18:24",
      "platform": "toutiao"
    },
    {
      "id": "•••",
      "url": "https://www.toutiao.com/video/7689787812941742126",
      "type": "video",
      "title": "听风营地 风里有饭香 树下有童年",
      "cover": "https://p3-sign.toutiaoimg.com/tos-cn-i-tjoges91tu/fa36a70315d5e737371d88e5dab862c3~tplv-tt-profile_shortvideo:270:360.jpeg?_iz=3710&bid=8&from=shortvideo.profile_all&gid=7689787812941742126&lk3s=06827d14&x-expires=1791023415&x-signature=jzsygXZXKSBDCHw9hOCuvx3q%2FY8%3D",
      "read_count": 4,
      "play_count": 4,
      "like_count": 0,
      "comment_count": 0,
      "share_count": 0,
      "author_name": "•••",
      "author_id": "MS4wLjABAAAA3KU9ifwN12G41E6PJRpZgIfzVrXWQ4WPF66ns54c0uw",
      "author_verified": true,
      "author_auth_info": "闪电新闻官方账号",
      "posted_at": "2026-09-26 18:24",
      "platform": "toutiao",
      "duration_sec": 33
    }
  ],
  "count": 20,
  "billing": {
    "charged": …,
    "charged_usd": …,
    "balance_after_usd": …,
    …
  },
  "quota": { … }
}
```

## FAQ

### `tab` 该怎么选？

不确定就用默认的 all，读主页上的全部内容。只分析某一类内容时再切：文章用 article，视频用 video，用户动态用 ugc，短视频用 short_video。这个参数只管读哪一栏，不影响后面读文章详情时的类型。

### 想在一个账号里按关键词找内容怎么办？

用账号搜索那一页。它要 `user_id` 加关键词，只在该账号主页内检索帖子；这一页没有关键词参数，只能读栏目里的内容。两页返回的字段一样，先搜到再对照这里的列表很方便。

### 列表里怎么区分文章、视频和图片？

看 `type`，取值随内容而定，例如视频、图片、文字。视频行再看 `play_count` 和 `duration_seconds`，后者对非视频内容为 null；没有图片的帖子不会出现 `image_urls`，用字段是否存在来判断即可。

## Also

- Capability catalog (no key): https://api.everyinfra.com/api/v1/social/catalog?platform=toutiao
- OpenAPI: https://everyinfra.com/openapi.json · Agents guide: https://everyinfra.com/agents.md
