Docs
Similar accounts

Similar accounts

Accounts X recommends as similar to a user ("Similar to …").

GET/user/{userId}/similar

Parameters

  • userIdpath · string · required

    Numeric user ID (digits only, up to 30). To pass a handle instead, use -1 here and set username.

  • usernamequery · string · optional

    Handle, 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'

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="
                            }

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.