# Communities and accounts (/docs/recipes/communities-and-accounts) Find the subreddits, groups and channels where a topic is discussed, then the accounts that post about it, with their latest posts Send your topic words and get back two lists. The first holds the communities where people discuss the topic. The second holds the accounts that post about it. Then read the latest posts of the accounts you keep. The example maps the home sourdough baking world. Measured on 18/11/2026: the communities run found 56 places and returned 10, for 15 credits. The accounts run returned 10 judged accounts and stopped at its cap of 40 credits. Two profiles with their latest posts cost 4. ## Start in five minutes Set your key once. Every block on this page reads it. ```bash title="Terminal" export SOCIALCRAWL_API_KEY=YOUR_API_KEY ``` Paste this prompt into your coding agent: ```text title="Prompt" Read https://www.socialcrawl.dev/docs/recipes/communities-and-accounts.md and follow it to find the communities and accounts behind sourdough baking. Use the key in SOCIALCRAWL_API_KEY. Price each call with a dry run first (dry_run=true or dry_run=1), which is free. Send max_credits=30 for the communities and max_credits=40 for the accounts, and ask me before you raise either. ``` Or price the first call yourself. A dry run plans it for 0 credits: ```bash title="cURL" curl -G "https://www.socialcrawl.dev/v1/prism/discover" \ -H "x-api-key: $SOCIALCRAWL_API_KEY" \ --data-urlencode "keywords=sourdough baking,sourdough starter" \ --data-urlencode "view=communities" \ --data-urlencode "platforms=reddit,facebook,youtube" \ --data-urlencode "limit=10" \ --data-urlencode "max_credits=30" \ --data-urlencode "dry_run=true" ``` On 18/11/2026 it quoted at most 28 credits. The run itself cost 15. ## How it works - The same topic words run twice: once to find communities, once to find accounts. - Communities are subreddits, Facebook groups and YouTube channels, each with its member count. - Accounts are the people and businesses whose posts matched, each looked up and judged. - The judgment says how well each account fits the topic and what kind of account it is. - You read the latest posts of the accounts you keep in one more call. ## What you need | Call | What it gives | Credits | | --- | --- | --- | | `GET /v1/prism/discover` with `view=communities` | Subreddits, groups and channels about the topic | Each search at its platform's price, up to `max_credits` | | `GET /v1/prism/discover` with `view=accounts` | Accounts that post about it, judged | Each search, plus looking up and judging each account, up to `max_credits` | | `POST /v1/prism/profiles` with `"include": "posts"` | Profiles and their latest posts | 1 a row, plus 1 for its posts page | ## Steps ### Step 1: the communities **cURL** ```bash title="cURL" curl -G "https://www.socialcrawl.dev/v1/prism/discover" \ -H "x-api-key: $SOCIALCRAWL_API_KEY" \ --data-urlencode "keywords=sourdough baking,sourdough starter" \ --data-urlencode "view=communities" \ --data-urlencode "platforms=reddit,facebook,youtube" \ --data-urlencode "limit=10" \ --data-urlencode "max_credits=30" ``` **Python** ```python title="Python" import json, os, urllib.parse, urllib.request params = {"keywords": "sourdough baking,sourdough starter", "view": "communities", "platforms": "reddit,facebook,youtube", "limit": "10", "max_credits": "30"} url = "https://www.socialcrawl.dev/v1/prism/discover?" + urllib.parse.urlencode(params) req = urllib.request.Request(url, headers={"x-api-key": os.environ["SOCIALCRAWL_API_KEY"]}) data = json.load(urllib.request.urlopen(req, timeout=120))["data"] for c in data["items"]: print(c["platform"], c["kind"], c["name"], c.get("members"), c["url"]) ``` - `view=communities` returns the places, not the posts. - `limit=10` returns 10 communities. `summary.communities.total` says how many were found. ```json title="Response (trimmed)" { "data": { "items": [ { "key": "reddit:subreddit:sourdough", "platform": "reddit", "kind": "subreddit", "name": "r/Sourdough", "url": "https://reddit.com/r/Sourdough", "members": 777152, "judgments": { "fit": { "p": 0.97, "basis": "community" } } } ], "summary": { "communities": { "total": 56, "by_kind": { "group": 5, "subreddit": 21, "channel": 30 } } } } } ``` The 10 returned were 5 Facebook groups, 2 subreddits and 3 YouTube channels, with 165,000 to 2,329,280 members each. Each community also carries `activity.posts_30d` where the platform publishes it. The largest Facebook group showed 10,000 posts in 30 days. ### Step 2: the accounts **cURL** ```bash title="cURL" curl -G "https://www.socialcrawl.dev/v1/prism/discover" \ -H "x-api-key: $SOCIALCRAWL_API_KEY" \ --data-urlencode "keywords=sourdough baking,sourdough starter" \ --data-urlencode "view=accounts" \ --data-urlencode "platforms=youtube,instagram,tiktok" \ --data-urlencode "limit=10" \ --data-urlencode "max_credits=40" ``` **Python** ```python title="Python" import json, os, urllib.parse, urllib.request params = {"keywords": "sourdough baking,sourdough starter", "view": "accounts", "platforms": "youtube,instagram,tiktok", "limit": "10", "max_credits": "40"} url = "https://www.socialcrawl.dev/v1/prism/discover?" + urllib.parse.urlencode(params) req = urllib.request.Request(url, headers={"x-api-key": os.environ["SOCIALCRAWL_API_KEY"]}) data = json.load(urllib.request.urlopen(req, timeout=120))["data"] for row in data["items"]: acc, j = row["account"], row["judgments"] print(acc["key"], acc.get("followers"), j.get("account_kind"), (j.get("fit") or {}).get("p")) ``` - Each account carries `judgments.fit`, a score from 0 to 1, and `judgments.account_kind`, such as `individual_creator` or `brand_or_business`. - `evidence` lists the posts that put the account on the list. - Judging each account is the largest part of the price. Price it with a dry run first. ### Step 3: the latest posts of the accounts you keep **cURL** ```bash title="cURL" curl -X POST "https://www.socialcrawl.dev/v1/prism/profiles" \ -H "x-api-key: $SOCIALCRAWL_API_KEY" \ -H "content-type: application/json" \ -d '{"items":[{"platform":"youtube","handle":"GrantBakes"},{"platform":"tiktok","handle":"wheatculture"}],"include":"posts"}' ``` **Python** ```python title="Python" import json, os, urllib.request body = {"items": [{"platform": "youtube", "handle": "GrantBakes"}, {"platform": "tiktok", "handle": "wheatculture"}], "include": "posts"} req = urllib.request.Request("https://www.socialcrawl.dev/v1/prism/profiles", data=json.dumps(body).encode(), headers={"x-api-key": os.environ["SOCIALCRAWL_API_KEY"], "content-type": "application/json"}) data = json.load(urllib.request.urlopen(req, timeout=120))["data"] for row in data["results"]: if row["status"] == "ok": posts = (row.get("posts") or {}).get("items") or [] print(row["platform"], row["data"]["author"]["username"], len(posts), "posts") ``` - Send up to 25 accounts with `"include": "posts"`, or up to 50 without. - A handle that is not found is refunded, and so is a posts page that comes back empty. ## Store only what is new Key communities and accounts on their `key`, such as `reddit:subreddit:sourdough` or `tiktok:wheatculture`. Keep one roster for the topic and add only keys you have not stored. To leave out accounts you already have on the next run, send their keys in `exclude`. To watch the roster's new posts each day, follow the [Follow creators](/docs/recipes/follow-creators.md) cookbook with the accounts as its list. ## What it costs | Part | Credits | | --- | --- | | A dry run | 0 | | Each search that returns rows | That platform's search price | | Looking up and judging an account | Priced by the dry run | | A profile, and its posts page | 1 each, 5 on LinkedIn | What the example runs measured on 18/11/2026: | Run | Rows | Credits | | --- | --- | --- | | The communities dry run | 0 | 0 | | The communities run | 10 of 56 | 15 | | The accounts run, stopped at its cap | 10 of 170 candidates | 40 | | Two profiles with their posts | 2 | 4 | | The same two runs sent again | the same rows | 0 | Sending a run again while it exists returns it, so the repeat cost nothing. ## Tips, and what not to use - Run the communities first. They cost less here, and their names can suggest keywords for the accounts. - Raise `max_credits` only after a dry run. The accounts run here stopped at its cap of 40 with 10 accounts. Its `next_step` priced the remaining 168 candidates at a total cap of 194. - Add `context` to say what kind of community or account you want. It is judged on every row, so price it first. - Do not use `GET /v1/prism/creators` for this job. It builds creator shortlists. For communities, shops and businesses, use Discover as this page does. ## Full program and agent brief **Full program (Python)** ```python title="Python" # communities_and_accounts.py: where a topic is discussed, and the accounts that post about it, in one roster. # Run: SOCIALCRAWL_API_KEY=... python3 communities_and_accounts.py (Python 3.9+, nothing to install) import csv import json import os import urllib.parse import urllib.request KEY = os.environ["SOCIALCRAWL_API_KEY"] BASE = "https://www.socialcrawl.dev/v1" KEYWORDS = "sourdough baking,sourdough starter" def call(path, params=None, body=None): url = f"{BASE}/{path}" + ("?" + urllib.parse.urlencode(params) if params else "") data = json.dumps(body).encode() if body is not None else None req = urllib.request.Request(url, data=data, headers={"x-api-key": KEY, "content-type": "application/json"}) with urllib.request.urlopen(req, timeout=120) as res: return json.load(res) roster = [] # 1. The communities: subreddits, groups and channels where the topic lives. c = call("prism/discover", {"keywords": KEYWORDS, "view": "communities", "platforms": "reddit,facebook,youtube", "limit": "10", "max_credits": "30"}) for x in c["data"]["items"]: roster.append(["community", x["platform"], x["kind"], x["name"], x["url"], x.get("members")]) # 2. The accounts that post about it, each judged for fit and kind. a = call("prism/discover", {"keywords": KEYWORDS, "view": "accounts", "platforms": "youtube,instagram,tiktok", "limit": "10", "max_credits": "40"}) for x in a["data"]["items"]: acc, j = x["account"], x.get("judgments") or {} roster.append(["account", acc["platform"], j.get("account_kind"), acc.get("username") or acc.get("display_name"), acc["url"], acc.get("followers")]) # 3. The latest posts of the accounts you keep (up to 25 in one call with posts). keep = [{"platform": x["account"]["platform"], "handle": x["account"]["username"]} for x in a["data"]["items"] if x["account"].get("username")][:2] p = call("prism/profiles", body={"items": keep, "include": "posts"}) with open("roster.csv", "w", newline="", encoding="utf-8") as f: w = csv.writer(f) w.writerow(["type", "platform", "kind", "name", "url", "members_or_followers"]) w.writerows(roster) spent = c.get("credits_used", 0) + a.get("credits_used", 0) + p.get("credits_used", 0) print(f"{len(c['data']['items'])} communities, {len(a['data']['items'])} accounts, " f"posts for {len(p['data']['results'])} profiles; {spent} credits") ``` **Agent brief** ```text title="Agent brief" Goal: a roster of the communities and accounts behind sourdough baking, in roster.csv. Read https://www.socialcrawl.dev/docs/recipes/communities-and-accounts.md first. 1. Dry-run each call with dry_run=true and show me the prices. 2. Call GET /v1/prism/discover with view=communities, platforms reddit,facebook,youtube, limit=10, max_credits=30. 3. Call it again with view=accounts, platforms youtube,instagram,tiktok, limit=10, max_credits=40. 4. For the accounts I keep, call POST /v1/prism/profiles with include posts. 5. Store each community and account once by key. Never raise max_credits without asking me. ``` ## Next steps - [Follow creators](/docs/recipes/follow-creators.md): Get only the new posts of the accounts you keep. - [Accounts behind a topic](/docs/recipes/accounts-behind-a-topic.md): The same job as a tested program. - [Discover](/docs/engines/discover.md): How Discover searches, judges and schedules.