This example calls GET /twitter/replies/post through x_post_replies to read replies under one public X post. You pass the post id and how many replies to return.
It is a single post's reply list. The reply ledger example is different: that one reads the replies an account itself has posted.
The problem
The replies under one post are the conversation about that post. Copying them out means scrolling, and a keyword in the reply text is easy to miss once the list is long.
What the app does
- Takes a post id and a count.
- Returns the replies Desearch sent back for that post.
- Prints the result. Each reply can include text, counts, time and a URL.
How it works
The file calls x_post_replies with post_id and count. It calls GET /twitter/replies/post. The comment in the file also lists query on the method. This call does not pass query. It returns up to count replies; older posts may return fewer.
API details
Verified against the live OpenAPI specification on 2026-11-25. These are schema fields, not a captured run.
The code passes post_id="1276418907968925696" and count=10. The route requires post_id; count accepts 1 to 100 and defaults to 10. Although the SDK comment mentions query, this example supplies neither a text query nor a cursor.
The array response uses TwitterScraperTweet. This trimmed schema shows the reply text, timestamp and two counts named in the saved agent prompt:
Replies arrive newest first and are a best-effort sample for large threads. When another page may exist, the API supplies x-desearch-next-cursor in the response headers. Send that value unchanged as cursor with the same other parameters; it is valid for 24 hours. This single-call example does not follow it, so its output is the returned page rather than a complete thread export.
API reference: GET /twitter/replies/post. Related walkthrough: Read an account timeline in Python.
The code
Set DESEARCH_API_KEY in your environment to your API key. Do not commit a real key. Replace the sample post id with a real public id.
Endpoints
GET /twitter/replies/post
Example output
The script prints the response. The file does not include a saved sample run or a measured cost.
Run it yourself
The file linked above is twitter_replies_post.py in the examples repository. Install desearch-py 1.2.1, create a key at console.desearch.ai, and call x_post_replies with a post id and a count.
What it costs
This example does not record X-Desearch-Cost-Usd. Current responses include that header. See pricing.
Ideas to extend it
- Write the replies to a CSV with the post id on every row.
- Sort the returned replies by like count.
- Pair this with the quote ledger when a launch post has both quotes and replies.
