100 free credits. No credit card required. Get a key

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 failure
import 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

NameTypeDescription
namepath · requiredstringSubreddit 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.

FieldTypeDescription
rulesobject[]
site_rulesstring[]
Status codes
StatusMeaning
200The rules.
400Invalid input. Nothing was charged.
401Missing or invalid API key.
402Not enough credits, a spend cap was reached, or payment is required.
403The target is private, or the account is suspended.
404The subreddit, post or user does not exist.
429Too many requests. Wait for Retry-After seconds.
503Reddit 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.