screen_namestringbắt buộc
Screen Name, for example: elonmusk, can be obtained from the user's homepage link, for example: elonmusk in https://twitter.com/elonmusk
https://api.sandbase.ai/v1/api/twitter/web/user-mediaReturns media posts and timeline items for a specified user profile, queried by screen name or user ID. Supports cursor-based pagination for browsing past media posts.
[
{
"data": {
"next_cursor": "DAABCgABHQJ8y31___0KAAIc8Q0yK1Zh1QgAAwAAAAIAAA",
"status": "ok",
"timeline": [
{
"author": {
"avatar": null,
"blue_verified": true,
"name": "NASA",
"rest_id": "11348282",
"screen_name": "NASA"
},
"bookmarks": 136,
"conversation_id": "2090197889947451524",
"created_at": "Wed Aug 19 22:03:05 +0000 2026",
"favorites": 2146,
"lang": "en",
"media": {
"photo": [
{
"id": "2090197886822699009",
"media_url_https": "https://pbs.twimg.com/media/HQHf51pW0AEIWOI.png"
}
]
},
"quotes": 43,
"replies": 99,
"retweets": 335,
"sensitive": false,
"source": "<a href=\"https://www.sprinklr.com\" rel=\"nofollow\">Sprinklr</a>",
"text": "Due to an ongoing commercial spacecraft attitude control issue, the LINK spacecraft will not capture or boost NASA’s Neil Gehrels Swift Observatory to a higher altitude as planned. Read more about next steps: https://t.co/TQKhV81Hir https://t.co/xF92SIdnXJ",
"tweet_id": "2090197889947451524",
"views": "632119"
},
{
"author": {
"avatar": null,
"blue_verified": true,
"name": "NASA",
"rest_id": "11348282",
"screen_name": "NASA"
},
"bookmarks": 12,
"conversation_id": "2089668789218521591",
"created_at": "Tue Aug 18 19:53:14 +0000 2026",
"favorites": 274,
"lang": "en",
"media": {
"video": [
{
"aspect_ratio": [
16,
9
],
"duration": 45248,
"id": "2089793857093263360",
"media_url_https": "https://pbs.twimg.com/amplify_video_thumb/2089793857093263360/img/rajNPpyafMoxBToJ.jpg",
"original_info": {
"focus_rects": [],
"height": 2160,
"width": 3840
},
"variants": [
{
"content_type": "application/x-mpegURL",
"url": "https://video.twimg.com/amplify_video/2089793857093263360/pl/-PF6h_Z_PiLhbdO7.m3u8?tag=29&v=b22"
},
{
"bitrate": 256000,
"content_type": "video/mp4",
"url": "https://video.twimg.com/amplify_video/2089793857093263360/vid/avc1/480x270/u9F9hSHT5t2SkQOO.mp4?tag=29"
},
{
"bitrate": 832000,
"content_type": "video/mp4",
"url": "https://video.twimg.com/amplify_video/2089793857093263360/vid/avc1/640x360/0jjeusFrIr_aFAYF.mp4?tag=29"
},
"… 3 more items in the full response"
]
}
]
},
"quotes": 3,
"replies": 9,
"reply_to": "2089729699186409716",
"retweets": 21,
"sensitive": false,
"source": "<a href=\"https://mobile.twitter.com\" rel=\"nofollow\">Twitter Web App</a>",
"text": "@esa @Space_Station During today's spacewalk, @astro_anil and @Soph_Astro removed a failed communications antenna.\n\nDue to timing constraints, the crew was unable to install the new communications antenna, which is expected to be installed during a future spacewalk. https://t.co/UgV9g2GwXL",
"tweet_id": "2089802824678879526",
"views": "125438"
},
{
"author": {
"avatar": null,
"blue_verified": true,
"name": "NASA",
"rest_id": "11348282",
"screen_name": "NASA"
},
"bookmarks": 37,
"conversation_id": "2089668789218521591",
"created_at": "Tue Aug 18 15:02:40 +0000 2026",
"favorites": 994,
"lang": "en",
"media": {
"video": [
{
"aspect_ratio": [
16,
9
],
"duration": 23680,
"id": "2089729443778453504",
"media_url_https": "https://pbs.twimg.com/amplify_video_thumb/2089729443778453504/img/k6ki0t1Ra0pYfo7-.jpg",
"original_info": {
"focus_rects": [],
"height": 2160,
"width": 3840
},
"variants": [
{
"content_type": "application/x-mpegURL",
"url": "https://video.twimg.com/amplify_video/2089729443778453504/pl/Plv_wjakvSmqLDiw.m3u8?tag=29&v=1d3"
},
{
"bitrate": 256000,
"content_type": "video/mp4",
"url": "https://video.twimg.com/amplify_video/2089729443778453504/vid/avc1/480x270/sWOWwffmr_In7lC4.mp4?tag=29"
},
{
"bitrate": 832000,
"content_type": "video/mp4",
"url": "https://video.twimg.com/amplify_video/2089729443778453504/vid/avc1/640x360/R_Le1uJiTfipXLCd.mp4?tag=29"
},
"… 3 more items in the full response"
]
}
]
},
"quotes": 15,
"replies": 21,
"reply_to": "2089692281053860096",
"retweets": 128,
"sensitive": false,
"source": "<a href=\"https://mobile.twitter.com\" rel=\"nofollow\">Twitter Web App</a>",
"text": "@esa @Space_Station Here, Menon and Adenot are working on a series of electrical and data connectors as today's spacewalk continues. Tune in to watch our live coverage. https://t.co/VHhUoNcNHQ",
"tweet_id": "2089729699186409716",
"views": "276575"
},
"… 17 more items in the full response"
],
"user": {
"affiliates": [],
"avatar": "https://pbs.twimg.com/profile_images/1321163587679784960/0ZxKlEKB_normal.jpg",
"blue_verified": true,
"business_account": {
"affiliates_count": 88
},
"created_at": "Wed Dec 19 20:20:32 +0000 2007",
"desc": "Making the seemingly impossible, possible. ✨",
"friends": 118,
"header_image": "https://pbs.twimg.com/profile_banners/11348282/1775567134",
"id": "11348282",
"location": "Pale Blue Dot",
"media_count": 28083,
"name": "NASA",
"pinned_tweet_ids_str": null,
"profile": "NASA",
"protected": false,
"rest_id": "11348282",
"status": "active",
"statuses_count": 74167,
"sub_count": 92334357,
"verification_type": {
"is_identity_verified": false,
"reason": {
"description": {
"entities": [
{
"from_index": 91,
"ref": {
"url": "https://help.twitter.com/en/rules-and-policies/profile-labels",
"url_type": "ExternalUrl"
},
"to_index": 101
}
],
"text": "This account is verified because it is a government or multilateral organization account. Learn more"
},
"verified_since_msec": "1249674830941"
}
},
"website": "nasa.gov"
}
}
}
]Chọn một ví dụ để nạp đầu vào và kết quả của nó vào playground.
Returns a page of media posts from a public Twitter (X) account, plus the account's profile details. It needs a screen_name or a numeric rest_id.
favorites, retweets and views across an account's recent media posts.variants entry with the bitrate you want.curl -X POST "https://api.sandbase.ai/v1/api/twitter/web/user-media" \
-H "Authorization: Bearer $SANDBASE_API_KEY" \
-H "Content-Type: application/json" \
-d '{"screen_name": "NASA"}'
The result is returned in outputs[0].data.
| Name | Type | Required | Description |
|---|---|---|---|
screen_name | string | Yes | Screen Name, for example: elonmusk, can be obtained from the user's homepage link, for example: elonmusk in https://twitter.com/elonmusk |
cursor | string | No | Cursor, default is None, used for paging, obtained from the next_cursor in the last request |
rest_id | integer | No | User ID, for example: 44196397, if the user ID is used, the username will be ignored, only one of them can be selected. |
Real response for the request above, trimmed: lists keep their first item and long strings are cut.
{
"next_cursor": "DAABCgABHWL0W1z___0KAAIdXMz4Wdqw1ggAAwAAAAIAAA",
"status": "ok",
"timeline": [
{
"author": {
"avatar": null,
"blue_verified": true,
"name": "NASA",
"rest_id": "11348282",
"screen_name": "NASA"
},
"bookmarks": 22,
"conversation_id": "2117383753139925271",
"created_at": "Mon Nov 02 22:30:00 +0000 2026",
"favorites": 470,
"lang": "en",
"media": {
"photo": [
{
"id": "2117375637358882816",
"media_url_https": "https://pbs.twimg.com/media/HWJt7IDXsAAa7bN.jpg"
}
]
},
"quotes": 6,
"replies": 39,
"retweets": 45,
"sensitive": false,
"source": null
}
],
"user": {
"affiliates": [],
"avatar": "https://pbs.twimg.com/profile_images/1321163587679784960/0ZxKlEKB_normal.jpg",
"blue_verified": true,
"business_account": {
"affiliates_count": 85
},
"created_at": "Wed Dec 19 20:20:32 +0000 2007",
"desc": "Making the seemingly impossible, possible. ✨",
"friends": 115,
"header_image": "https://pbs.twimg.com/profile_banners/11348282/1788992290",
"id": "11348282",
"location": "Pale Blue Dot",
"media_count": 28223,
"name": "NASA"
}
}
| Field | Meaning |
|---|---|
timeline[].tweet_id / timeline[].conversation_id | ID of the post and ID of its conversation. They match for a standalone post. |
timeline[].text | Post text. Long text may be shortened. |
timeline[].created_at | Post time as a string such as Mon Nov 02 22:30:00 +0000 2026. |
timeline[].favorites / retweets / replies / quotes / bookmarks / views | Engagement counts for the post. views is returned as a string. |
timeline[].media.photo[].media_url_https | Image URL for each photo in the post. |
timeline[].media.video[].variants[] | Available video files. MP4 entries carry a bitrate and url, and an HLS playlist entry has content_type application/x-mpegURL. |
timeline[].media.video[].duration / aspect_ratio | Length of the video and its width-to-height ratio. original_info gives pixel width and height. |
timeline[].author.screen_name / rest_id | Handle and numeric ID of the account that wrote the post. |
user.media_count / statuses_count / sub_count | Number of media posts, number of posts, and subscriber count for the profile. sub_count is the follower-style total. |
next_cursor | Cursor value for the next page of results. |
screen_name from the profile URL. In https://twitter.com/NASA, it is NASA.rest_id, the API ignores screen_name. rest_id is an integer such as 44196397.next_cursor value from the last response as cursor.$0.001 per successful call. Failed calls are not charged. It is included in the daily free quota of each organization.
Bắt đầu xây dựng
Endpoint API của nền tảng với xác thực và theo dõi mức sử dụng thống nhất.
curl -X POST "https://api.sandbase.ai/v1/api/twitter/web/user-media" \
-H "Authorization: Bearer $SANDBASE_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"screen_name": "NASA"
}'Đặt SandBase API key của bạn trong môi trường máy chủ. Các request sử dụng xác thực Bearer.
export SANDBASE_API_KEY="YOUR_API_KEY"Giữ key của bạn trên máy chủ. Không hiển thị trong mã chạy trên trình duyệt.
screen_namestringbắt buộcScreen Name, for example: elonmusk, can be obtained from the user's homepage link, for example: elonmusk in https://twitter.com/elonmusk
cursorstringCursor, default is None, used for paging, obtained from the `next_cursor` in the last request
rest_idintegerUser ID, for example: 44196397, if the user ID is used, the username will be ignored, only one of them can be selected.
Đây là phản hồi ví dụ đã lưu cho API này; không có request thực nào được gửi khi xem mục này.
[
{
"data": {
"next_cursor": "DAABCgABHQJ8y31___0KAAIc8Q0yK1Zh1QgAAwAAAAIAAA",
"status": "ok",
"timeline": [
{
"author": {
"avatar": null,
"blue_verified": true,
"name": "NASA",
"rest_id": "11348282",
"screen_name": "NASA"
},
"bookmarks": 136,
"conversation_id": "2090197889947451524",
"created_at": "Wed Aug 19 22:03:05 +0000 2026",
"favorites": 2146,
"lang": "en",
"media": {
"photo": [
{
"id": "2090197886822699009",
"media_url_https": "https://pbs.twimg.com/media/HQHf51pW0AEIWOI.png"
}
]
},
"quotes": 43,
"replies": 99,
"retweets": 335,
"sensitive": false,
"source": "<a href=\"https://www.sprinklr.com\" rel=\"nofollow\">Sprinklr</a>",
"text": "Due to an ongoing commercial spacecraft attitude control issue, the LINK spacecraft will not capture or boost NASA’s Neil Gehrels Swift Observatory to a higher altitude as planned. Read more about next steps: https://t.co/TQKhV81Hir https://t.co/xF92SIdnXJ",
"tweet_id": "2090197889947451524",
"views": "632119"
},
{
"author": {
"avatar": null,
"blue_verified": true,
"name": "NASA",
"rest_id": "11348282",
"screen_name": "NASA"
},
"bookmarks": 12,
"conversation_id": "2089668789218521591",
"created_at": "Tue Aug 18 19:53:14 +0000 2026",
"favorites": 274,
"lang": "en",
"media": {
"video": [
{
"aspect_ratio": [
16,
9
],
"duration": 45248,
"id": "2089793857093263360",
"media_url_https": "https://pbs.twimg.com/amplify_video_thumb/2089793857093263360/img/rajNPpyafMoxBToJ.jpg",
"original_info": {
"focus_rects": [],
"height": 2160,
"width": 3840
},
"variants": [
{
"content_type": "application/x-mpegURL",
"url": "https://video.twimg.com/amplify_video/2089793857093263360/pl/-PF6h_Z_PiLhbdO7.m3u8?tag=29&v=b22"
},
{
"bitrate": 256000,
"content_type": "video/mp4",
"url": "https://video.twimg.com/amplify_video/2089793857093263360/vid/avc1/480x270/u9F9hSHT5t2SkQOO.mp4?tag=29"
},
{
"bitrate": 832000,
"content_type": "video/mp4",
"url": "https://video.twimg.com/amplify_video/2089793857093263360/vid/avc1/640x360/0jjeusFrIr_aFAYF.mp4?tag=29"
},
"… 3 more items in the full response"
]
}
]
},
"quotes": 3,
"replies": 9,
"reply_to": "2089729699186409716",
"retweets": 21,
"sensitive": false,
"source": "<a href=\"https://mobile.twitter.com\" rel=\"nofollow\">Twitter Web App</a>",
"text": "@esa @Space_Station During today's spacewalk, @astro_anil and @Soph_Astro removed a failed communications antenna.\n\nDue to timing constraints, the crew was unable to install the new communications antenna, which is expected to be installed during a future spacewalk. https://t.co/UgV9g2GwXL",
"tweet_id": "2089802824678879526",
"views": "125438"
},
{
"author": {
"avatar": null,
"blue_verified": true,
"name": "NASA",
"rest_id": "11348282",
"screen_name": "NASA"
},
"bookmarks": 37,
"conversation_id": "2089668789218521591",
"created_at": "Tue Aug 18 15:02:40 +0000 2026",
"favorites": 994,
"lang": "en",
"media": {
"video": [
{
"aspect_ratio": [
16,
9
],
"duration": 23680,
"id": "2089729443778453504",
"media_url_https": "https://pbs.twimg.com/amplify_video_thumb/2089729443778453504/img/k6ki0t1Ra0pYfo7-.jpg",
"original_info": {
"focus_rects": [],
"height": 2160,
"width": 3840
},
"variants": [
{
"content_type": "application/x-mpegURL",
"url": "https://video.twimg.com/amplify_video/2089729443778453504/pl/Plv_wjakvSmqLDiw.m3u8?tag=29&v=1d3"
},
{
"bitrate": 256000,
"content_type": "video/mp4",
"url": "https://video.twimg.com/amplify_video/2089729443778453504/vid/avc1/480x270/sWOWwffmr_In7lC4.mp4?tag=29"
},
{
"bitrate": 832000,
"content_type": "video/mp4",
"url": "https://video.twimg.com/amplify_video/2089729443778453504/vid/avc1/640x360/R_Le1uJiTfipXLCd.mp4?tag=29"
},
"… 3 more items in the full response"
]
}
]
},
"quotes": 15,
"replies": 21,
"reply_to": "2089692281053860096",
"retweets": 128,
"sensitive": false,
"source": "<a href=\"https://mobile.twitter.com\" rel=\"nofollow\">Twitter Web App</a>",
"text": "@esa @Space_Station Here, Menon and Adenot are working on a series of electrical and data connectors as today's spacewalk continues. Tune in to watch our live coverage. https://t.co/VHhUoNcNHQ",
"tweet_id": "2089729699186409716",
"views": "276575"
},
"… 17 more items in the full response"
],
"user": {
"affiliates": [],
"avatar": "https://pbs.twimg.com/profile_images/1321163587679784960/0ZxKlEKB_normal.jpg",
"blue_verified": true,
"business_account": {
"affiliates_count": 88
},
"created_at": "Wed Dec 19 20:20:32 +0000 2007",
"desc": "Making the seemingly impossible, possible. ✨",
"friends": 118,
"header_image": "https://pbs.twimg.com/profile_banners/11348282/1775567134",
"id": "11348282",
"location": "Pale Blue Dot",
"media_count": 28083,
"name": "NASA",
"pinned_tweet_ids_str": null,
"profile": "NASA",
"protected": false,
"rest_id": "11348282",
"status": "active",
"statuses_count": 74167,
"sub_count": 92334357,
"verification_type": {
"is_identity_verified": false,
"reason": {
"description": {
"entities": [
{
"from_index": 91,
"ref": {
"url": "https://help.twitter.com/en/rules-and-policies/profile-labels",
"url_type": "ExternalUrl"
},
"to_index": 101
}
],
"text": "This account is verified because it is a government or multilateral organization account. Learn more"
},
"verified_since_msec": "1249674830941"
}
},
"website": "nasa.gov"
}
}
}
]Khám phá thêm
| API | Giá | Phản hồi |
|---|---|---|
Twitter (X) User MediaAPI này Twitter | $0.001 mỗi lần gọi | JSON |
Twitter | $0.001 mỗi lần gọi | JSON |
Twitter | $0.001 mỗi lần gọi | JSON |
Twitter | $0.001 mỗi lần gọi | JSON |
Twitter | $0.001 mỗi lần gọi | JSON |
Twitter | $0.001 mỗi lần gọi | JSON |
Hướng dẫn:X API alternative: pay per call, not per postBest Twitter API in 2026: X API Pricing Compared
Câu hỏi
Gửi yêu cầu POST đến https://api.sandbase.ai/v1/api/twitter/web/user-media với khóa API SandBase của bạn trong tiêu đề Authorization (Bearer) và các tham số trong phần thân JSON. Bạn cũng có thể thử trực tiếp trong Playground trên trang này mà không cần viết code.
$0.001 mỗi lần gọi, được tính từ số dư SandBase của bạn. Bạn chỉ bị tính phí cho các lần gọi bạn thực hiện; không có gói đăng ký.
Bắt buộc: screen_name (string). Tùy chọn: cursor (string) và rest_id (integer). Bảng Parameters và Playground trên trang này liệt kê mọi trường.
Phản hồi JSON được trả về trong cùng một yêu cầu HTTP (đồng bộ). README trên trang này có ví dụ phản hồi.
Không. Twitter (X) User Media chạy thông qua SandBase, nên chỉ cần một API key SandBase là đủ cho endpoint này và mọi API cùng model khác trong danh mục. Bạn không cần đăng ký riêng để có quyền truy cập API của Twitter.