Skip to content

Sentiment analysis on Reddit and X

ChatterAPI gives you the text: Reddit comments by keyword, whole threads, tweets and their replies, as JSON with authors, scores and dates. You run the sentiment model, a Python library or an LLM.

The job

Sentiment analysis needs a lot of real text about one subject, with enough context to tell sarcasm from praise. Reddit comment threads work well for this because people argue in full sentences.

Getting that text is the slow part. You search, export threads, pull replies, then clean it all. Every endpoint returns the same JSON shape, so the scoring code stays small.

How it works

  1. Collect the text

    Search comments for your subject, and pull full threads for the posts that matter.

  2. Add X

    Search tweets for the same terms and pull the replies to the ones with the most engagement.

  3. Score it

    Run each item's text through your model. Keep score and createdAt so you can weight by votes and plot by date.

Endpoints that do it

EndpointWhat it's forCredits
Search commentsGET /v1/reddit/comments/searchComments that mention your subject.2 credits
Get a thread with commentsGET /v1/reddit/threads/{id}A post and its comment tree, for context.3 credits
Search tweetsGET /v1/x/tweets/searchTweets on the subject.3 credits
List repliesGET /v1/x/tweets/{id}/repliesReplies to one tweet.3 credits

Free tools for the same job

Try the job in a browser first. These tools call the same endpoints, and you don't need a key or any code.

Comments to score

A comment search for gummysearch alternative, with each comment's text, author, score and date.

curl "https://api.chatterapi.com/v1/reddit/comments/search?q=gummysearch+alternative" \
  -H "Authorization: Bearer $CHATTERAPI_KEY"
response, first 2 rows
{
  "data": [
    {
      "id": "j01f68f",
      "fullname": "t1_j01f68f",
      "parentId": null,
      "postId": "zk2soo",
      "postTitle": "I think quite a lot of people in this subreddit ARE entrepreneurs",
      "author": "esoemah",
      "body": "I know the guy already answered your question, but I’d like to offer an alternative that you could consider as well: social listening. Basically, you’d monitor social media for any mentions of keywords relevant to your b…",
      "bodyTruncated": false,
      "score": 2,
      "subreddit": "Entrepreneur",
      "permalink": "/r/Entrepreneur/comments/zk2soo/i_think_quite_a_lot_of_people_in_this_subreddit/j01f68f/",
      "url": "https://www.reddit.com/r/Entrepreneur/comments/zk2soo/i_think_quite_a_lot_of_people_in_this_subreddit/j01f68f/",
      "createdAt": "2022-12-13T11:30:40.000Z"
    },
    {
      "id": "le642mq",
      "fullname": "t1_le642mq",
      "parentId": null,
      "postId": "1e86dz5",
      "postTitle": "[NBA] LeBron and Curry in the tunnel following the win: Lebron - \"To be honest I like those ones more than the blowouts...I like being tested baby.\" Curry - \"Put the closer on.\"",
      "author": "EyePlay",
      "body": "The sub is just bigger and Silver has turned the NBA into the social media consumed sport. Unless you want to talk hoops on twitter, reddit has become the main NBA hub over the last ten years. People who consume the NBA …",
      "bodyTruncated": false,
      "score": 6,
      "subreddit": "nba",
      "permalink": "/r/nba/comments/1e86dz5/nba_lebron_and_curry_in_the_tunnel_following_the/le642mq/",
      "url": "https://www.reddit.com/r/nba/comments/1e86dz5/nba_lebron_and_curry_in_the_tunnel_following_the/le642mq/",
      "createdAt": "2024-07-21T02:10:00.000Z"
    }
  ],
  "page": {
    "nextCursor": "AUod…",
    "hasMore": true
  }
}

Recorded from a live call on . Long text is shortened and the cursor is cut. A live key is charged 2 credits for this call. A test key returns this same sample for 0 credits.

What it won't do

  • ChatterAPI reads live Reddit and X. It does not return deleted or removed posts or comments.
  • It returns text, not sentiment scores. You do the scoring.
  • Comment search returns whatever Reddit's search matches, so check that your sample covers the time window you care about.

Questions

Does ChatterAPI score sentiment?
No. It returns the text with metadata. Run any sentiment library or an LLM on it.
How many comments can I get?
As many pages as you call. Each page is charged separately: 2 credits for a comment search and 3 for a thread.
Can I use it from Python?
Yes. It is plain HTTPS, and the example on this page has a Python tab.

Other use cases

Build it with one API key

Sign up and get 100 free credits. No card required.