This guide walks you through retrieving followers and following lists, and managing follows. Reference for the X API v2 standard tier covering follows.
This guide walks you through retrieving followers and following lists, and managing follows.
from xdk import Clientclient = Client(bearer_token="YOUR_BEARER_TOKEN")# Get a user's followers with paginationfor page in client.users.get_followers( "2244994945", user_fields=["username", "verified", "public_metrics"], max_results=100): for user in page.data: print(f"{user.username} - Followers: {user.public_metrics.followers_count}")
import { Client } from "@xdevplatform/xdk";const client = new Client({ bearerToken: "YOUR_BEARER_TOKEN" });// Get a user's followers with paginationconst paginator = client.users.getFollowers("2244994945", { userFields: ["username", "verified", "public_metrics"], maxResults: 100,});for await (const page of paginator) { page.data?.forEach((user) => { console.log(`${user.username} - Followers: ${user.public_metrics?.followers_count}`); });}
from xdk import Clientclient = Client(bearer_token="YOUR_BEARER_TOKEN")# Get users that a user followsfor page in client.users.get_following( "2244994945", user_fields=["username", "verified"], max_results=100): for user in page.data: print(f"{user.username} - Verified: {user.verified}")
import { Client } from "@xdevplatform/xdk";const client = new Client({ bearerToken: "YOUR_BEARER_TOKEN" });// Get users that a user followsconst paginator = client.users.getFollowing("2244994945", { userFields: ["username", "verified"], maxResults: 100,});for await (const page of paginator) { page.data?.forEach((user) => { console.log(`${user.username} - Verified: ${user.verified}`); });}