X/Twitter API 文档

X/Twitter API: 个人资料 — 按用户 ID 获取帖子指标

从 X/Twitter 获取个人资料的汇总指标,无需基于完整的对象集合自行计算。

将“按用户 ID 获取帖子指标”用于需要简明指标快照的仪表板、评分和定期报告。

方法 GET
实体 个人资料
版本 1
此端点的作用

利用此 API 方法可以构建什么

先查看结果和常见工作流,然后再了解参数和可运行的请求示例。

此端点可以帮助您

响应以所选 API 格式提供现成的个人资料摘要,包含关键计数和指标。

何时使用

将“按用户 ID 获取帖子指标”用于需要简明指标快照的仪表板、评分和定期报告。

常见使用场景

产品仪表板

无需加载和处理整个集合即可展示 X/Twitter 的核心指标。

趋势监控

定期保存快照,并比较指标随时间的变化。

对象评分

将汇总指标作为内部排名和规则的输入。

可用版本

响应版本

两个版本完成相同的任务,接受相同的参数。使用切换按钮比较响应结构,并选择您的客户端所需的版本。

响应版本 V2

在本页面切换版本,即可在同一文档 URL 下比较响应结构。

V1 不可用

保持不变的部分

V1 和 V2 的身份验证、必填参数和请求结构均相同。实际上,您只需在构建端点路径和解析响应时选择版本。

版本之间的差异

主要区别在于响应结构。新集成请使用 V2;仅在需要兼容现有客户端契约时保留 V1。

使用方法

如何调用该方法

两个版本使用相同的 API 密钥请求头和相同的查询参数。本文档先展示共享的参数集合,然后展示各版本特定的端点路径和代码片段。

输入参数

共享参数
参数 必填 类型 示例 说明
user_id 是 str 44196397 所选平台上的数字用户 ID。

各版本的请求路径

V2

复制确切的端点路径、示例 URL 和代码片段时请选择版本。上方的参数列表保持不变。

GET /api/v2/twitter.com/profile/tweets-metrics-by-user-id

规范化格式

代码示例

curl --request GET \
  --url "https://www.scrapestorm.net/api/v2/twitter.com/profile/tweets-metrics-by-user-id" \
  --header "X-API-Key: 00000000-0000-4000-8000-000000000000" \
  --get --data-urlencode 'user_id=44196397'
响应示例

按版本查看真实响应

预览保留了关键字段和集合中的前几项,便于您快速浏览响应结构。切换版本会改变 JSON 格式。

响应示例

V2 响应 JSON

已验证示例

此简明 JSON 示例来自 V2 最近一次成功的验证运行。

{
  "success": true,
  "status": "ok",
  "search_context": {
    "user_id": "44196397"
  },
  "data": {
    "user": {
      "url": "https://x.com/elonmusk",
      "user_id": "44196397",
      "username": "elonmusk",
      "display_name": "Elon Musk",
      "description": "Starmind",
      "emails": [],
      "external_links": [],
      "location": null,
      "created_at": "2009-06-02T20:12:29Z",
      "is_verified": false,
      "is_blue_verified": true,
      "is_protected": false,
      "possibly_sensitive": false,
      "default_profile": false,
      "default_profile_image": false,
      "followers_count": 240944559,
      "following_count": 1370,
      "tweet_count": 105744,
      "media_count": 4625,
      "listed_count": 170041,
      "like_count": 239681,
      "professional_type": "Creator",
      "professional_category_name": null,
      "affiliated_account": {
        "label": "X",
        "url": "https://x.com/X",
        "badge_url": "https://pbs.twimg.com/profile_images/1955359038532653056/OSHY3ewP_bigger.jpg",
        "label_type": "BusinessLabel"
      },
      "_more_fields": "5 more fields"
    },
    "analytics": {
      "all_posts": {
        "analyzed_posts_count": 20,
        "last_post_date": "2026-07-19T20:29:24+00:00",
        "total_engagement": 334625,
        "avg_engagement_rate_per_post": 0.006944,
        "peak_engagement_rate_per_post": 0.061896,
        "avg_weighted_engagement_score": 19461.975,
        "total_engagement_rate": 0.13888,
        "median_engagement_per_post": 9020.5,
        "max_engagement_per_post": 149134,
        "avg_caption_length": 78,
        "avg_posts_per_week": 7,
        "avg_posts_per_month": 30,
        "posts_count_last_7_days": 20,
        "posts_count_last_30_days": 20,
        "total_likes": 225663,
        "total_replies": 28011,
        "total_retweets": 61382,
        "total_quotes": 3798,
        "total_bookmarks": 15771,
        "total_views": 35787056,
        "avg_likes_per_post": 11283,
        "avg_replies_per_post": 1401,
        "avg_retweets_per_post": 3069,
        "avg_quotes_per_post": 190,
        "_more_fields": "15 more fields"
      },
      "sponsored_posts": {
        "analyzed_posts_count": 0,
        "total_engagement": 0,
        "avg_engagement_rate_per_post": 0.0,
        "peak_engagement_rate_per_post": 0.0,
        "avg_weighted_engagement_score": 0.0,
        "total_engagement_rate": 0.0,
        "median_engagement_per_post": 0.0,
        "max_engagement_per_post": 0,
        "avg_caption_length": 0,
        "avg_posts_per_week": 0,
        "avg_posts_per_month": 0,
        "posts_count_last_7_days": 0,
        "posts_count_last_30_days": 0
      },
      "organic_posts": {
        "analyzed_posts_count": 20,
        "last_post_date": "2026-07-19T20:29:24+00:00",
        "total_engagement": 334625,
        "avg_engagement_rate_per_post": 0.006944,
        "peak_engagement_rate_per_post": 0.061896,
        "avg_weighted_engagement_score": 19461.975,
        "total_engagement_rate": 0.13888,
        "median_engagement_per_post": 9020.5,
        "max_engagement_per_post": 149134,
        "avg_caption_length": 78,
        "avg_posts_per_week": 7,
        "avg_posts_per_month": 30,
        "posts_count_last_7_days": 20,
        "posts_count_last_30_days": 20,
        "total_likes": 225663,
        "total_replies": 28011,
        "total_retweets": 61382,
        "total_quotes": 3798,
        "total_bookmarks": 15771,
        "total_views": 35787056,
        "avg_likes_per_post": 11283,
        "avg_replies_per_post": 1401,
        "avg_retweets_per_post": 3069,
        "avg_quotes_per_post": 190,
        "_more_fields": "15 more fields"
      },
      "segment_comparison": {
        "sponsored_content_share": 0.0,
        "organic_content_share": 100.0,
        "organic_vs_sponsored_engagement_rate_gap": 0.0069,
        "sponsored_to_organic_avg_engagement_ratio": 0.0
      }
    },
    "feed": {
      "count": 20,
      "items": [
        {
          "url": "https://x.com/elonmusk/status/2078940289226482120",
          "tweet_id": "2078940289226482120",
          "text": "RT @PeterDiamandis: The first phone call across the Atlantic, in 1927, cost about seventy five dollars for three minutes, more than a thous…",
          "created_at": "2026-07-19T20:29:24Z",
          "language": "en",
          "source": "Twitter for iPhone",
          "author": {
            "url": "https://x.com/elonmusk",
            "user_id": "44196397",
            "username": "elonmusk",
            "display_name": "Elon Musk",
            "description": "Starmind",
            "created_at": "2009-06-02T20:12:29Z",
            "is_verified": false,
            "is_blue_verified": true,
            "is_protected": false,
            "possibly_sensitive": false,
            "default_profile": false,
            "default_profile_image": false,
            "followers_count": 240944559,
            "following_count": 1370,
            "tweet_count": 105744,
            "media_count": 4625,
            "listed_count": 170041,
            "like_count": 239681,
            "professional_type": "Creator",
            "affiliated_account": {
              "label": "X",
              "url": "https://x.com/X",
              "badge_url": "https://pbs.twimg.com/profile_images/1955359038532653056/OSHY3ewP_bigger.jpg",
              "label_type": "BusinessLabel"
            },
            "avatar_url": "https://example.com/image.jpg",
            "banner_url": "https://pbs.twimg.com/profile_banners/44196397/1774145451"
          },
          "user_mentions": [
            {
              "user_id": "14710129",
              "username": "PeterDiamandis",
              "display_name": "Peter H. Diamandis, MD",
              "start_index": 3,
              "end_index": 18
            }
          ],
          "is_reply": false,
          "is_quote": false,
          "is_retweet": true,
          "retweeted_tweet_id": "2078903115248460118",
          "reply_count": 0,
          "retweet_count": 296,
          "quote_count": 0,
          "like_count": 0,
          "bookmark_count": 0,
          "view_count": 462054,
          "edit_control": {
            "is_editable": false,
            "editable_until": "2026-07-19T21:29:24.451000Z",
            "edits_remaining": 5
          },
          "is_sponsored": false,
          "sponsored_detection_source": null,
          "sponsored_detection_confidence": null
        },
        {
          "url": "https://x.com/elonmusk/status/2078939898870903135",
          "tweet_id": "2078939898870903135",
          "text": "RT @PeterDiamandis: SpaceX's newest satellites carry about 1,024 gigabits of bandwidth each. The generation before carried 96. That is a te…",
          "created_at": "2026-07-19T20:27:51Z",
          "language": "en",
          "source": "Twitter for iPhone",
          "author": {
            "url": "https://x.com/elonmusk",
            "user_id": "44196397",
            "username": "elonmusk",
            "display_name": "Elon Musk",
            "description": "Starmind",
            "created_at": "2009-06-02T20:12:29Z",
            "is_verified": false,
            "is_blue_verified": true,
            "is_protected": false,
            "possibly_sensitive": false,
            "default_profile": false,
            "default_profile_image": false,
            "followers_count": 240944559,
            "following_count": 1370,
            "tweet_count": 105744,
            "media_count": 4625,
            "listed_count": 170041,
            "like_count": 239681,
            "professional_type": "Creator",
            "affiliated_account": {
              "label": "X",
              "url": "https://x.com/X",
              "badge_url": "https://pbs.twimg.com/profile_images/1955359038532653056/OSHY3ewP_bigger.jpg",
              "label_type": "BusinessLabel"
            },
            "avatar_url": "https://example.com/image.jpg",
            "banner_url": "https://pbs.twimg.com/profile_banners/44196397/1774145451"
          },
          "user_mentions": [
            {
              "user_id": "14710129",
              "username": "PeterDiamandis",
              "display_name": "Peter H. Diamandis, MD",
              "start_index": 3,
              "end_index": 18
            }
          ],
          "is_reply": false,
          "is_quote": false,
          "is_retweet": true,
          "retweeted_tweet_id": "2078933283539148891",
          "reply_count": 0,
          "retweet_count": 233,
          "quote_count": 0,
          "like_count": 0,
          "bookmark_count": 0,
          "view_count": 450028,
          "edit_control": {
            "is_editable": false,
            "editable_until": "2026-07-19T21:27:51.383000Z",
            "edits_remaining": 5
          },
          "is_sponsored": false,
          "sponsored_detection_source": null,
          "sponsored_detection_confidence": null
        },
        {
          "_more_items": 18
        }
      ]
    }
  }
}
下一步

继续评估

将本文档作为第一个决策点,然后在将端点接入常规使用之前,继续了解价格、平台覆盖范围和集成规则。

打开 X/Twitter 平台页面

在实现之前,比较相邻的实体、API 方法分组和相关文档。

打开平台页面

比较 API 方法价格

在扩大使用规模之前,查看此 API 方法在公开价格表中的位置。

查看价格

查看集成规则

通过入门文档确认身份验证、版本管理、重试以及模拟环境与正式环境的差异。

打开文档
常见问题

团队在实现前常问的问题

借助这些解答,判断此 API 方法是否适合您的工作流、版本选择和上线计划。

此 X/Twitter API 方法返回哪些数据?

该方法针对个人资料执行“按用户 ID 获取帖子指标”操作。下方的简明响应示例展示了确切的字段结构。

应该选择 V1 还是 V2?

新集成请选择 V2,因为它提供规范化的结构。仅在兼容已使用平台原生格式的客户端时使用 V1。

第一个请求需要准备什么?

创建 API 密钥,在请求头中发送它,并提供表格中的必填参数。代码示例中已包含正确的路径和请求结构。