User media
Tweets with photos or videos from a profile.
/user/{userId}/mediaParameters
userIdpath · string · requiredNumeric user ID (digits only, up to 30). To pass a handle instead, use -1 here and set username.
usernamequery · string · optionalHandle, with or without @. When set, it is used instead of userId: the API looks up the ID first, which makes the call a little slower. Still one billed call.
countquery · integer · optional · default 20Number of items to ask X for. Sent to X as is; X treats it as a hint and decides how many it returns (follower and following pages often hold 50 to 70 users for count=20). A value that is not a number falls back to 20.
cursorquery · string · optionalBottom cursor from the previous page. Leave it out for the first page. See Pagination.
Paginated: pass the bottom cursor of one page as cursor to get the next. Each page is one billed call. See Pagination.
Example request
curl 'https://api.twittrapi.com/user/12/media?count=20' \
--header 'X-API-KEY: YOUR_API_KEY'from twittrapi import TwittrAPI
client = TwittrAPI(api_key="YOUR_API_KEY")
data = client.users.media("12", count=20)import { TwittrAPI } from "twittrapi";
const client = new TwittrAPI({ apiKey: process.env.TWITTRAPI_API_KEY });
const data = await client.users.media({ userId: "12", count: 20 });curl 'https://twitter-aio.p.rapidapi.com/user/12/media?count=20' \
--header 'x-rapidapi-key: YOUR_RAPIDAPI_KEY' \
--header 'x-rapidapi-host: twitter-aio.p.rapidapi.com'Base URL https://api.twittrapi.com, key in the X-API-KEY header. Python and Node.js use the official SDKs.
Response
Raw JSON of X's UserMedia query.
Simple format (?format=simple or X-Response-Format: simple): Collection of Tweet objects: {data: [Tweet], nextCursor, previousCursor, hasNextPage}. Schema.
{
"data": {
"user": {
"result": {
"__typename": "User",
"timeline": {
"timeline": {
"instructions": [
{
"type": "TimelineClearCache"
},
{
"direction": "Top",
"type": "TimelineTerminateTimeline"
},
{
"entries": [
{
"content": {
"__typename": "TimelineTimelineModule",
"clientEventInfo": {
"component": "profile-media"
},
"displayType": "VerticalGrid",
"entryType": "TimelineTimelineModule",
"items": [
{
"entryId": "profile-grid-0-tweet-2107952086193508716",
"item": {
"itemContent": {
"__typename": "TimelineTweet",
"itemType": "TimelineTweet",
"tweetDisplayType": "MediaGrid",
"tweet_results": {
"result": {
"__typename": "Tweet",
"core": {
"user_results": {
"result": {
"__typename": "User",
"affiliates_highlighted_label": {
"label": {
"badge": {
"url": "https://pbs.twimg.com/profile_images/1955359038532653056/OSHY3ewP_bigger.jpg"
},
"description": "X",
"url": {
"url": "https://twitter.com/X",
"urlType": "DeepLink"
},
"userLabelDisplayType": "Badge",
"userLabelType": "BusinessLabel"
}
},
"has_graduated_access": true,
"id": "VXNlcjoyMjQ0OTk0OTQ1",
"is_blue_verified": true,
"legacy": {
"blocked_by": false,
"blocking": false,
"can_dm": true,
"can_media_tag": true,
"created_at": "Sat Dec 14 04:35:55 +0000 2013",
"default_profile": false,
"default_profile_image": false,
"description": "The voice of the X Dev team and your official source for updates, news, and events, related to the X API.",
"entities": {
"description": {},
"url": {
"urls": [
{
"display_url": "docs.x.com",
"expanded_url": "https://docs.x.com/",
"indices": [
0,
23
],
"url": "https://t.co/NIwHVIVyrN"
}
]
}
},
"fast_followers_count": 0,
"favourites_count": 2758,
"follow_request_sent": false,
"followed_by": false,
"followers_count": 698074,
"following": false,
"friends_count": 770,
"has_custom_timelines": true,
"is_translator": false,
"listed_count": 2977,
"location": "127.0.0.1",
"media_count": 832,
"muting": false,
"name": "Developers",
"needs_phone_verification": false,
"normal_followers_count": 698074,
"notifications": false,
"pinned_tweet_ids_str": [
"2019881223666233717"
],
"possibly_sensitive": false,
"profile_banner_url": "https://pbs.twimg.com/profile_banners/2244994945/1690213128",
"profile_image_url_https": "https://pbs.twimg.com/profile_images/1683501992314798080/xl1POYLw_normal.jpg",
"profile_interstitial_type": "",
"protected": false,
"screen_name": "XDevelopers",
"statuses_count": 4376,
"time_zone": "",
"translator_type": "regular",
"url": "https://t.co/NIwHVIVyrN",
"utc_offset": 0,
"verified": false,
"verified_type": "Business",
"want_retweets": false,
"withheld_description": "",
"withheld_scope": ""
},
"parody_commentary_fan_label": "None",
"professional": {
"category": [
{
"icon_name": "IconBriefcaseStroke",
"id": 1009,
"name": "Community"
}
],
"professional_type": "Business",
"rest_id": "1516891231749517312"
},
"profile_image_shape": "Square",
"rest_id": "2244994945",
"super_follow_eligible": false,
"super_followed_by": false,
"super_following": false,
"tipjar_settings": {}
}
}
},
"edit_control": {
"edit_tweet_ids": [
"2107952086193508716"
],
"editable_until_msecs": "1791413515000",
"edits_remaining": "5",
"is_edit_eligible": false
},
"grok_analysis_button": true,
"has_birdwatch_notes": false,
"is_translatable": false,
"legacy": {
"bookmark_count": 76,
"bookmarked": false,
"conversation_id_str": "2107952086193508716",
"created_at": "Wed Oct 07 21:51:55 +0000 2026",
"display_text_range": [
0,
278
],
"entities": {
"media": [
{
"additional_media_info": {
"monetizable": false
},
"display_url": "pic.x.com/p0HhAOwlkq",
"expanded_url": "https://x.com/XDevelopers/status/2107952086193508716/video/1",
"ext_media_availability": {
"status": "Available"
},
"features": {
"all": {
"tags": [
{
"name": "Example User 1",
"screen_name": "example_user_1",
"type": "user",
"user_id": "1000000000000000001"
}
]
}
},
"id_str": "2107951577118171136",
"indices": [
279,
302
],
"media_key": "13_2107951577118171136",
"media_results": {
"result": {
"media_key": "13_2107951577118171136"
}
},
"media_url_https": "https://pbs.twimg.com/amplify_video_thumb/2107951577118171136/img/DnRVpyjYuF1QWEVz.jpg",
"original_info": {
"focus_rects": [],
"height": 1640,
"width": 2940
},
"sizes": {
"large": {
"h": 1142,
"resize": "fit",
"w": 2048
},
"medium": {
"h": 669,
"resize": "fit",
"w": 1200
},
"small": {
"h": 379,
"resize": "fit",
"w": 680
},
"thumb": {
"h": 150,
"resize": "crop",
"w": 150
}
},
"type": "video",
"url": "https://t.co/p0HhAOwlkq",
"video_info": {
"aspect_ratio": [
147,
82
],
"duration_millis": 7133,
"variants": [
{
"content_type": "application/x-mpegURL",
"url": "https://video.twimg.com/amplify_video/2107951577118171136/pl/CviNFsG7P3bXbtOM.m3u8?tag=29"
},
{
"bitrate": 256000,
"content_type": "video/mp4",
"url": "https://video.twimg.com/amplify_video/2107951577118171136/vid/avc1/484x270/grINTBwk-Ni0oJL_.mp4?tag=29"
}
]
}
}
]
},
"extended_entities": {
"media": [
{
"additional_media_info": {
"monetizable": false
},
"display_url": "pic.x.com/p0HhAOwlkq",
"expanded_url": "https://x.com/XDevelopers/status/2107952086193508716/video/1",
"ext_media_availability": {
"status": "Available"
},
"features": {
"all": {
"tags": [
{
"name": "Example User 1",
"screen_name": "example_user_1",
"type": "user",
"user_id": "1000000000000000001"
}
]
}
},
"id_str": "2107951577118171136",
"indices": [
279,
302
],
"media_key": "13_2107951577118171136",
"media_results": {
"result": {
"media_key": "13_2107951577118171136"
}
},
"media_url_https": "https://pbs.twimg.com/amplify_video_thumb/2107951577118171136/img/DnRVpyjYuF1QWEVz.jpg",
"original_info": {
"focus_rects": [],
"height": 1640,
"width": 2940
},
"sizes": {
"large": {
"h": 1142,
"resize": "fit",
"w": 2048
},
"medium": {
"h": 669,
"resize": "fit",
"w": 1200
},
"small": {
"h": 379,
"resize": "fit",
"w": 680
},
"thumb": {
"h": 150,
"resize": "crop",
"w": 150
}
},
"type": "video",
"url": "https://t.co/p0HhAOwlkq",
"video_info": {
"aspect_ratio": [
147,
82
],
"duration_millis": 7133,
"variants": [
{
"content_type": "application/x-mpegURL",
"url": "https://video.twimg.com/amplify_video/2107951577118171136/pl/CviNFsG7P3bXbtOM.m3u8?tag=29"
},
{
"bitrate": 256000,
"content_type": "video/mp4",
"url": "https://video.twimg.com/amplify_video/2107951577118171136/vid/avc1/484x270/grINTBwk-Ni0oJL_.mp4?tag=29"
}
]
}
}
]
},
"favorite_count": 230,
"favorited": false,
"full_text": "The Developer E𝕏hibit just got a major upgrade. 🚀\n\nRebuilt from the ground up to help you showcase your X API app and get discovered:\n\n• All-new UI with more ways to customize your listing\n• Submit Grok Bot templates & agent skill files\n• Staff Picks, hand-selected by the X https://t.co/p0HhAOwlkq",
"id_str": "2107952086193508716",
"is_quote_status": false,
"lang": "en",
"possibly_sensitive": false,
"possibly_sensitive_editable": true,
"quote_count": 4,
"reply_count": 16,
"retweet_count": 31,
"retweeted": false,
"user_id_str": "2244994945"
},
"note_tweet": {
"is_expandable": true,
"note_tweet_results": {
"result": {
"entity_set": {
"hashtags": [],
"symbols": [],
"timestamps": [],
"urls": [
{
"display_url": "developer.x.com/exhibit",
"expanded_url": "https://developer.x.com/exhibit",
"indices": [
347,
370
],
"url": "https://t.co/XorO5ldGTN"
}
],
"user_mentions": []
},
"id": "Tm90ZVR3ZWV0OjIxMDc5NTIwODYwNjM0Mjc1ODQ=",
"media": {
"inline_media": []
},
"richtext": {
"richtext_tags": []
},
"text": "The Developer E𝕏hibit just got a major upgrade. 🚀\n\nRebuilt from the ground up to help you showcase your X API app and get discovered:\n\n• All-new UI with more ways to customize your listing\n• Submit Grok Bot templates & agent skill files\n• Staff Picks, hand-selected by the X team\n• New Grok Bot templates to build & launch faster\n\nExplore it now: https://t.co/XorO5ldGTN"
}
}
},
"rest_id": "2107952086193508716",
"unmention_data": {},
"views": {
"count": "23589",
"state": "EnabledWithCount"
}
}
}
}
}
}
]
},
"entryId": "profile-grid-0",
"sortIndex": "2109014658881945600"
},
{
"content": {
"__typename": "TimelineTimelineCursor",
"cursorType": "Top",
"entryType": "TimelineTimelineCursor",
"value": "DAABCgABHUS5qIDAJxEKAAIbOL6IfJeQgwgAAwAAAAEAAA"
},
"entryId": "cursor-top-2109014658881945601",{
"data": [
{
"id": "2107952086193508716",
"url": "https://x.com/XDevelopers/status/2107952086193508716",
"text": "The Developer E𝕏hibit just got a major upgrade. 🚀\n\nRebuilt from the ground up to help you showcase your X API app and get discovered:\n\n• All-new UI with more ways to customize your listing\n• Submit Grok Bot templates & agent skill files\n• Staff Picks, hand-selected by the X team\n• New Grok Bot templates to build & launch faster\n\nExplore it now: https://developer.x.com/exhibit",
"createdAt": "2026-10-07T21:51:55Z",
"lang": "en",
"author": {
"id": "2244994945",
"username": "XDevelopers",
"name": "Developers",
"description": "The voice of the X Dev team and your official source for updates, news, and events, related to the X API.",
"location": "127.0.0.1",
"url": "https://docs.x.com/",
"createdAt": "2013-12-14T04:35:55Z",
"avatarUrl": "https://pbs.twimg.com/profile_images/1683501992314798080/xl1POYLw.jpg",
"bannerUrl": "https://pbs.twimg.com/profile_banners/2244994945/1690213128",
"verified": true,
"verifiedType": "Business",
"protected": false,
"counts": {
"followers": 698074,
"following": 770,
"tweets": 4376,
"likes": 2758,
"media": 832,
"listed": 2977
},
"pinnedTweetIds": [
"2019881223666233717"
],
"isAutomated": false
},
"counts": {
"likes": 230,
"retweets": 31,
"replies": 16,
"quotes": 4,
"bookmarks": 76,
"views": 23589
},
"media": [
{
"type": "video",
"url": "https://video.twimg.com/amplify_video/2107951577118171136/vid/avc1/484x270/grINTBwk-Ni0oJL_.mp4?tag=29",
"previewUrl": "https://pbs.twimg.com/amplify_video_thumb/2107951577118171136/img/DnRVpyjYuF1QWEVz.jpg",
"width": 2940,
"height": 1640,
"altText": null,
"durationMs": 7133
}
],
"urls": [
"https://developer.x.com/exhibit"
],
"hashtags": [],
"mentions": [],
"replyTo": null,
"quoted": null,
"retweetOf": null,
"conversationId": "2107952086193508716",
"isPinned": false,
"source": null,
"article": null
}
],
"nextCursor": "DAABCgABHUS5qIC___0KAAIbOL6IfJeQgwgAAwAAAAIAAA",
"previousCursor": "DAABCgABHUS5qIDAJxEKAAIbOL6IfJeQgwgAAwAAAAEAAA",
"hasNextPage": true
}In the raw format, field names and nesting come from X and can change without notice. See Response format; the simple format keeps a fixed schema.
Errors
- 422userId is not numeric, or the username lookup failed.
- 400userId is -1 and username is missing, the username contains characters X blocks, or the user could not be found.
Errors every endpoint can return (401, 402, 403, 404, 408, 409, 429, 5xx), and which of them are charged, are on the Errors page. Calls that fail with 400, 408, 409 or a 5xx error are refunded.