Blog/Developer Tools/

Reddit Community Monitoring API Workflow | SandBase

A Reddit community monitoring API workflow: size a subreddit, discover topic conversations, and profile authors — one SandBase key, no OAuth app.

Dark cinematic render of a subreddit resolving into topic search results and author profile signals feeding an agent core

Community monitoring on Reddit boils down to three questions: how big is this community, what are people saying about my topic, and who is saying it? This tutorial wires those three questions into one Reddit community monitoring API workflow using the SandBase Reddit API — no Reddit OAuth app of your own and no PRAW, though you still need a SandBase API key. The endpoint reference only guarantees the response envelope (id, status, model, outputs[0].data); the business fields shown below are an illustrative structure, not a guaranteed schema, so treat both the field names and the values as examples and confirm them against a live response.

If you want the full endpoint tour first, start with the Reddit public data API hub. This piece is the applied workflow.

Key takeaway

  • Three steps: subreddit-info (baseline) → dynamic-search (discovery) → user-profile (author signal).
  • Every call is POST /v1/api/reddit/<path> with one SANDBASE_API_KEY; responses share the { id, status, model, outputs } envelope.
  • In the illustrative shapes, Reddit payloads nest under named keys (subredditInfoByName, redditorInfoByName) — read the exact path and confirm it against a live response.
  • Only the envelope (id, status, model, outputs[0].data) is guaranteed; the business fields are illustrative — confirm them against a live response.
  • Public, read-only data only; no Reddit OAuth app of your own and no posting or voting, but you do need a SandBase API key.

The workflow at a glance

StepEndpointInputYou get
1. Size the communityreddit/app/subreddit-infosubreddit_namesubscribers, type, description
2. Discover conversationsreddit/app/dynamic-searchquerysearch results for a topic
3. Profile the authorreddit/app/user-profileusernamekarma breakdown, account flags

SandBase Reddit endpoint reference showing the community and user endpoints used in this workflow The endpoint API reference is the source of truth for each parameter name and response path.

Step 1 — Size the community

Before you monitor a community, establish a baseline: how large and active is it? Resolve the subreddit by name:

import os
import requests

BASE = "https://api.sandbase.ai/v1/api/reddit"
HEADERS = {
    "Authorization": f"Bearer {os.environ['SANDBASE_API_KEY']}",
    "Content-Type": "application/json",
}


def call(path: str, payload: dict) -> dict:
    resp = requests.post(f"{BASE}/{path}", headers=HEADERS, json=payload, timeout=90)
    resp.raise_for_status()
    body = resp.json()
    if body.get("status") != "completed":
        raise RuntimeError(body.get("error", {}).get("message", "request did not complete"))
    return body["outputs"][0]["data"]


info = call("app/subreddit-info", {"subreddit_name": "programming"}).get("subredditInfoByName", {})
print(info.get("name"), info.get("subscribersCount"), info.get("type"))
# example output: programming 6922588 PUBLIC

Note the nesting in this illustrative shape: the payload sits under subredditInfoByName, with fields such as name, subscribersCount, and type. Only the envelope is guaranteed, so the code reads defensively with .get() rather than assuming those keys are present. The values above are illustrative — a subreddit read can surface a subscriber count, a type, and a community id, but confirm the exact field names and values against a live response, since the business fields are not a guaranteed schema. Store that baseline so later runs can track subscriber growth over time.

Step 2 — Discover topic conversations

With a baseline set, search for conversations about your topic. dynamic-search takes a query (your search keyword) plus, per the reference, independent optional parameters: a sort_type to order results and an after cursor that you carry over from the previous response to fetch the next page:

results = call("app/dynamic-search", {"query": "machine learning"})
# results is a structured search layout — read the schema and inspect
# a real response to map the exact field paths before iterating;
# to page, pass the `after` cursor from the previous response

The dynamic-search response is a structured layout rather than a flat list, and only the envelope is guaranteed — its exact business shape is not fully documented in the public reference. Run one real request with the query and any optional sort_type you need, inspect the response, and map the field paths you actually use — do not assume a single call returns both posts and communities.

SandBase Reddit dynamic-search API reference showing the query parameter and response schema dynamic-search returns a structured layout under the search key — read the schema before iterating.

Step 3 — Profile the authors

Once you have surfaced conversations, profile the accounts behind them to weight their signal. user-profile takes a username:

user = call("app/user-profile", {"username": "spez"}).get("redditorInfoByName", {})
karma = user.get("karma", {})
print(user.get("name"), karma.get("total"), "total karma")
# example output: spez 940980 total karma
print("employee:", user.get("isEmployee"))
# example output: employee: True

Again note the nesting under redditorInfoByName in this illustrative shape. A user read can surface a karma object with fields such as fromPosts, fromComments, and total, plus account flags like isEmployee. Only the envelope is guaranteed, so the code uses .get() rather than assuming those keys are present. Treat karma and account age as optional ranking or filtering signals — they are context, not a verified measure of credibility or expertise. The block below is an illustrative response shape: the business fields are not a guaranteed schema, so treat both the field names and the values as examples and confirm the exact fields against a live response, since payloads vary and change over time.

{
  "id": "a98dfb8b-afa5-4471-9f91-33cadaca5d99",
  "status": "completed",
  "model": "reddit/app/user-profile",
  "outputs": [
    {
      "data": {
        "redditorInfoByName": {
          "name": "spez",
          "id": "t2_1w72",
          "isEmployee": true,
          "karma": { "fromPosts": 184487, "fromComments": 756493, "total": 940980 }
        }
      }
    }
  ]
}

SandBase Reddit user-profile API reference showing the username parameter and response schema user-profile returns karma and account flags under redditorInfoByName.

Putting it together

A minimal monitoring pass looks like this. It reads every business field with .get(), since only the envelope is guaranteed and the illustrative fields may be absent or nested differently in a live response:

# 1. Baseline the community you monitor
baseline = call("app/subreddit-info", {"subreddit_name": "programming"}).get("subredditInfoByName", {})
record = {"subreddit": baseline.get("name"), "subscribers": baseline.get("subscribersCount")}

# 2. Find conversations about your topic
hits = call("app/dynamic-search", {"query": "machine learning"})
# inspect a real response and extract author usernames per the schema

# 3. Attach karma/account context to each author
for username in extract_usernames(hits):
    user = call("app/user-profile", {"username": username}).get("redditorInfoByName", {})
    record.setdefault("authors", []).append({
        "name": user.get("name"),
        "karma": user.get("karma", {}).get("total"),
        "employee": user.get("isEmployee", False),
    })

Because every call shares the same envelope and the same call helper, adding retries or rate-limit backoff is a one-place change. When you need more than these three reads, check the live Reddit listing for the endpoint that fits and confirm its parameters before wiring it in.

Handling the rough edges

  • Mind the nesting. In these illustrative shapes, Reddit payloads sit under named keys (subredditInfoByName, redditorInfoByName). Only the envelope is guaranteed, so read the exact path defensively rather than assuming top-level fields.
  • Inspect dynamic-search before iterating. Its layout is structured, not a flat list, and the public reference does not fully document the business fields — map the field paths from a real response, page via the after cursor, and set sort_type if you need a specific order.
  • Branch on status. A failed or timeout run carries error and no outputs. The call helper already enforces this.
  • Respect rate limits. Handle HTTP 429 with backoff and pace your polling.
  • Public data only. No Reddit OAuth app of your own, no voting or posting, and no private-community access — though you do authenticate every call with a SandBase API key.

Why run monitoring at the API layer

You could open a browser tab and skim a subreddit by hand, but that does not scale and it does not give you structured data to trend. Running the same three calls on a schedule turns qualitative browsing into a measurable signal: subscriber counts you can chart week over week, topic hits you can dedupe and cluster, and author karma you can use as an optional ranking signal. The workflow collects public conversation data; deriving sentiment is a separate analysis step you run on top of it. Because the calls return named JSON fields, you can store each pass in a table and diff it against the last one — the growth, the new voices, the shift in what a community talks about.

The same uniform envelope also makes the workflow composable. Swap programming for any community, swap the query for any topic, and the code path is identical. Add a fourth call — post-comments on a specific thread, say — and it slots in behind the same call helper with the same error handling. That is the practical payoff of a single-key, single-shape API for monitoring work: you spend your time on what the signal means, not on keeping a scraper alive.

FAQ

Do I need a Reddit OAuth app or account? No. You authenticate to SandBase with your SANDBASE_API_KEY. These read endpoints need no Reddit OAuth app, no PRAW, and no account on your side.

How do I page through results and comments? dynamic-search takes an optional after cursor request parameter you carry over from the previous request, and post-comments accepts an after cursor plus a sort_type to order the thread. Inspect one real response for the field you read the next after value from, since the layout is structured rather than a flat list.

Can I read private or account-only data? No. The workflow is public, read-only data — subreddit stats, search results, and public profile fields. There is no voting, posting, or access to private communities.

Next steps

You now have a repeatable community-monitoring workflow built on three public, read-only calls. From here you can schedule it to track subscriber growth over time and feed the collected conversation data into a separate sentiment or ranking step.