Reddit subreddit rules API
A community’s posting rules in order, each with its title and description, plus Reddit’s site-wide report reasons, in the shape of Reddit’s about/rules JSON.
GET /v1/reddit/subreddits/{name}/rules1 credit per callRefunded on failureimport os, requests
res = requests.get(
"https://api.groundsocial.dev/v1/reddit/subreddits/Python/rules",
headers={"Authorization": f"Bearer {os.environ['GROUNDSOCIAL_API_KEY']}"},
)
res.raise_for_status()
data = res.json()Response
200 · 1 credit{ "rules": [ { "kind": null, "short_name": "No showcase posts", "description": "Due to an increase of showcases featuring AI content such as working with multiple AI models or wrappers around APIs, th…", "description_html": "<div class=\"md\"><p>\n Due to an increase of showcases featuring AI content such as working with multiple AI models o…", "violation_reason": null, "created_utc": null, "priority": 0 }, { "kind": null, "short_name": "\"How do I\", Help, or similar questions belong in r/LearnPython", "description": "If you are about to ask a question about how to do something in python, please check out r/LearnPython.\n\nIt is a very he…", "description_html": "<div class=\"md\"><p>\n If you are about to ask a question about how to do something in python, please check out <a rp…", "violation_reason": null, "created_utc": null, "priority": 1 }, "… 9 more" ], "site_rules": [ "Spam", "Personal and confidential information", "… 1 more" ]}Parameters
| Name | Type | Description |
|---|---|---|
namepath · required | string | Subreddit name, with or without "r/". "all" and "popular" also work for posts. Example: typescript. |
Response fields
200 with a SubredditRules, in Reddit’s own Things and Listings.
| Field | Type | Description |
|---|---|---|
rules | object[] | |
site_rules | string[] |
Status codes
| Status | Meaning |
|---|---|
200 | The rules. |
400 | Invalid input. Nothing was charged. |
401 | Missing or invalid API key. |
402 | Not enough credits, a spend cap was reached, or payment is required. |
403 | The target is private, or the account is suspended. |
404 | The subreddit, post or user does not exist. |
429 | Too many requests. Wait for Retry-After seconds. |
503 | Reddit is temporarily unavailable. Retryable; nothing was charged. |
Every error has code, message, hint and retryable. All error codes
Questions
Does it say whether a rule covers posts or comments?
Not yet: the public page does not show it, so kind is null rather than guessed.
Reddit is a trademark of Reddit, Inc. We are not affiliated with or endorsed by Reddit.