Get the account ID
Follower routes use the numeric X user ID. Resolve the username once and save its ID.
curl "https://twitterxapi.com/api/v1/users/marclou?level=moderate" \
-H "Authorization: Bearer $TWITTERXAPI_KEY"{
"id": "2311987360",
"username": "marclou",
"followersCount": 382499,
"followingCount": 1246,
"statusesCount": 36756,
"verified": false
}Fetch the first follower page
The response contains an items array plus pagination.next_cursor and pagination.has_more.
curl "https://twitterxapi.com/api/v1/users/by-id/2311987360/followers?level=moderate" \
-H "Authorization: Bearer $TWITTERXAPI_KEY"{
"items": ["..."],
"count": 20,
"pagination": {
"next_cursor": "DAABCgAB...",
"has_more": true
}
}Download every follower with Python
This loop writes newline delimited JSON as each page arrives. Memory use stays flat even for large accounts.
import json, os, requests
base = "https://twitterxapi.com/api/v1"
headers = {"Authorization": f"Bearer {os.environ['TWITTERXAPI_KEY']}"}
profile = requests.get(f"{base}/users/marclou", headers=headers).json()
cursor = None
with open("followers.ndjson", "w") as output:
while True:
params = {"level": "moderate"}
if cursor: params["cursor"] = cursor
r = requests.get(f"{base}/users/by-id/{profile['id']}/followers", headers=headers, params=params, timeout=60)
r.raise_for_status()
page = r.json()
for follower in page["items"]:
output.write(json.dumps(follower) + "\n")
cursor = page["pagination"]["next_cursor"]
if not page["pagination"]["has_more"] or not cursor: breakSave CSV without losing the source data
Keep NDJSON as the master export. Convert selected fields to CSV after the download. Save the last successful cursor after every page if you need restart support.
Private accounts stay private. TwitterXAPI only reads public X data.
COMMON QUESTIONS
Frequently asked questions
Can I download followers from a public X account?+
Yes. Resolve the account ID and continue through follower pages until has_more is false.
Can I export Twitter followers to CSV?+
Yes. Download NDJSON first, then select the columns you want for CSV.
Does this work for private accounts?+
No. The API does not bypass private account controls.
TRY THE API
Make the first request today.
One key covers REST and MCP. Add credit when you need it.
Get an API key