LogoAIDIR Docs

User Tweets and Replies

API for getting Twitter user's tweets and replies

User Tweets and Replies

Get both original tweets and replies posted by a specific Twitter user.

Request

URL: /api/twitter/user-tweets-replies

Method: GET or POST

Request Parameters:

ParameterTypeRequiredDescription
restIdstringYesUser's unique ID identifier

Response

A successful response will return a list of the user's tweets and replies in reverse chronological order, including tweet content, creation time, reply relationships, and other detailed information.

Examples

Request Example

# GET request
curl --request GET \
  --url 'https://www.aidir.fun/api/twitter/user-tweets-replies?restId=44196397' \
  --header 'X-API-Key: <api-key>'
 
# POST request
curl --request POST \
  --url 'https://www.aidir.fun/api/twitter/user-tweets-replies' \
  --header 'Content-Type: application/json' \
  --header 'X-API-Key: <api-key>' \
  --data '{
    "restId": "44196397"
  }'

Response Example

{
  "data": {
    "user": {
      "id": "44196397",
      "rest_id": "44196397",
      "name": "Elon Musk",
      "screen_name": "elonmusk"
    },
    "timeline": {
      "instructions": [
        {
          "entries": [
            {
              "content": {
                "tweet": {
                  "id": "1512345678901234567",
                  "text": "This is an original tweet",
                  "created_at": "2023-04-15T14:34:12.000Z",
                  "favorite_count": 12345,
                  "retweet_count": 6789,
                  "reply_count": 1234,
                  "quote_count": 567
                }
              }
            },
            {
              "content": {
                "tweet": {
                  "id": "1512345678901234568",
                  "text": "This is a reply to someone else's tweet",
                  "created_at": "2023-04-15T13:45:23.000Z",
                  "favorite_count": 5432,
                  "retweet_count": 987,
                  "reply_count": 654,
                  "quote_count": 321,
                  "in_reply_to_status_id": "1512345678901234000",
                  "in_reply_to_user_id": "9876543210",
                  "in_reply_to_screen_name": "someuser"
                }
              }
            }
          ]
        }
      ]
    }
  }
}

Error Responses

Status CodeDescription
400Request parameter error, e.g., missing required restId parameter
401Authentication failed, API key invalid or missing
404User does not exist or has no tweets
500Internal server error

Difference from User Tweets API

  • User Tweets API (/api/twitter/user-tweets) only returns the user's original tweets
  • User Tweets and Replies API (/api/twitter/user-tweets-replies) returns all content posted by the user, including original tweets and replies to other tweets

Notes

  • For very active users, this API may return a large amount of data
  • Reply-type tweets will contain additional metadata indicating what they are replying to

Table of Contents