Skip to main content
This guide walks you through retrieving followers and following lists, and managing follows.
PrerequisitesBefore you begin, you’ll need:
  • A developer account with an approved App
  • Your App’s Bearer Token (for lookups)
  • User Access Token (for managing follows)

Get a user’s followers

Retrieve the list of users following a specific user:
cURL
curl "https://api.x.com/2/users/2244994945/followers?\
user.fields=username,verified,public_metrics&\
max_results=100" \
  -H "Authorization: Bearer $BEARER_TOKEN"

Response

{
  "data": [
    {
      "id": "1234567890",
      "name": "Developer",
      "username": "dev_user",
      "verified": false,
      "public_metrics": {
        "followers_count": 500,
        "following_count": 200,
        "tweet_count": 1500
      }
    }
  ],
  "meta": {
    "result_count": 1,
    "next_token": "abc123"
  }
}

Get who a user follows

Retrieve the list of users that a specific user follows:
cURL
curl "https://api.x.com/2/users/2244994945/following?\
user.fields=username,verified&\
max_results=100" \
  -H "Authorization: Bearer $BEARER_TOKEN"

Follow a user

Follow a user on behalf of the authenticated user:
cURL
curl -X POST "https://api.x.com/2/users/123456789/following" \
  -H "Authorization: Bearer $USER_ACCESS_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"target_user_id": "2244994945"}'

Response

{
  "data": {
    "following": true,
    "pending_follow": false
  }
}
If the target account is protected, pending_follow will be true until the follow request is approved.

Unfollow a user

Unfollow a user on behalf of the authenticated user:
cURL
curl -X DELETE "https://api.x.com/2/users/123456789/following/2244994945" \
  -H "Authorization: Bearer $USER_ACCESS_TOKEN"

Response

{
  "data": {
    "following": false
  }
}

Common parameters

ParameterDescription
max_resultsResults per page (1-1000, default 100)
pagination_tokenToken for next page
user.fieldsAdditional user fields
expansionsRelated objects to include

Next steps