LogoAIDIR Docs

Following

API for getting a Twitter user's following list

Following

Get the list of users that a specific Twitter user is following.

Request

URL: /api/twitter/following

Method: GET or POST

Request Parameters:

ParameterTypeRequiredDescription
restIdstringYesUser's unique ID identifier

Response

A successful response will return a list of users the user is following, including basic information for each user, such as username, display name, profile picture, etc.

Examples

Request Example

# GET request
curl --request GET \
  --url 'https://www.aidir.fun/api/twitter/following?restId=44196397' \
  --header 'X-API-Key: <api-key>'
 
# POST request
curl --request POST \
  --url 'https://www.aidir.fun/api/twitter/following' \
  --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"
    },
    "following": {
      "timeline": {
        "instructions": [
          {
            "entries": [
              {
                "content": {
                  "user": {
                    "id": "12345678",
                    "rest_id": "12345678",
                    "name": "Twitter User",
                    "screen_name": "twitteruser",
                    "profile_image_url": "https://pbs.twimg.com/profile_images/1234567890/avatar.jpg",
                    "description": "This is a Twitter user",
                    "followers_count": 1000,
                    "following_count": 500,
                    "verified": true
                  }
                }
              }
            ],
            "cursor": {
              "value": "HBaAgICw4OOTExPDI5MTY4OTY5MDY4NzAyMjk3MQoSAAA=",
              "cursorType": "Bottom"
            }
          }
        ]
      }
    }
  }
}

Error Responses

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

Caching

This API request supports caching. When the same restId parameter is requested multiple times within the cache validity period, the cached result will be returned without calling the Twitter API again.

Notes

  • For accounts with many following users, this API may require multiple requests to retrieve the complete list
  • Some accounts' following lists may not be fully accessible due to privacy settings

Table of Contents