Similar accounts
Accounts X recommends as similar to a user ("Similar to …").
/user/{userId}/similarParameters
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.
Notes
- One page of usually 10 to 20 accounts, no cursor. Accounts without enough activity can get none.
Example request
curl 'https://api.twittrapi.com/user/11348282/similar' \
--header 'X-API-KEY: YOUR_API_KEY'import httpx
# No SDK method for this endpoint yet, so this is a plain HTTP call.
resp = httpx.get(
"https://api.twittrapi.com/user/11348282/similar",
headers={"X-API-KEY": "YOUR_API_KEY"},
timeout=60,
)
data = resp.json()import { TwittrAPI } from "twittrapi";
const client = new TwittrAPI({ apiKey: process.env.TWITTRAPI_API_KEY });
// No wrapper method for this endpoint yet; client.get() sends the same authenticated GET.
const data = await client.get({
path: "/user/11348282/similar",
});curl 'https://twitter-aio.p.rapidapi.com/user/11348282/similar' \
--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 ConnectTabTimeline query for the user. The similar accounts are the module whose entryId starts with similartomodule; the other modules (the user itself, general suggestions) do not depend on the user. The simple format returns only the similar accounts.
Simple format (?format=simple or X-Response-Format: simple): Collection of User objects: only the similar accounts, without cursors (hasNextPage false). Schema.
{
"data": {
"connect_tab_timeline": {
"timeline": {
"instructions": [
{
"type": "TimelineClearCache"
},
{
"direction": "TopAndBottom",
"type": "TimelineTerminateTimeline"
},
{
"entries": [
{
"content": {
"__typename": "TimelineTimelineModule",
"clientEventInfo": {
"component": "people_connect_module",
"element": "module"
},
"displayType": "Vertical",
"entryType": "TimelineTimelineModule",
"header": {
"displayType": "Classic",
"text": "Follow"
},
"items": [
{
"entryId": "singleusermodule-0-user-11348282",
"item": {
"clientEventInfo": {
"component": "people_connect_module",
"details": {
"timelinesDetails": {
"controllerData": "DAACDAAPDAABAAAAAA==",
"injectionType": "SingleUserModule"
}
},
"element": "SingleUserModule"
},
"itemContent": {
"__typename": "TimelineUser",
"itemType": "TimelineUser",
"userDisplayType": "User",
"user_results": {
"result": {
"__typename": "User",
"action_counts": {
"favorites_count": 17128
},
"affiliates_highlighted_label": {},
"avatar": {
"image_url": "https://pbs.twimg.com/profile_images/1321163587679784960/0ZxKlEKB_normal.jpg"
},
"banner": {
"image_url": "https://pbs.twimg.com/profile_banners/11348282/1788992290"
},
"core": {
"created_at": "Wed Dec 19 20:20:32 +0000 2007",
"name": "NASA",
"screen_name": "NASA"
},
"follow_request_sent": false,
"has_graduated_access": true,
"id": "VXNlcjoxMTM0ODI4Mg==",
"is_blue_verified": true,
"location": {
"location": "Pale Blue Dot"
},
"media_permissions": {
"can_media_tag": true
},
"notifications_settings": {
"notifications_enabled": false
},
"parody_commentary_fan_label": "None",
"pinned_items": {},
"possibly_sensitive": false,
"privacy": {
"protected": false
},
"profile_bio": {
"description": "Making the seemingly impossible, possible. ✨",
"entities": {
"description": {},
"url": {
"urls": [
{
"display_url": "nasa.gov",
"expanded_url": "http://www.nasa.gov/",
"indices": [
0,
23
],
"url": "https://t.co/9NkQJKAnuU"
}
]
}
}
},
"profile_description_language": "en",
"profile_image_shape": "Square",
"profile_metadata": {
"profile_interstitial_type": ""
},
"profile_translation": {
"translator_type": "regular"
},
"relationship_counts": {
"followers": 92039920,
"following": 115
},
"relationship_perspectives": {
"blocked_by": false,
"blocking": false,
"followed_by": false,
"following": false,
"live_following": false,
"muting": false
},
"rest_id": "11348282",
"super_follow_eligible": false,
"super_followed_by": false,
"super_following": false,
"tweet_counts": {
"media_tweets": 28269,
"tweets": 74595
},
"verification": {
"verified": false,
"verified_type": "Government"
},
"website": {
"url": "https://t.co/9NkQJKAnuU"
},
"legacy": {
"blocked_by": false,
"blocking": false,
"can_media_tag": true,
"created_at": "Wed Dec 19 20:20:32 +0000 2007",
"default_profile_image": false,
"description": "Making the seemingly impossible, possible. ✨",
"entities": {
"description": {},
"url": {
"urls": [
{
"display_url": "nasa.gov",
"expanded_url": "http://www.nasa.gov/",
"indices": [
0,
23
],
"url": "https://t.co/9NkQJKAnuU"
}
]
}
},
"fast_followers_count": 0,
"favourites_count": 17128,
"follow_request_sent": false,
"followed_by": false,
"followers_count": 92039920,
"following": false,
"friends_count": 115,
"is_translator": false,
"location": "Pale Blue Dot",
"media_count": 28269,
"muting": false,
"name": "NASA",
"needs_phone_verification": false,
"normal_followers_count": 92039920,
"notifications": false,
"possibly_sensitive": false,
"profile_banner_url": "https://pbs.twimg.com/profile_banners/11348282/1788992290",
"profile_image_url_https": "https://pbs.twimg.com/profile_images/1321163587679784960/0ZxKlEKB_normal.jpg",
"profile_interstitial_type": "",
"protected": false,
"screen_name": "NASA",
"statuses_count": 74595,
"time_zone": "",
"translator_type": "regular",
"url": "https://t.co/9NkQJKAnuU",
"utc_offset": 0,
"verified": false,
"verified_type": "Government",
"want_retweets": false,
"withheld_description": "",
"withheld_scope": ""
}
}
}
}
}
}
]
},
"entryId": "singleusermodule-0",
"sortIndex": "2127344547863199744"
},
{
"content": {
"__typename": "TimelineTimelineModule",
"clientEventInfo": {
"component": "people_connect_module",
"element": "module"
},
"displayType": "Vertical",
"entryType": "TimelineTimelineModule",
"header": {
"displayType": "Classic",
"text": "Similar to NASA"
},
"items": [
{
"entryId": "similartomodule-1-user-19402238",
"item": {
"clientEventInfo": {
"component": "people_connect_module",
"details": {
"timelinesDetails": {
"controllerData": "DAACDAAPDAABCgABAAAAAAAAAIMAAAAA",
"injectionType": "SimilarToModule",
"sourceData": "DAABCgABUyerwNMe4psKAAIAAAAAAAAAAAAIAAIAAACDCAADAAAALwwABQwAAgwAAgwAAQoAAQAAAAAAAAAIAAAAAAA="
}
},
"element": "SimilarToModule"
},
"itemContent": {
"__typename": "TimelineUser",
"itemType": "TimelineUser",
"userDisplayType": "User",
"user_results": {
"result": {
"__typename": "User",
"action_counts": {
"favorites_count": 529
},
"affiliates_highlighted_label": {},
"avatar": {
"image_url": "https://pbs.twimg.com/profile_images/1877466471686684672/8PJsUiB__normal.jpg"
},
"banner": {
"image_url": "https://pbs.twimg.com/profile_banners/19402238/1403559093"
},
"core": {
"created_at": "Fri Jan 23 16:56:32 +0000 2009",
"name": "Science News",
"screen_name": "ScienceNews"
},
"follow_request_sent": false,
"has_graduated_access": true,
"id": "VXNlcjoxOTQwMjIzOA==",
"is_blue_verified": true,
"location": {
"location": "Washington, DC"
},
"media_permissions": {
"can_media_tag": true
},
"notifications_settings": {
"notifications_enabled": false
},
"parody_commentary_fan_label": "None",
"pinned_items": {
"tweet_ids_str": [
"1565445141741142017"
]
},
"possibly_sensitive": false,
"privacy": {
"protected": false
},
"profile_bio": {
"description": "Covering the latest news in all fields of science. Publisher @society4science. See also @SN_Explores.",
"entities": {
"description": {},
"url": {
"urls": [
{
"display_url": "sciencenews.org",
"expanded_url": "https://www.sciencenews.org",
"indices": [
0,
23
],
"url": "https://t.co/qDpSL8ca1J"
}
]
}
}
},
"profile_description_language": "en",
"profile_image_shape": "Circle",
"profile_metadata": {
"profile_interstitial_type": ""
},
"profile_translation": {
"translator_type": "none"
},
"relationship_counts": {
"followers": 5346759,
"following": 512
},
"relationship_perspectives": {
"blocked_by": false,
"blocking": false,
"followed_by": false,
"following": false,
"live_following": false,
"muting": false
},
"rest_id": "19402238",
"super_follow_eligible": false,
"super_followed_by": false,
"super_following": false,
"tweet_counts": {
"media_tweets": 11306,
"tweets": 83345
},
"verification": {
"verified": false
},
"website": {
"url": "https://t.co/qDpSL8ca1J"
},
"legacy": {
"blocked_by": false,
"blocking": false,
"can_media_tag": true,
"created_at": "Fri Jan 23 16:56:32 +0000 2009",
"default_profile_image": false,
"description": "Covering the latest news in all fields of science. Publisher @society4science. See also @SN_Explores.",
"entities": {
"description": {},
"url": {
"urls": [
{
"display_url": "sciencenews.org",
"expanded_url": "https://www.sciencenews.org",
"indices": [
0,
23
],
"url": "https://t.co/qDpSL8ca1J"
}
]
}
},
"fast_followers_count": 0,
"favourites_count": 529,
"follow_request_sent": false,
"followed_by": false,
"followers_count": 5346759,
"following": false,
"friends_count": 512,
"is_translator": false,
"location": "Washington, DC",
"media_count": 11306,
"muting": false,
"name": "Science News",
"needs_phone_verification": false,
"normal_followers_count": 5346759,
"notifications": false,
"pinned_tweet_ids_str": [
"1565445141741142017"
],
"possibly_sensitive": false,
"profile_banner_url": "https://pbs.twimg.com/profile_banners/19402238/1403559093",
"profile_image_url_https": "https://pbs.twimg.com/profile_images/1877466471686684672/8PJsUiB__normal.jpg",
"profile_interstitial_type": "",
"protected": false,
"screen_name": "ScienceNews",
"statuses_count": 83345,
"time_zone": "",
"translator_type": "none",
"url": "https://t.co/qDpSL8ca1J",
"utc_offset": 0,
"verified": false,
"want_retweets": false,
"withheld_description": "",
"withheld_scope": ""
}
}
}
}
}
},
{
"entryId": "similartomodule-1-user-15687962",
"item": {
"clientEventInfo": {
"component": "people_connect_module",
"details": {
"timelinesDetails": {
"controllerData": "DAACDAAPDAABCgABAAAAAAAAAIMAAAAA",
"injectionType": "SimilarToModule",
"sourceData": "DAABCgABUyerwNMe4psKAAIAAAAAAAAAAAAIAAIAAACDCAADAAAALwwABQwAAgwAAgwAAQoAAQAAAAAAAAAIAAAAAAA="
}{
"data": [
{
"id": "19402238",
"username": "ScienceNews",
"name": "Science News",
"description": "Covering the latest news in all fields of science. Publisher @society4science. See also @SN_Explores.",
"location": "Washington, DC",
"url": "https://www.sciencenews.org",
"createdAt": "2009-01-23T16:56:32Z",
"avatarUrl": "https://pbs.twimg.com/profile_images/1877466471686684672/8PJsUiB_.jpg",
"bannerUrl": "https://pbs.twimg.com/profile_banners/19402238/1403559093",
"verified": true,
"verifiedType": null,
"protected": false,
"counts": {
"followers": 5346759,
"following": 512,
"tweets": 83345,
"likes": 529,
"media": 11306,
"listed": 0
},
"pinnedTweetIds": [
"1565445141741142017"
],
"isAutomated": false
},
{
"id": "15687962",
"username": "Marvel",
"name": "Marvel Entertainment",
"description": "The official account for Marvel comics, movies, games, and more.",
"location": "New York, NY",
"url": "http://fandango.com/avengersdoomsday",
"createdAt": "2008-08-01T11:26:10Z",
"avatarUrl": "https://pbs.twimg.com/profile_images/1834328195904282624/_CAUqMol.jpg",
"bannerUrl": "https://pbs.twimg.com/profile_banners/15687962/1794881897",
"verified": true,
"verifiedType": "Business",
"protected": false,
"counts": {
"followers": 19674282,
"following": 661,
"tweets": 71572,
"likes": 7649,
"media": 25093,
"listed": 0
},
"pinnedTweetIds": [
"2124865795725623716"
],
"isAutomated": false
},
{
"id": "74286565",
"username": "Microsoft",
"name": "Microsoft",
"description": "We're on a mission to empower every person and every organization on the planet to achieve more. Support: @MicrosoftHelps",
"location": "Redmond, WA",
"url": null,
"createdAt": "2009-09-14T22:35:42Z",
"avatarUrl": "https://pbs.twimg.com/profile_images/2105783660914122752/qyF3N1l8.jpg",
"bannerUrl": "https://pbs.twimg.com/profile_banners/74286565/1780943553",
"verified": true,
"verifiedType": "Business",
"protected": false,
"counts": {
"followers": 13059667,
"following": 1096,
"tweets": 31197,
"likes": 13771,
"media": 3391,
"listed": 0
},
"pinnedTweetIds": [],
"isAutomated": false
}
],
"nextCursor": null,
"previousCursor": null,
"hasNextPage": false
}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, or the username contains characters X blocks.
- 404The 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, 407, 408, 409 or a 5xx error are refunded.