Yes. X's API lists an account's followers and the accounts it follows, up to 1,000 per request, and charges $0.010 for each follower returned, so 1,000 followers cost $10 and 10,000 cost $100. Your own account's followers cost $0.001 each. ToolzerHub lists followers 200 per call at 3 credits, and the script below exports them to CSV.
What X's API returns and charges
X lists followers with GET /2/users/{id}/followers and the accounts a user follows with GET /2/users/{id}/following, as described in its followers reference. Both take max_results from 1 to 1,000 and a pagination_token.
| Item | Value |
|---|---|
| Followers path | /2/users/{id}/followers |
| Following path | /2/users/{id}/following |
| Per request | 1 to 1,000 |
| Rate limit | 300 per 15 minutes |
| Price | $0.010 per follower |
| Your own list | $0.001 per follower |
X bills per resource returned, and the same follower read twice in a day is charged once. The id in the path is numeric, so from a handle you first look the user up, which costs $0.010. Your own account's list costs a tenth of the price, but only when the id matches the authenticated user who owns the developer app.
X's API is the better pick for your own account's followers, for anything that writes, such as following or posting, and for a contract with X. It also returns 1,000 per request against our 200.
Get followers and following with ToolzerHub
We make ToolzerHub. Our X API lists followers by handle: GET /v1/x/profile/followers and GET /v1/x/profile/followings cost 3 credits per call and take a cursor. /v1/x/profile costs 1 credit and returns followers_count. /v1/x/profile/verified-followers costs 1 credit and takes a numeric user_id.
Each follower page holds 200 profiles with has_more and a cursor. A profile has 20 fields, among them id, handle, name, followers_count, following_count, created_at and protected. Over 1,000 SymPy follower rows, 638 had a description, 505 a location and 289 a website, and 134 were marked protected.
How deep the list goes
On small accounts the followers list ended within about 1% of the profile count. On GitHub and NASA it was still going when we stopped at our own page caps, so we can't say where a large list ends.
| Account | Profile count | Rows read | Pages | End |
|---|---|---|---|---|
| SymPy | 4,327 | 4,299 | 22 | reached |
| Tidelift | 2,886 | 2,870 | 15 | reached |
| MathJax | 2,358 | 2,338 | 12 | reached |
| Astropy | 4,199 | 4,169 | 21 | reached |
| GitHub | about 2.72M | 20,000 | 100 | not reached |
| NASA | about 92.3M | 5,000 | 25 | not reached |
"Reached" means has_more turned false. Every id was unique within each run, with no repeated cursor. The following lists matched their profile counts exactly: SymPy 96, Tidelift 858.
Export followers to CSV in Python
The script takes handles, a page cap and followers, following or both. It follows the cursor, de-duplicates by account id and writes eight columns.
import csv
import os
import sys
import time
import requests
BASE = "https://api.toolzerhub.com/v1/x/profile"
HEADERS = {"x-api-key": os.environ.get("TOOLZERHUB_API_KEY", "")}
FIELDS = ["account", "list", "id", "handle", "name", "followers_count", "following_count",
"created_at"]
PATH = {"followers": "followers", "following": "followings"}
calls = 0
BAD = object() # marks a 400, so the run can tell "skipped" from "empty"
def cell(value):
# Spreadsheets run text that starts with = + - or @ as a formula; an apostrophe keeps it text.
if isinstance(value, str) and value[:1] in ("=", "+", "-", "@", "\t", "\r"):
return "'" + value
return value
def get(kind, params, tries=5):
# 429 and 503 are retryable; the wait comes from the error body or the Retry-After header.
global calls
for attempt in range(tries):
r = requests.get(f"{BASE}/{PATH[kind]}", headers=HEADERS, params=params, timeout=90)
calls += 1
if r.status_code == 400: # malformed handle: skip it, keep the rest of the run
print("bad request:", r.json()["error"]["message"].splitlines()[0])
return BAD
if r.status_code not in (429, 503) or attempt == tries - 1:
r.raise_for_status()
return r.json().get("data") # None when there is nothing to return
try:
wait = r.json()["error"]["details"]["retryAfter"]
except (ValueError, KeyError, TypeError):
wait = None
try:
wait = int(wait or r.headers.get("Retry-After") or 5 * (attempt + 1))
except ValueError:
wait = 5 * (attempt + 1)
time.sleep(min(wait, 60))
def export_list(writer, account, kind, max_pages):
params, seen, pages = {"handle": account}, set(), 0
while pages < max_pages:
data = get(kind, params)
if data is BAD:
return 0
if not data or not data.get("profiles"):
break # null data, a protected or unknown account, or an empty list
pages += 1
for u in data["profiles"]:
if u["id"] in seen: # keep one row per account id
continue
seen.add(u["id"])
writer.writerow({
"account": account, "list": kind, "id": u["id"], "handle": cell(u.get("handle")),
"name": cell((u.get("name") or "").replace("\n", " ")),
"followers_count": u.get("followers_count"),
"following_count": u.get("following_count"),
"created_at": u.get("created_at"),
})
if not data.get("has_more") or not data.get("cursor"):
break
params["cursor"] = data["cursor"]
time.sleep(0.2)
stop = "" if pages else " (nothing returned: unknown, protected or follows no one)"
print(f"{account} {kind}: {len(seen)} accounts, {pages} pages{stop}")
return len(seen)
def main(accounts, max_pages="5", which="followers", out="x_followers.csv"):
kinds = ["followers", "following"] if which == "both" else [which]
total = 0
with open(out, "w", newline="", encoding="utf-8") as f:
writer = csv.DictWriter(f, fieldnames=FIELDS)
writer.writeheader()
for account in [a.strip().lstrip("@") for a in accounts.split(",") if a.strip()]:
for kind in kinds:
total += export_list(writer, account, kind, int(max_pages))
print(f"wrote {total} rows to {out} in {calls} calls")
if __name__ == "__main__":
if len(sys.argv) < 2 or (len(sys.argv) > 3 and sys.argv[3] not in ("followers", "following", "both")):
sys.exit("usage: python x_followers.py tidelift,sympy [max_pages]"
" [followers|following|both] [file.csv]")
if not HEADERS["x-api-key"]:
sys.exit("set TOOLZERHUB_API_KEY first")
main(*sys.argv[1:])
export TOOLZERHUB_API_KEY=your_key
python x_followers.py tidelift,sympy 30 both x_followers.csv
The output:
tidelift followers: 2870 accounts, 15 pages
tidelift following: 858 accounts, 5 pages
sympy followers: 4299 accounts, 22 pages
sympy following: 96 accounts, 1 pages
wrote 8123 rows to x_followers.csv in 43 calls
What 1,000 and 10,000 followers cost
1,000 followers are 5 pages at 3 credits, or 15 credits. The run above made 43 calls, 129 credits, and GitHub's 20,000 followers took 100 pages, 300 credits.
| Job | X, other account | ToolzerHub |
|---|---|---|
| 1,000 followers | $10.00 | 15 credits |
| 10,000 followers | $100.00 | 150 credits |
| Your own 1,000 | $1.00 | 15 credits |
| Numeric id from a handle | $0.010 | 1 credit |
You get 100 free credits a month; $19 buys 10,000 credits that never expire, and plans for higher volume cover bigger lists. Set your key and run the script on your first account.
For X's other prices and free credits, see is the Twitter API free; for an account's posts, see Twitter API get user tweets. For another platform where the official API stops short of a list, see Instagram API get followers list.
We are not affiliated with X Corp.