DEV Community

Cover image for Twitter Scraper API Without Harsh Rate Limits
XCROP
XCROP

Posted on Originally published at xcrop.io

Twitter Scraper API Without Harsh Rate Limits

The Rate Limit Problem

If you've ever built anything on the Twitter API, you've hit the wall. The dreaded 429 Too Many Requests response that kills your data pipeline, stalls your bot, and leaves you staring at a retry timer

Here's what the official X API charges in 2026. Since February 2026 it is pay-per-use, and the flat Basic ($200/month) and Pro ($5,000/month) subscriptions that older guides describe are legacy plans:

Item Official X API
Post read $0.005 per post returned ($5 per 1,000)
User read $0.010 per user returned ($10 per 1,000)
Free monthly allowance None
Monthly cap 3 million post reads per billing cycle, above that Enterprise only
Enterprise No public price, 2023 reports put it at $42,000/month and up

Per-endpoint rate limits still apply, and the legacy plans were known for tight ones (roughly 15 requests per 15 minutes on Basic read endpoints). But if you're building a Twitter scraper API integration, a monitoring dashboard, or any tool that needs to pull data at scale, the per-post bill is the wall you hit first

Why Traditional Scraping Breaks

Many developers turn to direct scraping as a workaround. Build a headless browser, parse the HTML, extract the data. But Twitter has invested heavily in anti-scraping measures:

  • Login walls: most data requires authentication
  • Dynamic rendering: content loaded via JavaScript, not in the initial HTML
  • Fingerprinting: browser fingerprint detection blocks automated tools
  • IP bans: aggressive rate limiting at the IP level
  • DOM changes: class names and structure change frequently, breaking selectors

Maintaining a custom Twitter scraper API is a full-time job. Every time Twitter updates their frontend, your scraper breaks. Every time they tighten fingerprinting, you need new evasion techniques

A Better Model: Credit-Based Access

XCROP takes a fundamentally different approach. Instead of rigid per-endpoint rate limits, we use a credit-based system where you pay for the data you consume, not the requests you make

How Credits Work

Each API response costs credits based on the amount of data returned:

Data Type Credit Cost
User profile 18 per profile
Batch user lookup (POST /users/batch) 1 per user returned (10 per call minimum)
Tweet / search result 15 per result
Follower / following entry 1 per result
Trending topics 100 per call (flat)
Write operations 100 per operation
Minimum per call 10 credits

A Pro plan ($9.90/month, or $95.04/yr if you pay yearly) gives you 2,000,000 credits. That's roughly:

  • 133,000 tweets from search or timeline endpoints (15 credits each)
  • 111,000 single profile lookups (18 credits each), or about 2,000,000 users through batch lookup (1 credit each)
  • 20,000 trending topic requests
  • Or any combination

Rate Limits That Don't Strangle You

Instead of 15 requests per 15 minutes, XCROP rate limits are per-minute and much more generous:

XCROP Plan Rate Limit Max Throughput
Starter (free) 60 req/min rate-limit ceiling only; 10,000 credits/mo is the real cap
Basic ($4.90/mo or $47.04/yr) 300 req/min up to 300,000 results/min
Pro ($9.90/mo or $95.04/yr) 600 req/min up to 600,000 results/min
Pay as You Go 300 req/min up to 300,000 results/min

Every plan returns up to 1,000 results per request. There's no per-tier cap on page size, so you paginate with a cursor to pull as much as you need. Plans differ in monthly credits, price per credit, and how many requests per minute you can fire

Compare that to the official API, where 1,000 results cost about $5. On XCROP Pro the same 1,000 tweets cost roughly $0.07 (about 67 times less) and you get up to 600 requests per minute

High-Volume Data Collection in Practice

Let's walk through real scenarios where XCROP's model shines

Scenario 1: Collecting a User's Full Tweet History

async function collectAllTweets(username) {
  const API_KEY = process.env.XCROP_API_KEY;
  const baseUrl = "https://xcrop.io/api/v2/users/" + username + "/tweets";
  let allTweets = [];
  let cursor = null;

  while (true) {
    const params = new URLSearchParams({ count: "50" });
    if (cursor) params.set("cursor", cursor);

    const res = await fetch(baseUrl + "?" + params.toString(), {
      headers: { "Authorization": "Bearer " + API_KEY }
    });

    const { data, meta } = await res.json();
    allTweets.push(...data);

    console.log("Fetched " + allTweets.length + " tweets so far...");

    if (!meta.has_next_page || !meta.next_cursor) break;
    cursor = meta.next_cursor;
  }

  return allTweets;
}

// Every plan allows up to 1,000 results/req; at 50 per page and
// Pro's 600 req/min that's up to 30,000 tweets per minute.
// A user with 10,000 tweets is ~200 requests, well inside one minute of budget
const tweets = await collectAllTweets("VitalikButerin");
console.log("Total: " + tweets.length + " tweets");
Enter fullscreen mode Exit fullscreen mode

On the official API those 10,000 tweets are billed at $0.005 each, about $50, against roughly $0.74 on XCROP Pro (15 credits per tweet)

Scenario 2: Batch User Lookup

Need to look up 500 users at once? The official API makes you do them one by one (or 100 per request on the Pro plan). XCROP's batch endpoint handles this efficiently:

import requests
import os

API_KEY = os.environ["XCROP_API_KEY"]
headers = {"Authorization": "Bearer " + API_KEY}

# 500 usernames to look up
usernames = ["elonmusk", "VitalikButerin", "caboronSBF", ...]  # 500 total

# XCROP batch endpoint - 100 per request, so 5 requests total
for i in range(0, len(usernames), 100):
    batch = usernames[i:i+100]
    response = requests.post(
        "https://xcrop.io/api/v2/users/batch",
        headers=headers,
        json={"usernames": batch}
    )

    users = response.json()["data"]
    for user in users:
        print(user["username"] + ": " + str(user["followers"]) + " followers")

# Total: 5 API calls, ~500 credits (500 x 1)
# Official X API: 500 profile reads at $0.010 each = $5.00
Enter fullscreen mode Exit fullscreen mode

Scenario 3: Real-Time Search Monitoring

Monitor a keyword continuously and collect every matching tweet:

async function monitorKeyword(keyword, intervalMs = 5000) {
  const API_KEY = process.env.XCROP_API_KEY;
  const seen = new Set();

  console.log("Monitoring: " + keyword);

  setInterval(async () => {
    const res = await fetch("https://xcrop.io/api/v2/search", {
      method: "POST",
      headers: {
        "Authorization": "Bearer " + API_KEY,
        "Content-Type": "application/json"
      },
      body: JSON.stringify({
        query: keyword,
        sort: "latest",
        count: 20
      })
    });

    const { data } = await res.json();

    for (const tweet of data) {
      if (!seen.has(tweet.id)) {
        seen.add(tweet.id);
        console.log("[NEW] @" + tweet.author.username + ": " + tweet.text.slice(0, 80));
        // Process new tweet - store in DB, trigger alert, etc.
      }
    }
  }, intervalMs);
}

// Poll every 5 seconds = 12 req/min
// Well within Pro plan's 600 req/min limit
monitorKeyword("$BTC");
Enter fullscreen mode Exit fullscreen mode

Try doing this on the official API at $0.005 per post: a busy keyword polled every few seconds returns the same posts again and again, and each read is billed

Handling Pagination Efficiently

Every list endpoint in XCROP supports cursor-based pagination. Here's a reusable pattern:

import requests
import os

def paginate(url, params=None, max_pages=10, method="GET"):
    """Generic paginator for any XCROP list endpoint.

    GET endpoints take query params; POST endpoints (/v2/search,
    /v2/search/users) take the same fields as a JSON body.
    """
    headers = {"Authorization": "Bearer " + os.environ["XCROP_API_KEY"]}
    all_data = []
    cursor = None

    for page in range(max_pages):
        req_params = dict(params or {})
        if cursor:
            req_params["cursor"] = cursor

        if method == "POST":
            response = requests.post(url, headers=headers, json=req_params)
        else:
            response = requests.get(url, headers=headers, params=req_params)
        result = response.json()

        if "data" in result:
            all_data.extend(result["data"])

        meta = result.get("meta", {})
        cursor = meta.get("next_cursor")

        if not meta.get("has_next_page") or not cursor:
            break

    return all_data

# Usage examples:
followers = paginate(
    "https://xcrop.io/api/v2/users/elonmusk/followers",
    params={"count": 50},
    max_pages=20
)

search_results = paginate(
    "https://xcrop.io/api/v2/search",
    params={"query": "crypto", "count": 50, "sort": "latest"},
    max_pages=5,
    method="POST"
)
Enter fullscreen mode Exit fullscreen mode

Rate Limit Headers

XCROP returns X-RateLimit-Remaining (requests left in the current minute) on data responses, and a 429 also carries X-RateLimit-Limit and X-RateLimit-Remaining: 0, so you can pace requests before and after hitting the limit. Credit balance is in the Dashboard Usage tab, and free over the API at GET /v2/account/credits. The backoff and adaptive-throttling pattern is the same one used for X's own headers; see Twitter/X API Rate Limits in 2026 for the full walkthrough if you need it

Choosing the Right Plan for High-Volume Use

Use Case Recommended Plan Why
Side project / prototyping Starter (free) 10,000 credits to test the API
Single-user monitoring bot Pro ($9.90/mo) 600 req/min, 2M credits
Multi-account analytics Pro + top-up packs 600 req/min, additional credit packs available
Production data pipeline Pro + Pay as You Go packs 600 req/min plus never-expiring top-up credits for burst capacity

The Takeaway

Building a Twitter scraper API from scratch is fragile, expensive, and a constant maintenance burden. The official Twitter API charges $5 per 1,000 posts and caps reads at 3 million per billing cycle, which makes high-volume data collection expensive and, beyond the cap, Enterprise only

XCROP's credit-based model gives you predictable costs, generous rate limits, and clean endpoints that return complete data without the complexity of field selection or OAuth token management. If you need to scrape Twitter data at scale without rate limit headaches, it's the pragmatic choice

Get started with 10,000 free credits at xcrop.io, no credit card required


Originally published on the XCROP blog.

Top comments (0)