Skip to content
cheapxapi

Export Twitter followers to CSV with an API.

Ask a followers endpoint for the account’s screen name. Each request returns up to 100 followers with their profiles and a cursor for the next page. Pass the cursor back until there are no more pages, and write each page to the CSV. In our test, @astro_lawler’s 563 followers took 6 requests, which cost $0.0036.

On the official X API, the endpoint is GET /2/users/:id/followers. It charges $0.010 per follower returned, so 100,000 followers cost $1,000.

The export script.

Set USER to the account and run it. The script writes one row per follower to astro_lawler_followers.csv and stops when has_next_page is false. We ran both versions on @astro_lawler:

  • Five pages of 100 and a last page of 63: 563 followers from 6 requests. Bios with line breaks stay inside their row: reading the file back gave 563 rows.
  • No follower came back twice. The scripts keep a set of IDs in case one does.
  • MAX_PAGES caps the bill: at 50 pages, the script stops after 5,000 followers, or $0.03. Raise it for a bigger account.

Python needs pip install requests. Save the Node.js version as followers.mjs; it needs Node 18 or later. Both read your key from CHEAPXAPI_KEY. More on pacing: rate limits and 429s.

import csv, os, time, requests

API = "https://api.cheapxapi.com/twitter/user/followers"
HEADERS = {"x-api-key": os.environ["CHEAPXAPI_KEY"]}
USER = "astro_lawler"  # screen name without the @
MAX_PAGES = 50  # 100 followers a page, one billed request each, so this caps the bill
PAUSE = 0.5     # 2 requests a second; 0.1 after your first top-up
FIELDS = ["id", "userName", "name", "followers_count", "following_count", "statuses_count",
          "protected", "created_at", "location", "description", "url"]

cursor, pages, seen = None, 0, set()
# utf-8-sig adds a byte-order mark, so Excel shows emoji and non-Latin names correctly
with open(f"{USER}_followers.csv", "w", newline="", encoding="utf-8-sig") as f:
    out = csv.DictWriter(f, fieldnames=FIELDS, extrasaction="ignore")
    out.writeheader()
    while pages < MAX_PAGES:
        params = {"userName": USER}
        if cursor:
            params["cursor"] = cursor
        res = requests.get(API, headers=HEADERS, params=params, timeout=75)
        if res.status_code == 429:  # not billed; wait and ask for the same page again
            time.sleep(int(res.headers.get("retry-after", "1")))
            continue
        res.raise_for_status()
        page = res.json()
        pages += 1
        for user in page["followers"]:
            if user["id"] not in seen:
                seen.add(user["id"])
                out.writerow(user)
        print(f"page {pages}: {len(page['followers'])} followers, {len(seen)} unique so far")
        if not page["has_next_page"] or not page["next_cursor"]:
            break
        cursor = page["next_cursor"]
        time.sleep(PAUSE)
print(f"{len(seen)} followers from {pages} requests")

The request and the response.

On cheapxapi, Get followers takes userName, an optional cursor and pageSize (20 to 100). Every follower arrives as a full profile, so you don’t need a second call per account.

On the official API you need a developer account and a Bearer token (how to get one). The endpoint takes the numeric user ID, not the screen name. You list the profile fields you want in user.fields and send meta.next_token back as pagination_token for the next page.

cheapxapi request

curl "https://api.cheapxapi.com/twitter/user/followers?userName=astro_lawler" \
  -H "x-api-key: $CHEAPXAPI_KEY"

Response, captured from the live API

{
  "followers": [
    {
      "id": "11348282",
      "name": "NASA",
      "userName": "NASA",
      "location": "Pale Blue Dot",
      "url": "https://t.co/9NkQJKAnuU",
      "description": "Making the seemingly impossible, possible. ✨",
      "protected": false,
      "followers_count": 92086899,
      "following_count": 115,
      "favourites_count": 17125,
      "statuses_count": 74587,
      "created_at": "Wed Dec 19 20:20:32 +0000 2007",
      "profile_image_url_https": "https://pbs.twimg.com/profile_images/1321163587679784960/0ZxKlEKB_normal.jpg"
    }
  ],
  "has_next_page": true,
  "next_cursor": "1844293810891913678",
  "status": "success",
  "msg": "success",
  "code": 0
}

Trimmed to one of 100 followers and the main fields. NASA follows @astro_lawler, so it turned up on page 5.

Official X API, from X’s docs (not run by us)

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

Full profiles or IDs.

If you only need to know who follows an account, take the IDs. A request returns 200 of them, so the same list costs half as much. On @astro_lawler, the ID list took 3 requests and returned 566 IDs. That matched the 566 on the profile. The full-profile pages returned 563.

To track new followers and unfollows, save the ID list every day and compare it with the day before. Fetch profiles only for the new IDs.

Follower IDs, captured from the live API

curl "https://api.cheapxapi.com/twitter/user/followers_ids?userName=astro_lawler" \
  -H "x-api-key: $CHEAPXAPI_KEY"

Trimmed to 3 of 200 IDs. The endpoint takes userName or userId.

Swipe the table to see what each endpoint is for.

cheapxapi follower endpoints, what each returns and what it is for
EndpointReturnsUse it for
Get followers100 full profiles per requestA spreadsheet of who follows an account, with bios, locations and follower counts.
Get follower IDs200 numeric IDs per requestCounting, de-duplicating, or a daily snapshot to compare for new followers and unfollows.
Get verified followersVerified followers only, by numeric user IDThe verified accounts among the followers, without paging the full list.
Get followings100 full profiles per requestThe other direction: the accounts the user follows.

Each of these endpoints costs $0.0006 per request. Need a numeric ID for a screen name? Use the Twitter ID finder.

What an export costs.

X bills each follower it returns. cheapxapi bills each request, and a request carries 100 profiles or 200 IDs. That gap grows with the account: a million followers cost $10,000 on X’s list price.

X charges $0.001 per follower when you read your own account’s followers through your own app. X also says it normally won’t charge twice for the same follower in one UTC day.

Swipe the table to see larger accounts.

List price of exporting followers by account size
Followers1,00010,000100,0001,000,000
cheapxapi, full profiles$0.006$0.06$0.60$6.00
cheapxapi, IDs only$0.003$0.03$0.30$3.00
Official X API, your own account$1.00$10.00$100.00$1,000.00
Official X API, any other account$10.00$100.00$1,000.00$10,000.00
List price of 100,000 followers with profiles at other providers
Other providers100,000 followers
twitterapis.com$1.14
GetXAPINot published
SocialData$20.00
Sorsa$199 monthly planNot published
Apify Tweet Scraper V2Not published

List prices. X’s figures are from its developer pricing page; the other providers’ are from their own pricing pages, with sources in our comparison. cheapxapi assumes full pages at $0.0006 a request; see pricing.

Get your API key

Questions.

How do I export someone’s Twitter followers to CSV?

Call a followers endpoint with their screen name, write each page of followers to the file, and pass next_cursor back as cursor until has_next_page is false. The Python and Node.js scripts on this page do that. Our test exported 563 followers in 6 requests.

Does the X API have a followers endpoint?

Yes. GET /2/users/{id}/followers takes a numeric user ID and returns up to 1,000 users per request. You page with pagination_token, using the next_token from meta. GET /2/users/{id}/following does the same for the accounts the user follows. Both need an approved developer account and an app.

How much does it cost to export 100,000 followers?

On the official X API, $1,000: X charges $0.010 per follower returned, or $0.001 if it is your own account. On cheapxapi, 1,000 requests at $0.0006 each, which is $0.60 with full profiles, or $0.30 for IDs only.

How many followers does one request return?

On cheapxapi, up to 100 followers with profiles (pageSize goes from 20 to 100) or 200 follower IDs. On the official API, set max_results anywhere from 1 to 1,000.

Why does my export have fewer rows than the follower count?

In our test, the profile showed 566 followers and the ID list returned 566, but the full-profile pages returned 563. A few accounts can be missing from the profile pages, so if you need every follower, take the ID list as the full set.

Do I need an X developer account?

For the official API, yes: X asks for an approved developer account, a project and an app, and its keys and tokens. cheapxapi needs only its own API key, sent in the x-api-key header.