Blog / API guides

Reddit Scraper or API: What You Get

A Reddit scraper is code that loads subreddit listings, search pages and threads, then pulls titles, scores, comment counts and timestamps out of what comes back. You maintain the fetching, the parsing, the paging and the monitoring. The other route is 14 Reddit endpoints on Perceptlayer that return the same kind of data as JSON at 1 credit per successful call. This post compares the two on a recorded search, prices tracking subreddits and topics, and gives a verdict per use case.

What would a Reddit scraper have to handle?

A Reddit scraper has to do three things on a schedule: fetch the listing, search and thread pages you care about, turn each one into rows with stable fields, and tell you when either step starts failing. Each is code you write once and then repair whenever the pages it depends on change. None of the pieces is hard on its own; the cost is that all of them are ongoing.

The fetcher decides what to request and how often. For topic or brand work that means search pages per keyword, listing pages per subreddit and sort order, and then follow-up requests for threads that matter. It needs pacing, retries with backoff, and a plan for pages that respond slowly or not at all.

The parser is where most upkeep lands. It has to find each post's identifier, title, community, score, comment count and timestamp, and it has to keep finding them after the page layout changes. A broken parser rarely throws an error. It returns empty strings or zeros, which look like a quiet day.

The monitor closes that gap: row counts per run, null rates per field, and alerts when a subreddit that usually yields dozens of posts yields none. Before you build any collector, read the site's terms, and if your traffic gets blocked or challenged, stop rather than work around it. Threads Scraper or API covers the same trade-off for another social source.

What do the Reddit endpoints cover?

The Reddit API on Perceptlayer has 14 endpoints, all GET, all 1 credit per successful call, all on the standard tier. They split into community and topic endpoints, single-item lookups, and endpoints keyed on an account. For subreddit, topic and brand tracking, the first two groups are the ones you need.

Endpoint What it's for Required Optional
GET /v1/reddit/search-posts Posts matching a query query sort, t, subreddit, nsfw, after, limit
GET /v1/reddit/subreddit-posts Posts in one subreddit subreddit sort, t, after, limit
GET /v1/reddit/subreddit One subreddit subreddit rules
GET /v1/reddit/search-subreddits Subreddits matching a query query after, limit
GET /v1/reddit/popular The popular or best feed none feed, sort, t, after, limit
GET /v1/reddit/domain Results for a domain name domain sort, t, after, limit
GET /v1/reddit/post One post id none
GET /v1/reddit/oembed Embed data for a URL url none
GET /v1/reddit/autocomplete Suggestions for a typed query query limit, nsfw

The remaining five are keyed on an account rather than a topic: search-users (query, after, limit), user-profile (username), and user-posts, user-comments and user-overview (each username, with sort, t, after, limit). This post sticks to aggregate data and doesn't use them.

The documented values for sorting differ by endpoint. search-posts takes sort as one of relevance, hot, top, new or comments; subreddit-posts and popular take hot, new, top, rising or controversial; domain takes hot, new or top. The time window t is one of hour, day, week, month, year or all wherever it appears. Defaults and page sizes aren't documented, so set sort, t and limit explicitly in scheduled jobs.

What does a recorded search return?

A search call returns the query context, a posts array with named, typed fields, and a pagination block with a cursor. The recorded call searched for openai, sorted by top, over the past week, with limit=10. Each post arrives as an object you can store as a row without any parsing of your own.

curl "https://api.perceptlayer.com/v1/reddit/search-posts?query=openai&sort=top&t=week&limit=10" \
  -H "X-API-Key: $API_KEY"

This is the recorded response, trimmed to one post and the fields an aggregate tracker keeps (account fields removed):

{
  "success": true,
  "data": {
    "query": "openai",
    "sort": "top",
    "time": "week",
    "posts": [
      {
        "id": "1xtu7qr",
        "fullname": "t3_1xtu7qr",
        "title": "What a poor soul..",
        …
        "subreddit": "memes",
        "subreddit_id": "t5_2qjpg",
        "subreddit_subscribers": 36169974,
        "permalink": "https://www.reddit.com/r/memes/comments/1xtu7qr/what_a_poor_soul/",
        "domain": "i.redd.it",
        "post_type": "image",
        "score": 31390,
        "upvote_ratio": 0.97,
        "num_comments": 107,
        "num_crossposts": 3,
        …
        "created_at": "2026-11-11T21:27:52+00:00",
        "created_utc": 1794432472,
        "over_18": false,
        "stickied": false,
        "locked": false,
        …
      },
      …
    ],
    "pagination": {
      "limit": 10,
      "next_after": "t3_1xtzobg",
      "has_more": true
    }
  },
  "meta": {
    "endpoint_family": "search_posts",
    "credits_charged": 1,
    …
  }
}

Three details matter for a tracker. First, the top weekly results for openai in this recording were image posts in memes and SipsTea, so a broad keyword search returns whatever matches, not only on-topic discussion; add subreddit to scope a search to the communities you watch. Second, the response carries both created_at (ISO 8601) and created_utc (a Unix timestamp), so you don't have to convert. Third, the endpoint takes an after parameter and the response returns pagination.next_after with has_more; the names match, so try passing next_after as after in the playground before you build paging on it.

Some fields are optional per post. The second recorded post carries a flair object that the first one doesn't, so treat anything beyond the fields shown above as possibly absent.

How do a scraper and the endpoints compare?

A scraper costs engineering time and carries terms and blocking risk; the endpoints cost credits per call and remove the parsing and upkeep. Neither is free. The table compares them for a recurring job, such as tracking a set of subreddits and brand keywords every day.

DIY Reddit scraper Reddit endpoints
Setup Fetcher, parsers for listings and threads, storage, monitoring API key in the X-API-Key header
What you get Whatever you can parse from each page posts[] with id, title, subreddit, score, upvote_ratio, num_comments, created_at, permalink and more
When pages change Your parser breaks, often silently You read named JSON fields; there's no parser of yours to fix
Blocks and challenges Yours to handle Not yours to handle; a failed call returns an error code and costs 0
Paging Follow the site's pages after parameter, next_after and has_more in the response
Speed As fast as you can fetch without being blocked 1 request a second free, at least 5 a second paid
Cost Hosting and your time 1 credit per successful call
Freshness Whatever the page showed when you fetched it Returned as found at the time of the call

What does a subreddit, topic or thread cost to track?

On the endpoints, cost follows calls, not posts. One subreddit-posts or search-posts call returns a page of posts at whatever limit you set, for 1 credit. So the bill is the number of subreddits, keywords and threads you check, times how often, times the pages you read each time.

Plan Arithmetic Credits a month
25 subreddits, sort=new, one page a day 25 × 30 days × 1 credit 750
10 brand keywords, t=day, one page a day 10 × 30 days × 1 credit 300
25 subreddits, one page every hour 25 × 24 × 30 days × 1 credit 18,000
200 threads re-checked 4 times a day with post 200 × 4 × 30 days × 1 credit 24,000

The 100 free credits on signup cover the first 4 days of the first plan. The first two plans together come to 1,050 credits a month, so the Starter pack's 10,000 credits last about nine months. The hourly plan and the thread re-checks each fit the Build pack's 50,000 credits for two months. Purchased credits last 12 months, with no subscription. See pricing for what credits cost and the credits docs for how debits work.

How do you track a topic in code?

A topic tracker is a loop over keyword and subreddit pairs: one search-posts call each, a row per post keyed on id, and a pause between calls. The script below reads only fields that appear in the recorded search-posts response, so it runs against the endpoint as recorded. Swap in your own keywords and communities, and keep sort and t fixed so each day's rows compare with the last.

import csv
import datetime
import os
import time

import requests

API_KEY = os.environ["API_KEY"]
URL = "https://api.perceptlayer.com/v1/reddit/search-posts"
WATCH = [
    {"query": "web scraping api", "subreddit": "webscraping"},
    {"query": "pandas", "subreddit": "dataengineering"},
]
FIELDS = ["id", "subreddit", "title", "score", "upvote_ratio",
          "num_comments", "created_at", "permalink"]


def fetch(params, attempts=3):
    for _ in range(attempts):
        r = requests.get(URL, params=params,
                         headers={"X-API-Key": API_KEY}, timeout=60)
        if r.status_code in (429, 503):
            time.sleep(int(r.headers.get("Retry-After", "5")))
            continue
        r.raise_for_status()
        return r.json()
    raise RuntimeError(f"gave up on {params['query']}")


today = datetime.date.today().isoformat()
with open("mentions.csv", "a", newline="") as f:
    out = csv.writer(f)
    for watch in WATCH:
        params = dict(watch, sort="new", t="day", limit=25)
        body = fetch(params)
        for post in body.get("data", {}).get("posts", []):
            out.writerow([today, watch["query"]]
                         + [post.get(k, "") for k in FIELDS])
        time.sleep(1)

The script keeps no account fields, and one row per post per day lets you chart score and num_comments over time. The one-second pause keeps it within the free tier's 1 request a second; a paying account runs at least 5 a second. Every error comes back with an HTTP status and a JSON body with code, message and request_id, and the errors docs list every code. Requests have no idempotency key, so a client timeout may hide a call that succeeded and was billed; keep the timeout generous.

Which route fits your job?

Choose by how often you need the data and how many communities or topics you watch, because that decides whether upkeep or per-call cost dominates. The verdicts below assume a recurring job. For reading a handful of threads once, open Reddit in a browser and skip both.

  • Daily tracking of a set of subreddits: use subreddit-posts with sort=new on a schedule and store rows keyed on id. At one page a day, 25 subreddits cost 750 credits a month.
  • Brand or product mentions: use search-posts with your brand as query, sort=new or t=day, and subreddit where you know the communities. Store score and num_comments over time to see which threads gain traction.
  • Watching your own site's presence: try domain with your domain name and sort=new, and check in the playground what it returns before you schedule it.
  • Finding which communities discuss a topic: run search-subreddits with the topic, then subreddit on the candidates to compare them before you add them to a tracker.
  • Re-checking known threads: call post with each thread's id and store what it returns per check; run one in the playground first to see its fields.
  • Learning how scraping works: build a scraper against a practice site, not a large social network.
  • An agent answering questions about discussion on a topic: give it the Reddit endpoints through the MCP server, as the AI agents docs describe, so it calls search-posts instead of browsing pages.

To check the fields against your own subreddits, run subreddit-posts or search-posts in the playground on the Reddit API page, then get a free API key when they fit. The social media APIs page lists other sources with the same call shape.

APIs in this post

Frequently asked questions

Is scraping Reddit allowed?

That depends on Reddit's terms, the terms on any content you store, and the law where you operate, so read the terms and get legal advice for commercial use. Don't get around blocks, challenges or other protections. Aggregate data such as post counts, scores and topics per subreddit is lower risk than data about individuals; leave account names out of anything you keep unless you have a lawful basis.

How much does a Reddit API call cost on Perceptlayer?

Every one of the 14 Reddit endpoints costs 1 credit per successful call, and one call returns a page of posts at the limit you set. A failed call costs nothing and returns X-Credits-Used: 0. Tracking 25 subreddits once a day is 25 × 30 = 750 credits a month. The pricing page lists what credit packs cost.

How do I get more than one page of results?

The recorded search-posts response returned pagination.next_after with the value t3_1xtzobg and has_more: true, and the listing endpoints take an after parameter, so the names match. Test passing next_after as after in the playground. Each extra page is another call at 1 credit, so decide how deep you read before you budget.

Can I search within one subreddit?

Yes. GET /v1/reddit/search-posts takes an optional subreddit parameter alongside query, sort, t, nsfw, after and limit. The recorded unscoped search for openai returned top weekly posts from memes and SipsTea, which shows why scoping matters for topic tracking. Each scoped search is still one call at 1 credit.

How fast can I run a Reddit tracking job?

Limits are per account, shared by all its keys, and counted per minute. A free account gets 1 request a second (60 a minute), so a 25-subreddit daily run finishes in under a minute. Paying accounts run at least 5 requests a second (300 a minute). A 429 carries Retry-After; the rate limits docs list the rate each pack includes.

  1. Threads Scraper or API: What You Get

    A DIY Threads scraper versus 8 Threads endpoints at 1 credit a call: keyword search, topic tags, brand posts, upkeep, terms and the cost per tag tracked.

  2. Facebook Scraper or API: What You Get

    A Facebook scraper vs 21 restricted Facebook endpoints at 1 credit a call: pages, events and Marketplace for brand and market work, and the cost per page.

  3. Google Images Scraper or API: What You Get

    Compare a Google Images scraper with one 1-credit call that returns position, source, link, original URL, pixel size and is_product for each result.

Start with 100 free credits

No password to set. We email you a sign-in link, and your key works on every API.

No credit card. 100 free credits on signup.