GET /twitter/user/last_tweets

Changed on

Retrieve tweets by user name.Sort by created_at. Results are paginated, with each page returning up to 20 tweets.If you only need to fetch the latest tweets from a single user very frequently, do not use this API—it will cost you a lot. Instead, please refer to https://twitterapi.io/blog/how-to-monitor-twitter-accounts-for-new-tweets-in-real-time. If you have more than 20 Twitter accounts requiring real-time tweet updates, use https://twitterapi.io/twitter-stream which is the most cost-effective solution. This endpoint is built on X search. If X hides an account from search results (this happens to some accounts, for example ones that mostly retweet promotional content), it returns an empty list even though the profile has tweets. In that case use /twitter/user/tweet_timeline, which reads the profile timeline directly.

Request

  • Base URL
    https://api.twitterapi.io
  • URL
    https://api.twitterapi.io/twitter/user/last_tweets
  • Auth
    API key in header X-API-Key

Query parameters

userIdstring string

user id of the user.userId is recommended, could be more stable and faster than userName.userId and userName are mutually exclusive. If both are provided, userId will be used.

userNamestring string

screen name of the user.userId and userName are mutually exclusive. If both are provided, userId will be used.

cursorstring string

The cursor to paginate through the results. First page is "".

includeRepliesboolean

Whether to include replies in the results. Default is False.

Response

Tweets response

status'success' | 'error' required

Status of the request: success or error

codeinteger

0 on success

msgstring

Message of the request (error message on failure)

has_next_pageboolean required

Indicates if there are more results available (top level, not inside data)

next_cursorstring required

Cursor for fetching the next page of results (top level, not inside data)

Changes

    • breaking

      removed the required property from the response with the status

    • breaking

      removed the required property from the response with the status

    • info

      added the optional property to the response with the status

    • info

      added the optional property to the response with the status

    • info

      added the required property to the response with the status