Get Tweets by User ID

GET

Get tweets posted by a specific user ID

GET /api/v1/twitter/users/tweets_by_user_id/:userId

Authorization

X-API-Key
string
required

Parameters

NameTypeRequiredDescription
userIdstring
required
The Twitter user ID
maxTweetsnumber
optional
Maximum number of tweets to fetch (default: 10, max: 100)
Default: 10
cursorstring
optional
Pagination cursor for fetching next page of results

Example Request

curl -X GET \
"https://api.xscraper.xyz/api/v1/twitter/users/tweets_by_user_id/44196397?maxTweets=10" \
-H "X-API-Key: "

Response

User Tweets
application/json
{
  "data": {
    "tweets": [
      {
        "id": "1722715025402413077",
        "text": "This is a sample tweet",
        "username": "elonmusk",
        "name": "Elon Musk",
        "userId": "44196397",
        "likes": 50000,
        "replies": 5000,
        "retweets": 10000,
        "views": 2000000,
        "timeParsed": "2025-04-18T15:30:00.000Z",
        "hashtags": ["sample", "tweet"],
        "mentions": [],
        "photos": [],
        "videos": [],
        "urls": [],
        "isReply": false,
        "isRetweet": false,
        "isQuoted": false
      }
    ],
    "next": "cursor_token_for_next_page"
  },
  "meta": {
    "statusCode": 200,
    "timestamp": "2025-04-19T15:49:28.824Z"
  }
}

Error Responses

401 Unauthorized
{
  "statusCode": 401,
  "timestamp": "2025-04-19T15:49:28.824Z",
  "path": "/api/v1/twitter/users/tweets_by_user_id/44196397",
  "method": "GET",
  "message": "Invalid or expired API key"
}
404 Not Found
{
  "statusCode": 404,
  "timestamp": "2025-04-19T15:49:28.824Z",
  "path": "/api/v1/twitter/users/tweets_by_user_id/nonexistentid",
  "method": "GET",
  "message": "User not found"
}