Get a Subreddit's Posting Rules
Fetch a subreddit's posting rules by name: each rule's name, description, what it applies to, violation reason and priority, plus Reddit's site rules.
/api/reddit/sub/:name/rules$0.0015 / callA subreddit's posting rules (Reddit's /r/<name>/about/rules data): each
rule's name, description, what it applies to, violation reason, priority, and
creation date, plus Reddit's site-wide rules. Returns a rules list and a
site_rules string list.
When to use this
Reach for this to check a community's rules before posting or commenting, what a subreddit forbids, whether a rule applies to posts, comments, or both, and the reason a moderator will cite for a removal. One read.
Path Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
name | string | Yes | Subreddit name (no r/ prefix) |
A subreddit that does not exist returns 404.
When Reddit refuses the rules read
Reddit's rules data can be refused. The rules are then read from the rules section of the subreddit's sidebar text, and the response carries X-Read-Source: sidebar_text. That text is what the moderators wrote, so each rule has a name and, when the text gives one, a description. violation_reason, priority, created_utc and created are null, site_rules is empty because the sidebar does not list them (Reddit's site-wide rules still apply), and applies_to is posts or comments only when the section's heading says so, otherwise null.
A subreddit whose sidebar has no rules section, for example one that only links to its rules, answers the unbilled 503 instead of an empty list. An empty rules list always comes from Reddit's rules data.
Example
curl -H "Authorization: Bearer $TOKEN" \
"https://api.redditapis.com/api/reddit/sub/AskReddit/rules"const response = await fetch(
"https://api.redditapis.com/api/reddit/sub/AskReddit/rules",
{ headers: { Authorization: "Bearer TOKEN" } }
);
const data = await response.json();import requests
response = requests.get(
"https://api.redditapis.com/api/reddit/sub/AskReddit/rules",
headers={"Authorization": "Bearer TOKEN"},
)Response Shape
{
"rules": [
{
"name": "Rule 1: Questions must be clear",
"description": "Posts must be phrased as a genuine, answerable question.",
"applies_to": "posts",
"violation_reason": "Unclear or rhetorical question",
"priority": 0,
"created_utc": 1201261935,
"created": "2008-01-25T12:32:15.000Z"
}
],
"site_rules": [
"Spam",
"Personal and confidential information",
"Threatening, harassing, or inciting violence"
]
}Response Fields
| Field | Type | Notes |
|---|---|---|
name | string | The rule's short name / title |
description | string | null | The rule's full description (may be empty / null) |
applies_to | string | null | posts | comments | all; null only on a rules read from the sidebar text whose heading does not say |
violation_reason | string | null | The reason shown when the rule is enforced (may be null) |
priority | number | null | Display order Reddit assigns the rule (may be null) |
created_utc | number | null | Unix epoch seconds the rule was created (may be null) |
created | string | null | ISO-8601 form of created_utc (may be null) |
site_rules | string[] | Reddit's site-wide rules (a list of strings) |
Independent third-party API for developers and researchers. Not affiliated with, endorsed by, or sponsored by Reddit, Inc.
Batch Subreddit Lookup
Fetch subscriber counts, type and metadata for up to 100 subreddits by name in a single call, with the names Reddit did not return listed.
Can I Post
Before posting, check whether a post in a subreddit can go through: allowed true, false or unknown, a reason code per block, the posting requirements and the post rules.
