Sand AISand AI MAGI-2MAGI-2 現已登上 SandBase:支援原生音訊的 1080p 影片立即試用

X (Twitter) Tweets by IDs

API 文件
https://api.sandbase.ai/v1/api/twitter/tweets-by-ids

Look up several tweets at once by a comma-separated list of tweet IDs, with text, author and engagement counts.

價格
自 $0.0075 起美元/次呼叫
方法
POST
回應
JSON
參數
1 個必填 · 0 個選填

Playground

輸入
Comma-separated list of tweet IDs.
輸出就緒

您的輸出會顯示在這裡

完成輸入後,點擊執行。

API README

X (Twitter) Tweets by IDs API

Returns details for several tweets in one call. You pass a comma-separated list of tweet IDs in tweet_ids, and the response has one entry per ID in tweets with the text, author, engagement counts and links.

Use cases

  • Refresh like, retweet and reply counts for a saved list of tweet IDs.
  • Fetch the text and permalink of tweets collected from another source.
  • Check which tweets in a batch are replies, quotes or retweets.
  • Pull the author profile and media details for a set of known posts.

Request

curl -X POST "https://api.sandbase.ai/v1/api/twitter/tweets-by-ids" \
  -H "Authorization: Bearer $SANDBASE_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"tweet_ids": "1585341984679469056,1846987139428634858"}'

The result is returned in outputs[0].data.

Parameters

NameTypeRequiredDescription
tweet_idsstringYesComma-separated list of tweet IDs.

Example response

Real response for the request above, trimmed: lists keep their first item and long strings are cut.

{
  "code": 0,
  "msg": "success",
  "status": "success",
  "tweets": [
    {
      "author": {
        "affiliatesHighlightedLabel": {
          "label": {
            "badge": {
              "url": "https://pbs.twimg.com/profile_images/1955359038532653056/OSHY3ewP_bigger.jpg"
            },
            "description": "X",
            "url": {
              "url": "https://twitter.com/X",
              "url_type": "DeepLink"
            },
            "user_label_display_type": "Badge",
            "user_label_type": "BusinessLabel"
          }
        },
        "automatedBy": null,
        "canDm": false,
        "canMediaTag": false,
        "coverPicture": "https://pbs.twimg.com/profile_banners/44196397/1774145451",
        "createdAt": "Tue Jun 02 20:12:29 +0000 2009",
        "description": "https://t.co/ZdBx5WABYx",
        "entities": {
          "description": {
            "urls": [
              {
                "display_url": "Terafab.AI",
                "expanded_url": "http://Terafab.AI",
                "indices": [
                  0
                ],
                "url": "https://t.co/ZdBx5WABYx"
              }
            ]
          }
        }
      },
      "bookmarkCount": 14034,
      "card": null,
      "communityInfo": null,
      "conversationId": "1585341984679469056",
      "createdAt": "Wed Oct 26 18:45:58 +0000 2022",
      "displayTextRange": [
        0
      ],
      "entities": {},
      "extendedEntities": {
        "media": [
          {
            "additional_media_info": {
              "monetizable": false
            },
            "display_url": "pic.x.com/D68z4K2wq7",
            "expanded_url": "https://x.com/elonmusk/status/1585341984679469056/video/1",
            "ext_master_playlist_only": [],
            "ext_media_availability": {
              "status": "Available"
            },
            "ext_playlists": [],
            "id_str": "1585341912877146112",
            "indices": [
              40
            ]
          }
        ]
      },
      "id": "1585341984679469056",
      "inReplyToId": "",
      "inReplyToUserId": ""
    }
  ]
}

Response fields

FieldMeaning
tweets[]One entry per requested tweet ID. An entry with an empty id and empty text has no data.
tweets[].id / tweets[].url / tweets[].twitterUrlThe tweet ID and its links on x.com and twitter.com.
tweets[].textThe tweet text. Media links appear as short t.co URLs.
tweets[].createdAtPosting time as a string such as Wed Oct 26 18:45:58 +0000 2022.
tweets[].likeCount / tweets[].retweetCount / tweets[].replyCount / tweets[].quoteCount / tweets[].bookmarkCountEngagement counts for the tweet.
tweets[].viewCountView count. The sample tweet shows 0, so treat that value with care.
tweets[].isReply / tweets[].isQuote / tweets[].isRetweetFlags that show what kind of tweet it is.
tweets[].conversationIdID of the conversation the tweet belongs to.
tweets[].author.createdAt / tweets[].author.description / tweets[].author.coverPictureWhen the author account was created, its bio text and its banner image URL.
tweets[].extendedEntities.media[]Attached media items, with expanded_url, display_url and id_str.

Notes

  • Separate tweet IDs with commas and no extra text, for example 1585341984679469056,1846987139428634858.
  • Tweet IDs are numeric strings. The ID is the last part of a tweet URL.
  • The response has no pagination parameters. Each call returns the tweets for the IDs you send.
  • To read replies or quotes of a tweet, call Post Comments or Tweet Quotes.

Pricing

Billed at the actual cost of each call, about $0.0075 for the request above. Failed calls are not charged.

探索更多

相關 APIs

所有 APIs
API價格回應
X (Twitter)每次呼叫 $0.0075 起JSON
X (Twitter)每次呼叫 $0.00054 起JSON
Twitter每次呼叫 $0.0006 起非同步 JSON
X (Twitter)每次呼叫 $0.0001 起JSON
X (Twitter)每次呼叫 $0.0036 起JSON
X (Twitter)每次呼叫 $0.00045 起JSON

指南:X API alternative: pay per call, not per postBest Twitter API in 2026: X API Pricing Compared

問題

常見問題

我要如何使用 X (Twitter) Tweets by IDs API?

使用 POST 請求將您的 SandBase API 金鑰放在 Authorization 標頭(Bearer)中,並以 JSON 主體傳入參數,即可呼叫 https://api.sandbase.ai/v1/api/twitter/tweets-by-ids。您也可以直接在本頁的 Playground 試用,不必撰寫程式碼。

X (Twitter) Tweets by IDs API 的費用是多少?

每次起 $0.0075,並從您的 SandBase 餘額中扣款。您只會為實際發出的呼叫付費;沒有訂閱方案。

X (Twitter) Tweets by IDs API 接受哪些參數?

必要:tweet_ids (string)。 本頁的 Parameters 表格與 Playground 會列出每個欄位。

X (Twitter) Tweets by IDs API 會回傳什麼?

在同一個 HTTP 請求中回傳的 JSON 回應(同步)。 本頁的 README 包含範例回應。

我需要 X (Twitter) 開發者帳號或 API 金鑰嗎?

不需要。X (Twitter) Tweets by IDs 是透過 SandBase 運作,因此一組 SandBase API 金鑰即可使用此端點以及目錄中的其他所有 API 和模型。您不需要另外申請 X (Twitter) API 存取權。