---
name: groundsocial
description: Public Reddit data for agents, in Reddit's own JSON. Use this skill whenever you need a Reddit thread with its comments, a subreddit's posts, a user's posts or comments, or Reddit search results; when a PRAW or snoowrap script fails because it has no Reddit API access; or when reddit.com answers 403 to a .json request. Read-only.
metadata:
  version: 1.0.0
  canonical_url: https://groundsocial.dev/SKILL.md
  auth_spec: https://groundsocial.dev/auth.md
---

# Groundsocial SKILL.md

Groundsocial is a social data API: public posts, comments, communities, users and search as clean JSON in each platform's own shape, one key and one credit balance, over REST, MCP and a CLI. Live today: Reddit (Reddit's own Things and Listings, plus a PRAW-compatible host). Read-only: nothing here posts, votes or messages. Reddit is a trademark of Reddit, Inc. We are not affiliated with or endorsed by Reddit.

## 0. Check what already works

- See which platforms you can call and what each endpoint costs: `curl -s https://api.groundsocial.dev/v1/platforms`. Free, no key, no credits.
- Is `GROUNDSOCIAL_API_KEY` set in the environment? Use it. Don't create another account.
- Are `reddit_*` tools already visible (an MCP server is connected)? Use them.
- Run `curl -s https://api.groundsocial.dev/v1/account -H "Authorization: Bearer $GROUNDSOCIAL_API_KEY"` only if you need to check a key (it shows the balance, free); a key works when `GET https://api.groundsocial.dev/v1/reddit/subreddits/selfhosted` answers 200.

## 1. Get an API key

Pick one:

| Situation | How |
| --- | --- |
| Headless agent, no human | `POST https://api.groundsocial.dev/v1/agent/signup` (see below). 100 free credits. |
| Human in a browser | https://groundsocial.dev/app/sign-in, email code, no card |
| Remote MCP | `https://api.groundsocial.dev/mcp`: OAuth in the client, or `Authorization: Bearer <key>` |

### Self-signup (no human)

```bash
curl -X POST https://api.groundsocial.dev/v1/agent/signup \
  -H 'content-type: application/json' \
  -d '{"agent_name":"my-research-agent","purpose":"track self-hosting threads"}'
```

- `201`: `{"api_key","key_id","account_id","credits","claim_url","claim_expires_at","message_for_human"}`. Store `api_key` as `GROUNDSOCIAL_API_KEY`. Give `message_for_human` and `claim_url` to your person: they open it in a browser to take over the account. The key keeps working. Never open or complete the claim yourself.
- `428 challenge_required`: one short question in `error.details.challenge.question` ("Which of norway, walrus, pear is a country?"). The answer is always one of the words in the question. POST again with `{"challenge_token": error.details.challenge.token, "answer": "norway"}`; `error.details.curl` is the ready-to-run command. Same network, within `expires_in` seconds.
- `428 challenge_failed`: wrong or expired; it carries a new question. Answer that one.
- `429 signup_limited` / `challenge_locked`: too many signups or questions from this network. Wait `Retry-After`, or ask your person to sign in.
- `503 signup_disabled`: stop and tell your person. Don't look for another signup route.

## 2. First call

```bash
curl "https://api.groundsocial.dev/v1/reddit/posts/1y3k9qa?limit=50" -H "Authorization: Bearer $GROUNDSOCIAL_API_KEY"
```

The response is `{"post": <t3 Thing>, "comments": <Listing of t1 and more>}`. Pages carry `data.after`; pass it as `after` for the next page until it is `null`. Expand `more` items with `POST /v1/reddit/posts/{id}/more` and `{"children": [...]}`.

| Job | Call | Credits |
| --- | --- | --- |
| A subreddit: description, rules, member count, flags. | `reddit.subreddit.get` (MCP `reddit_subreddit_get`) | 1 |
| Posts in a subreddit, by hot, new, top, rising or controversial. | `reddit.subreddit.posts` (MCP `reddit_subreddit_posts`) | 1 |
| One post with its full comment tree. | `reddit.post.get` (MCP `reddit_post_get`) | 1 |
| Comments on a post, paginated, with "more" threads expanded. | `reddit.post.comments` (MCP `reddit_post_comments`) | 1 |
| A public user profile: karma, age, flags. | `reddit.user.get` (MCP `reddit_user_get`) | 1 |
| Posts a user submitted. | `reddit.user.posts` (MCP `reddit_user_posts`) | 1 |
| Comments a user wrote. | `reddit.user.comments` (MCP `reddit_user_comments`) | 1 |
| Search posts across Reddit or in one subreddit. | `reddit.search.posts` (MCP `reddit_search_posts`) | 2 |
| Find subreddits by name or topic. | `reddit.search.subreddits` (MCP `reddit_search_subreddits`) | 1 |

Every response has `x-request-id`, `x-credits-charged` and `x-credits-remaining`. Failed calls are refunded.

## 3. Setup

**MCP, Claude Code:**
```bash
claude mcp add --transport http groundsocial https://api.groundsocial.dev/mcp
# or with a key instead of OAuth:
claude mcp add --transport http groundsocial https://api.groundsocial.dev/mcp --header "Authorization: Bearer $GROUNDSOCIAL_API_KEY"
```

**Cursor, VS Code, Windsurf, Claude Desktop (`mcpServers`):**
```json
{ "mcpServers": { "groundsocial": { "url": "https://api.groundsocial.dev/mcp", "headers": { "Authorization": "Bearer <key>" } } } }
```

**Remote MCP:** `https://api.groundsocial.dev/mcp` (Streamable HTTP; OAuth 2.1 with PKCE, or a Bearer API key). Free tools: `list_endpoints`, `estimate_cost`, `account_balance`, `agent_signup`.

**PRAW:**
```python
reddit = praw.Reddit(client_id="groundsocial", client_secret=os.environ["GROUNDSOCIAL_API_KEY"], user_agent="my-agent/1.0",
                     oauth_url="https://reddit.groundsocial.dev", reddit_url="https://reddit.groundsocial.dev")
```

**Packages:** there is no SDK, CLI or stdio MCP package on npm yet. Don't install `@groundsocial/*` packages: they aren't ours. Use plain HTTP or the remote MCP server.

## 4. Paying

- Accounts spend prepaid credits. A `402 insufficient_credits` means the balance is empty: tell your person to buy a pack at https://groundsocial.dev/app/billing. A `402 spend_cap_reached` means a cap your person set: stop.
- Keyless pay-per-call (rolling out): a paid route called without a key answers `402` with an MPP challenge (`WWW-Authenticate: Payment …`) and x402 offers for that call's price ($0.01 per credit). Pay only if your person allowed you to spend; the payment is captured only after a successful fetch. Until it ships, a keyless call answers `401`: sign up instead.

## 5. When something fails

Retry only when `error.retryable` is true, after `Retry-After` seconds, with backoff. Never resend a `400` unchanged.

| HTTP | code | Action |
| --- | --- | --- |
| 400 | `invalid_request` | Fix the input named in `message`. |
| 401 | `unauthorized`, `invalid_api_key` | Send the key as `Authorization: Bearer`. A key that worked and now 401s was revoked: ask your person; don't sign up again. |
| 402 | `insufficient_credits`, `spend_cap_reached`, `payment_required` | See Paying. |
| 403 / 404 | `target_private`, `target_not_found` | The community is private, or the thing was removed. Not charged. Move on. |
| 429 | `rate_limited` | Wait `Retry-After`. |
| 503 / 504 | `upstream_unavailable`, `upstream_timeout` | Retry later; not charged. |

All codes: https://groundsocial.dev/docs/errors.md

## 6. Guardrails

- A spend cap, an empty balance or a removed post is a decision, not an obstacle. Don't route around it with another key, another surface or a fresh signup.
- Never claim, pay for or upgrade your person's account.
- Read-only. Respect deleted content and `over_18`; don't profile or re-identify people.
- Never paste a key into chat, logs or URLs.

## 7. Done means verified

You are set up when one call returned 200 with Reddit JSON. Report: which surface you used, the `x-request-id`, credits spent (sum of `x-credits-charged`) and credits left (`x-credits-remaining`), and the `claim_url` if you signed up.

## Useful links

- Platforms and prices (free, no key): https://api.groundsocial.dev/v1/platforms
- Auth spec: https://groundsocial.dev/auth.md
- Index: https://groundsocial.dev/llms.txt (whole site: https://groundsocial.dev/llms-full.txt)
- OpenAPI: https://groundsocial.dev/openapi.json
- Docs: https://groundsocial.dev/docs (every page also at `.md`)
