Skip to content
cheapxapi

Every reply under a post, by API.

Call GET /twitter/tweet/replies?tweetId=… and follow next_cursor to the last page. Drop the post itself, which comes back too, and keep the posts whose conversationId is the post’s ID. On the official X API there is no replies endpoint: you search conversation_id:ID, and only the last 7 days unless you use full-archive search.

Expect fewer replies than the post’s reply count. A @NASA post showing 349 replies gave us 147 by every method we tried. A later run of our script saved 144 in 12 requests ($0.0072); X bills $0.005 for each reply it returns.

One page of replies.

Get tweet replies takes the post’s ID, the number after /status/ in its link, and returns up to 20 replies a request for $0.0006.

Each reply says what it answers. inReplyToId is the post or reply directly above it; conversationId is always the post that started the thread. When the two differ, the reply is an answer to another reply.

Request

curl "https://api.cheapxapi.com/twitter/tweet/replies?tweetId=2126362766818623807" \
  -H "x-api-key: $CHEAPXAPI_KEY"

Response, captured from the live API

{
  "tweets": [
    {
      "type": "tweet",
      "id": "2126926798860480903",
      "url": "https://x.com/ScienceOfMemes/status/2126926798860480903",
      "text": "@NASA We have never actually seen our own galaxy from the outside. Every portrait of the Milky Way is a cousin standing in as the profile picture.",
      "createdAt": "Sun Nov 29 06:30:39 +0000 2026",
      "likeCount": 0,
      "replyCount": 0,
      "isReply": true,
      "inReplyToId": "2126362766818623807",
      "conversationId": "2126362766818623807",
      "inReplyToUsername": "NASA"
    }
  ],
  "has_next_page": true,
  "next_cursor": "DAADDAABCgABHYUm...",
  "status": "success",
  "msg": "success"
}

One of the 20 replies on the first page, without the author object and view counts. The cursor is shortened.

Three ways in, tested on one post.

We walked each method to its last page on the same @NASA post. Its reply count said 349; all three together returned 147 distinct replies.

Replies each endpoint returned for the same post
EndpointCallReplies returnedWhat we saw
Get tweet replies/twitter/tweet/replies141 in 10 requestsReplies to replies included (27). Mostly newest first. Has sinceTime and untilTime.
Get tweet replies (sortable)/twitter/tweet/replies/v2118 in 4 requests (Relevance); 21 (Latest)Direct replies only in our runs. Up to 38 a page. Relevance also returned promoted posts.
Advanced searchconversation_id:ID126 in 8 requestsEvery one of them was also in Get tweet replies. Combines with other operators.

The reply count is not a target.

X’s replyCount was higher than anything we could retrieve: 147 of 349 on the @NASA post, 26 of 162 on another. Stop when the cursor runs out, not when you reach the count.

Two passes beat one.

The same endpoint does not return the same set every time. One pass of Get tweet replies gave 141 replies, another a few minutes later 119. The relevance-sorted endpoint found replies the first one missed, so the script runs both and merges them by ID.

Filter on conversationId.

Both endpoints return the post itself: Get tweet replies on its last page, the sortable one on its first. One relevance pass also carried two promoted posts from unrelated accounts. Remove the post by its ID, then keep only posts whose conversationId matches it.

Read to the end, then sort.

Replies come mostly newest first, but not strictly: one of the newest replies arrived at position 121 of 141. Do not stop paging at a date. For only the new ones, pass sinceTime (Unix seconds) and still dedupe by ID.

Export the replies to CSV.

Set TWEET to the post’s ID. The script pages through Get tweet replies, then through the sortable endpoint by relevance, keeps each reply once, and writes replies_ID.csv: author, date, likes, whether it is a direct or nested reply, the text and the link.

We ran both versions on the @NASA post, one after the other. Python saved 144 replies from 12 requests ($0.0072); Node.js 145 from 12 ($0.0072). The difference is the API returning a slightly different set each time.

For the replies an account posts rather than receives, search from:USER filter:replies with the search API; for everything an account posted, see the full export.

Python needs pip install requests. Save the Node.js version as export_replies.mjs; it needs Node 18 or later. Both read your key from CHEAPXAPI_KEY and pause half a second between requests, inside the free plan’s 2 a second. MAX_PAGES caps the bill.

import csv, os, time
from email.utils import parsedate_to_datetime
import requests

API = "https://api.cheapxapi.com/twitter"
HEADERS = {"x-api-key": os.environ["CHEAPXAPI_KEY"]}
TWEET = "2126362766818623807"  # the number after /status/ in the post's link
MAX_PAGES = 50                 # hard stop on billed requests, per endpoint

def walk(path, params, posts):
    """Page through one endpoint and keep every post by id. Returns the number of requests."""
    cursor, pages = None, 0
    while pages < MAX_PAGES:
        res = requests.get(f"{API}/{path}", headers=HEADERS, timeout=75,
                           params={**params, **({"cursor": cursor} if cursor else {})})
        if res.status_code == 429:  # not billed: wait and ask again
            time.sleep(int(res.headers.get("retry-after", "1")))
            continue
        res.raise_for_status()
        pages += 1
        page = res.json()
        for post in page.get("tweets", []):
            posts.setdefault(post["id"], post)
        if not page.get("has_next_page") or not page.get("next_cursor"):
            return pages
        cursor = page["next_cursor"]
        time.sleep(0.5)
    return pages

posts = {}
requests_made = walk("tweet/replies", {"tweetId": TWEET}, posts)
# A second pass sorted by relevance finds a few replies the first one leaves out.
requests_made += walk("tweet/replies/v2", {"tweetId": TWEET, "queryType": "Relevance"}, posts)

root = posts.pop(TWEET, None)  # both endpoints also return the post itself
# Keep the conversation only: the relevance pass can mix in promoted posts from other accounts.
replies = [p for p in posts.values() if p.get("conversationId") == TWEET]
replies.sort(key=lambda p: parsedate_to_datetime(p["createdAt"]), reverse=True)

with open(f"replies_{TWEET}.csv", "w", newline="", encoding="utf-8-sig") as f:
    out = csv.writer(f)
    out.writerow(["id", "created_at", "author", "kind", "in_reply_to", "likes", "replies", "text", "url"])
    for p in replies:
        kind = "direct" if p.get("inReplyToId") == TWEET else "nested"
        out.writerow([p["id"], p["createdAt"], p["author"]["userName"], kind, p.get("inReplyToId"),
                      p.get("likeCount"), p.get("replyCount"), p["text"], p["url"]])

direct = sum(p.get("inReplyToId") == TWEET for p in replies)
shown = f", the post shows replyCount {root['replyCount']}" if root else ""
print(f"{len(replies)} replies ({direct} direct, {len(replies) - direct} nested) "
      f"from {requests_made} requests{shown}")

What it costs.

cheapxapi bills each request, up to 20 replies a page. X bills $0.005 for each reply its search returns, and says it bills the same post once per UTC day.

On X, conversation_id:ID through recent search reaches back 7 days. For an older post you need full-archive search, which X lists for pay-per-use and Enterprise customers.

List price of reading replies, by number of replies
Replies1,00010,000100,000
cheapxapi$0.03$0.30$3.00
Official X API$5.00$50.00$500.00
List price of 100,000 posts at other providers
Other providers100,000 posts
cheapxapi$3.00
twitterapis.com$4.00
GetXAPI$5.00
SocialData$20.00
Sorsa$199 monthly plan$2.00
Apify Tweet Scraper V2$40.00

List prices. X’s figures are from its developer documentation and pricing page; the other providers’ are their prices for posts from search, from their own pricing pages, with sources in our comparison. cheapxapi assumes one pass with full pages of 20 at $0.0006 a request; the script’s second pass adds a few requests (12 in all for 144 replies in our run). See pricing.

Get your API key

Questions.

How do I get all replies to a tweet with an API?

Call GET /twitter/tweet/replies?tweetId=ID and pass next_cursor back until has_next_page is false. Keep the posts whose conversationId is the post's ID, and drop the post itself, which also comes back. A second pass through /twitter/tweet/replies/v2 with queryType=Relevance adds a few replies the first one leaves out. The scripts on this page do both and write a CSV.

Why do I get fewer replies than the reply count on the post?

The reply count is X's number, and it was higher than anything we could retrieve. On a post showing 349 replies, four different methods together returned 147 distinct replies; on another showing 162, we got 26. Do not use replyCount to check whether your export is complete.

How does the official X API return replies?

There is no replies endpoint. Every reply carries the conversation_id of the post that started the thread, so you search conversation_id:ID. Recent search covers only the last 7 days; older conversations need full-archive search, which X offers to pay-per-use and Enterprise customers. Each reply returned is billed as a post read at $0.005.

Does it include replies to replies?

GET /twitter/tweet/replies did: 27 of the 141 replies it returned on our test post answered another reply. In those, inReplyToId is the reply they answer and conversationId is still the original post. /replies/v2 returned only direct replies in our runs.

How do I get only the new replies since my last check?

Pass sinceTime, a Unix timestamp in seconds, to GET /twitter/tweet/replies. In our test it returned only replies posted at or after that time. Keep the IDs you already have, because the order is not strictly newest first.