Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.x.com/llms.txt

Use this file to discover all available pages before exploring further.

The Follows endpoints let you follow and unfollow users, and retrieve follower and following lists for any user.

Overview

Follow

Follow a user on behalf of the authenticated user

Unfollow

Unfollow a user

Followers

Get a user’s followers

Following

Get who a user follows

Endpoints

Follows lookup

MethodEndpointDescription
GET/2/users/:id/followersGet a user’s followers
GET/2/users/:id/followingGet who a user follows

Manage follows

MethodEndpointDescription
POST/2/users/:id/followingFollow a user
DELETE/2/users/:source_user_id/following/:target_user_idUnfollow a user

Example: Get followers

curl "https://api.x.com/2/users/2244994945/followers?\
user.fields=username,verified,public_metrics" \
  -H "Authorization: Bearer $BEARER_TOKEN"

Example: Follow a user

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"}'

Getting started

Prerequisites

Quickstart

Get started with follows

API Reference

Full endpoint documentation

Sample code

Working code examples