Docs
User highlights

User highlights

Tweets the user has added to the Highlights tab of their profile, newest first.

GET/user/{userId}/highlights

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.

  • countquery · integer · optional · default 20

    Number of tweets to ask X for, 1 to 100. Other values fall back to 20. X treats it as a hint.

  • cursorquery · string · optional

    Bottom 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/highlights?count=20' \
  --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 UserHighlightsTweets query. Entries are in data.user.result.timeline.timeline.instructions. Empty for accounts without highlights.

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"
              },
              {
                "entries": [
                  {
                    "content": {
                      "__typename": "TimelineTimelineItem",
                      "clientEventInfo": {
                        "component": "highlights",
                        "element": "tweet"
                      },
                      "entryType": "TimelineTimelineItem",
                      "itemContent": {
                        "__typename": "TimelineTweet",
                        "itemType": "TimelineTweet",
                        "tweetDisplayType": "Tweet",
                        "tweet_results": {
                          "result": {
                            "__typename": "Tweet",
                            "card": {
                              "legacy": {
                                "binding_values": [
                                  {
                                    "key": "broadcast_url",
                                    "value": {
                                      "string_value": "https://x.com/i/broadcasts/2ReRnqpjqpWXrW",
                                      "type": "STRING"
                                    }
                                  },
                                  {
                                    "key": "broadcast_width",
                                    "value": {
                                      "string_value": "3840",
                                      "type": "STRING"
                                    }
                                  },
                                  {
                                    "key": "broadcast_state",
                                    "value": {
                                      "string_value": "ENDED",
                                      "type": "STRING"
                                    }
                                  },
                                  {
                                    "key": "site",
                                    "value": {
                                      "scribe_key": "publisher_id",
                                      "type": "USER",
                                      "user_value": {
                                        "id_str": "11348282",
                                        "path": []
                                      }
                                    }
                                  },
                                  {
                                    "key": "broadcast_title",
                                    "value": {
                                      "string_value": "NASA's Northrop Grumman Commercial Resupply Services 25 Launch",
                                      "type": "STRING"
                                    }
                                  },
                                  {
                                    "key": "broadcast_source",
                                    "value": {
                                      "string_value": "LiveCms",
                                      "type": "STRING"
                                    }
                                  },
                                  {
                                    "key": "broadcast_orientation",
                                    "value": {
                                      "string_value": "0",
                                      "type": "STRING"
                                    }
                                  },
                                  {
                                    "key": "broadcast_id",
                                    "value": {
                                      "string_value": "2ReRnqpjqpWXrW",
                                      "type": "STRING"
                                    }
                                  },
                                  {
                                    "key": "broadcast_thumbnail_small",
                                    "value": {
                                      "image_value": {
                                        "height": 202,
                                        "url": "https://pbs.twimg.com/card_img/2127074066561658880/usBRZHge?format=jpg&name=386x202",
                                        "width": 386
                                      },
                                      "type": "IMAGE"
                                    }
                                  },
                                  {
                                    "key": "broadcaster_twitter_id",
                                    "value": {
                                      "string_value": "11348282",
                                      "type": "STRING"
                                    }
                                  },
                                  {
                                    "key": "broadcast_height",
                                    "value": {
                                      "string_value": "2160",
                                      "type": "STRING"
                                    }
                                  },
                                  {
                                    "key": "broadcast_thumbnail_original",
                                    "value": {
                                      "image_value": {
                                        "height": 2160,
                                        "url": "https://pbs.twimg.com/card_img/2127074066561658880/usBRZHge?format=jpg&name=orig",
                                        "width": 3840
                                      },
                                      "type": "IMAGE"
                                    }
                                  },
                                  {
                                    "key": "broadcaster_username",
                                    "value": {
                                      "string_value": "NASA",
                                      "type": "STRING"
                                    }
                                  },
                                  {
                                    "key": "broadcast_media_key",
                                    "value": {
                                      "string_value": "28_2127061519821144064",
                                      "type": "STRING"
                                    }
                                  },
                                  {
                                    "key": "broadcast_thumbnail_x_large",
                                    "value": {
                                      "image_value": {
                                        "height": 1152,
                                        "url": "https://pbs.twimg.com/card_img/2127074066561658880/usBRZHge?format=png&name=2048x2048_2_exp",
                                        "width": 2048
                                      },
                                      "type": "IMAGE"
                                    }
                                  },
                                  {
                                    "key": "broadcaster_display_name",
                                    "value": {
                                      "string_value": "NASA",
                                      "type": "STRING"
                                    }
                                  },
                                  {
                                    "key": "broadcast_is_high_latency",
                                    "value": {
                                      "boolean_value": true,
                                      "type": "BOOLEAN"
                                    }
                                  },
                                  {
                                    "key": "broadcast_thumbnail",
                                    "value": {
                                      "image_value": {
                                        "height": 314,
                                        "url": "https://pbs.twimg.com/card_img/2127074066561658880/usBRZHge?format=jpg&name=600x314",
                                        "width": 600
                                      },
                                      "type": "IMAGE"
                                    }
                                  },
                                  {
                                    "key": "broadcast_thumbnail_color",
                                    "value": {
                                      "image_color_value": {
                                        "palette": [
                                          {
                                            "percentage": 92.96,
                                            "rgb": {
                                              "blue": 30,
                                              "green": 31,
                                              "red": 30
                                            }
                                          },
                                          {
                                            "percentage": 4.49,
                                            "rgb": {
                                              "blue": 150,
                                              "green": 54,
                                              "red": 18
                                            }
                                          },
                                          {
                                            "percentage": 0.66,
                                            "rgb": {
                                              "blue": 211,
                                              "green": 197,
                                              "red": 196
                                            }
                                          },
                                          {
                                            "percentage": 0.46,
                                            "rgb": {
                                              "blue": 81,
                                              "green": 41,
                                              "red": 22
                                            }
                                          },
                                          {
                                            "percentage": 0.22,
                                            "rgb": {
                                              "blue": 59,
                                              "green": 18,
                                              "red": 190
                                            }
                                          }
                                        ]
                                      },
                                      "type": "IMAGE_COLOR"
                                    }
                                  },
                                  {
                                    "key": "broadcast_media_id",
                                    "value": {
                                      "string_value": "2127061519821144064",
                                      "type": "STRING"
                                    }
                                  },
                                  {
                                    "key": "card_url",
                                    "value": {
                                      "scribe_key": "card_url",
                                      "string_value": "https://t.co/7PSFsymg4N",
                                      "type": "STRING"
                                    }
                                  },
                                  {
                                    "key": "broadcast_thumbnail_large",
                                    "value": {
                                      "image_value": {
                                        "height": 419,
                                        "url": "https://pbs.twimg.com/card_img/2127074066561658880/usBRZHge?format=jpg&name=800x419",
                                        "width": 800
                                      },
                                      "type": "IMAGE"
                                    }
                                  }
                                ],
                                "card_platform": {
                                  "platform": {
                                    "audience": {
                                      "name": "production"
                                    },
                                    "device": {
                                      "name": "Swift",
                                      "version": "12"
                                    }
                                  }
                                },
                                "name": "745291183405076480:broadcast",
                                "url": "https://t.co/7PSFsymg4N",
                                "user_refs_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",

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.