GetXAPI
Users

Follow User

Follow a user on Twitter/X programmatically via API. $0.001 per call. GetXAPI follow user endpoint with username or user_id targeting.

POST/twitter/user/follow

This endpoint costs $0.001 per API call.

Follows a user on behalf of the auth_token owner. Identify the target by either user_id or username.

Request Body

FieldTypeRequiredDescription
auth_tokenstringYesUser's auth token
user_idstringConditionalNumeric id of the account to follow. Provide either user_id or username
usernamestringConditionalHandle (without @) of the account to follow. Provide either user_id or username
proxystringNoProxy URL (http://, https://, socks5://, or socks4://)

Provide one of user_id or username.

Notes

  • Idempotent — following an already-followed account succeeds without error.
  • For protected accounts, the follow is queued: the response returns followRequestSent: true and following: false until the owner approves.

Response (200)

{
  "status": "success",
  "msg": "User followed successfully",
  "data": {
    "userId": "11348282",
    "userName": "NASA",
    "name": "NASA",
    "following": true,
    "followRequestSent": false,
    "protected": false
  }
}

Error Responses

400 - Missing target

{
  "error": "Provide user_id or username of the account to follow"
}

404 - User not found

{
  "error": "User not found"
}

Examples

curl -X POST "https://api.getxapi.com/twitter/user/follow" \
  -H "Authorization: Bearer API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "auth_token": "your_auth_token",
    "username": "nasa"
  }'
const response = await fetch("https://api.getxapi.com/twitter/user/follow", {
  method: "POST",
  headers: {
    Authorization: "Bearer API_KEY",
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    auth_token: "your_auth_token",
    username: "nasa",
  }),
});
const data = await response.json();
console.log(data.data);
import requests

response = requests.post(
    "https://api.getxapi.com/twitter/user/follow",
    headers={"Authorization": "Bearer API_KEY"},
    json={
        "auth_token": "your_auth_token",
        "username": "nasa",
    },
)
print(response.json()["data"])

Follow by user_id

curl -X POST "https://api.getxapi.com/twitter/user/follow" \
  -H "Authorization: Bearer API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "auth_token": "your_auth_token",
    "user_id": "11348282"
  }'

On this page