twitterapi.io is an independent third-party service. Not affiliated with X Corp.

Blogtwitter counter

Twitter (X) Counter API — A Developer's Guide to Follower Counts

By Sarah Wong5 min read

A Twitter (X) counter — most often the follower count — is the headline number on every profile. Tracking it programmatically is a foundational developer task: building a follower-growth dashboard, monitoring an account for milestones, computing growth rate over time, or benchmarking against competitors.

This guide walks the API paths to pull the four public counter fields (followers / following / listed / tweet) in 2026, runnable Python for daily snapshot workflow, and per-call cost from each provider's published pricing page. Pricing references are URL-cited so you can verify.

01 — Section

What 'counter' actually means on an X profile

Every X profile carries four public counter fields. All are visible on the UI and returned by both API paths:

- followers_count — accounts following the user (the most commonly tracked counter)

- following_count — accounts the user follows

- listed_count — public lists that include the user

- tweet_count — lifetime tweet/post count (excludes retweets in some return shapes)

Some provider responses also include verified, description, pinned_tweet_id, created_at. The exact fields you get back depend on which user.fields you request in the call.

02 — Section

Path 1 — twitterapi.io `/twitter/user/info`

twitterapi.io exposes profile reads at https://api.twitterapi.io/twitter/user/info with userName as the query parameter. Auth is X-API-Key header. Pricing per twitterapi.io/pricing: $0.00018 per returned profile.

Pick this when you need counter tracking at scale — multi-account dashboards, daily refresh workflows, competitive benchmarking. Per-call cost compounds favorably for read-heavy workloads.

python
import os, requests

HEADERS = {"X-API-Key": os.environ["TWITTERAPI_IO_KEY"]}
BASE = "https://api.twitterapi.io"

def get_counters(username: str) -> dict:
    """GET /twitter/user/info — return counter fields only."""
    r = requests.get(
        f"{BASE}/twitter/user/info",
        headers=HEADERS,
        params={"userName": username},
        timeout=10,
    )
    r.raise_for_status()
    p = r.json()
    return {
        "username": username,
        "followers": p.get("followers_count"),
        "following": p.get("following_count"),
        "listed": p.get("listed_count"),
        "tweets": p.get("tweet_count"),
    }

print(get_counters("twitterapi_io"))
03 — Section

Path 2 — X official `/2/users/by/username`

X's official path is /2/users/by/username/{username} with user.fields=public_metrics. xdk and Tweepy both wrap this endpoint. Pricing per docs.x.com/x-api/getting-started/pricing: $0.010 per profile read, with 24-hour UTC dedup window.

Pick this when you're already on the X bill for other workflows; marginal counter-read cost rides on the same auth. The 24h dedup helps if you re-poll the same accounts repeatedly within the day.

python
# pip install tweepy
import tweepy

client = tweepy.Client(bearer_token="YOUR_X_BEARER")

resp = client.get_user(
    username="twitterapi_io",
    user_fields=["public_metrics"],
)
user = resp.data
pm = user.public_metrics
print({
    "followers": pm["followers_count"],
    "following": pm["following_count"],
    "listed":    pm["listed_count"],
    "tweets":    pm["tweet_count"],
})
04 — Section

Tracking counters over time — daily snapshot pattern

The interesting analytics signal isn't the current counter — it's the delta. Daily growth rate, weekly trend, comparison against peers. Build this by snapshotting counters and persisting with timestamps:

Storage shape: (username, captured_at, followers, following, listed, tweets) — a simple row layout in Postgres / SQLite / a JSONL file.

Cadence: daily is sufficient for most counter analytics (X counters update in near-real-time but the operationally interesting signal is on the order of days). Hourly is overkill for steady-state tracking; useful only around milestones.

Storage cap: at daily cadence, 365 rows per tracked account per year — small. 1,000 accounts × 365 days = 365K rows, well within SQLite's comfort zone.

Compute metrics: delta per day, rolling 7-day / 30-day average, milestone alerts (passes 10K / 100K / 1M followers).

05 — Section

Side-by-side comparison — 2 paths, 5 dimensions

Same job (pull counter values for a profile) framed across the two paths. Costs are derived from each provider's published pricing.

Dimensiontwitterapi.ioX official
Per-profile cost$0.00018 (twitterapi.io/pricing)$0.010 (docs.x.com)
Authsign up, X-API-Key headerX Developer account + bearer
Librarynonexdk or tweepy
24h UTC dedupno — re-reads re-billedyes — same profile in same UTC day = 1 charge
Best forbulk counter tracking, daily snapshotsalready-on-X-bill workloads

Three practical patterns: (a) per-profile cost ratio compounds — at any non-trivial volume the twitterapi.io path is materially cheaper; (b) X official's 24h UTC dedup helps re-polling workloads on the same day; (c) most production teams build counter tracking around daily snapshots, which fits twitterapi.io's per-call rate well.

06 — Section

Batch counters — tracking many accounts efficiently

Batch lookup: both providers support multiple lookups per call. twitterapi.io's /twitter/user/batch_info_by_ids returns multiple profiles by ID in one call; X official's /2/users accepts up to 100 IDs or usernames per call. Use larger batches to reduce HTTP overhead.

Rate handling: 429s happen. Wrap each call with retry-on-429 + jittered backoff. Treat 5xx the same way.

Cost model at scale: 10K tracked accounts daily via twitterapi.io = 10,000 × $0.00018 = $1.80/day = ~$54/mo. Same workload via X official = $100/day = ~$3,000/mo. The ratio dominates the bill at this scale.

07 — Section

Picking a path — the decision rule

Tracking counters for many accounts on a per-call budget? → twitterapi.io. Per-profile cost compounds favorably at any meaningful volume.

Already paying X for credits because you write or read tweets? → use X official; marginal counter-read cost rides on the same auth + bill.

One-off counter snapshot for a single account? → either works at single-call cost (cents).

Most production analytics teams pair the two: twitterapi.io for the broad batch-refresh layer + X official for any compound read+write workflow that needs unified auth.

python
# Practical example: track follower counter growth for N accounts, daily snapshots, weekly delta.
import os, requests, json
from datetime import datetime, timezone, timedelta

HEADERS = {"X-API-Key": os.environ["TWITTERAPI_IO_KEY"]}
BASE = "https://api.twitterapi.io"

def snapshot_counters(username: str) -> dict:
    r = requests.get(
        f"{BASE}/twitter/user/info",
        headers=HEADERS,
        params={"userName": username},
        timeout=10,
    )
    r.raise_for_status()
    p = r.json()
    return {
        "username": username,
        "captured_at": datetime.now(timezone.utc).isoformat(),
        "followers": p.get("followers_count"),
        "following": p.get("following_count"),
        "listed": p.get("listed_count"),
        "tweets": p.get("tweet_count"),
    }

TRACKED = ["twitterapi_io", "elonmusk", "sama", "karpathy"]
with open("counters.jsonl", "a") as f:
    for u in TRACKED:
        snap = snapshot_counters(u)
        f.write(json.dumps(snap) + "\n")
        print(f"{u}: {snap['followers']} followers")

# Cost framing (math from cited pricing):
#   4 profiles × $0.00018 = $0.00072 per snapshot — well under a penny
#   Daily × 30 days = $0.0216/mo — basically free at this scale
#   1,000 tracked accounts daily: 1,000 × 30 × $0.00018 = $5.40/mo
#   Same workload via X official: 1,000 × 30 × $0.010 = $300/mo (~55x more)
08 — Questions

Questions readers ask

Is `tweet_count` total tweets or just original posts?

Conventionally tweet_count includes original tweets but excludes retweets in most return shapes. The exact semantics depend on the provider's surface — check each provider's docs for the precise definition of the field, especially around quoted-tweets and replies.

How fresh are counter values?

X counters update in near-real-time on the platform and propagate to the read APIs quickly. Both twitterapi.io and X official return current state at call time. For sub-second precision validate against the live x.com UI; exact propagation latency can vary in the seconds after a new follow/unfollow.

Can I get historical counter values (past follower counts)?

No — both APIs return current state only. There is no time-series of past counter values available via the read APIs. For historical data you capture snapshots yourself; daily snapshots build a clean longitudinal dataset that you can query for growth rate, milestones, etc.

What's a good polling cadence for counter tracking?

Daily is sufficient for most use cases (counters change steadily, not by the second). Hourly is overkill for steady-state monitoring. Around milestone events (close to 100K, viral moment) hourly or 15-min cadence catches the moment more precisely; pay only for the burst.

How does cost scale to 1,000 tracked accounts daily?

Math from cited pricing pages. twitterapi.io: 1,000 × $0.00018 = $0.18/day = ~$5.40/mo. X official: 1,000 × $0.010 = $10/day = ~$300/mo. The 24h UTC dedup helps X official cost if you re-poll the same accounts on the same day, but for a single daily snapshot the ratio is the full ~55×.

Can I track counters for accounts I don't follow?

Yes — counter fields are public and any read-API call returns them. Following relationship doesn't affect access. Locked / protected accounts return restricted profile data; their counters are still public on most providers.

09 — Further reading

Continue

Sources & further reading
More from this series
Build it

Stop reading. Start building.

Starter credits cover real testing on real data. Google sign-in, no card, no application queue.

Get an API key
    Twitter (X) Counter API — Follower Counts | TwitterAPI.io