GET /subreddit/rules

Subreddit Rules

Subreddit rules and posting requirements. Reddit Scraper API endpoint /subreddit/rules: parameters, JSON response fields and code examples.

A community’s rules in display order (name, priority, description, whether it covers posts, comments or both, removal reason, creation time) plus its posting requirements: allowed post types, flair required, title / body length limits, body policy and banned words or domains. Give the name or the t5_ id. Billed 1 request per call.

HTTP Request

GET /subreddit/rules

Cost (in requests): 1. Every successful answer reports its cost in data.billed_requests.

Parameters

ParameterTypeRequiredDefaultDescription
subredditstringYes-Subreddit name (case-insensitive, with or without r/) or its t5_ id.

Response

Real response to GET /subreddit/rules?subreddit=python (arrays trimmed to 2 items, long texts cut with …).

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
{
  "status": true,
  "request_id": "4f954d81-b298-bee1-fcfe-dafdf336",
  "data": {
    "subreddit": "Python",
    "subreddit_id": "t5_2qh0y",
    "rules": [
      {
        "rule_id": "e3f4ccd9-897b-42ec-aef9-1b75f5411429",
        "name": "No showcase posts",
        "priority": 0,
        "description_html": "<p>Due to an increase of showcases featuring AI content such as working with multiple AI models or wrappers around APIs, this is no longer allowed. Please post your showcases in the appropriate monthly showcase post or a daily thread instea…",
        "description_text": "Due to an increase of showcases featuring AI content such as working with multiple AI models or wrappers around APIs, this is no longer allowed. Please post your showcases in the appropriate monthly showcase post or a daily thread instead.",
        "description_markdown": "Due to an increase of showcases featuring AI content such as working with multiple AI models or wrappers around APIs, this is no longer allowed. Please post your showcases in the appropriate monthly showcase post or a daily thread instead.",
        "kind": "post",
        "violation_reason": "No showcase posts",
        "created_at": "2024-08-03T05:47:33.000000+00:00"
      },
      {
        "rule_id": "07756577-7643-42f6-9671-80d0a62e770a",
        "name": "\"How do I\", Help, or similar questions belong in r/LearnPython",
        "priority": 1,
        "description_html": "<p>If you are about to ask a question about how to do something in python, please check out <a href=\"https://www.reddit.com/r/LearnPython/\">r/LearnPython</a>.</p><p>It is a very helpful community that is focused on helping people get answer…",
        "description_text": "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 helpful community that is focused on helping people get answers that they understand.",
        "description_markdown": "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 helpful community that is focused on helping people get answers that they understand.",
        "kind": "post",
        "violation_reason": "belongs in r/LearnPython",
        "created_at": "2022-05-19T17:26:33.000000+00:00"
      }
    ],
    "posting_requirements": {
      "allowed_post_types": [
        "text",
        "spoiler"
      ],
      "is_flair_required": null,
      "title_min_length": null,
      "title_max_length": null,
      "body_min_length": null,
      "body_max_length": null,
      "body_restriction": null,
      "banned_words_title": [],
      "banned_words_body": [],
      "banned_domains": []
    },
    "billed_requests": 1
  },
  "request_params": {
    "subreddit": "python"
  }
}

Response Fields

FieldTypeDescription
statusbooleantrue when the request succeeded
request_idstringUnique request identifier
dataobjectRules; null with error.code = not_found.
data.subredditstringSubreddit name.
data.subreddit_idstringSubreddit id.
data.rulesarray of objectsStructured rules in priority order.
data.rules[].rule_idstringRule id (uuid). For reference; not an input of this API.
data.rules[].namestringRule title.
data.rules[].priorityinteger0-based display order.
data.rules[].description_htmlstringRule body rendered as HTML.
data.rules[].description_textstringRule body as plain text.
data.rules[].description_markdownstringRule body as Markdown, as the moderators wrote it; null when it could not be read.
data.rules[].kindstringWhat the rule covers: post, comment or all (posts and comments); null when it could not be read.
data.rules[].violation_reasonstringThe removal reason moderators pick for this rule, in Reddit’s words; null when it could not be read.
data.rules[].created_atstringISO-8601 UTC time the rule was created; null when it could not be read.
data.posting_requirementsobjectAllowed post types and posting rules; null when Reddit sets none or they could not be read.
data.posting_requirements.allowed_post_typesarray of stringPost kinds the community accepts (text, link, image, video, gallery, poll).
data.posting_requirements.is_flair_requiredboolean / nullA flair must be chosen to post.
data.posting_requirements.title_min_lengthinteger / nullMinimum title length.
data.posting_requirements.title_max_lengthinteger / nullMaximum title length.
data.posting_requirements.body_min_lengthinteger / nullMinimum body length.
data.posting_requirements.body_max_lengthinteger / nullMaximum body length.
data.posting_requirements.body_restrictionstring / nullPost body policy: required, not_allowed or none.
data.posting_requirements.banned_words_titlearrayStrings not allowed in titles.
data.posting_requirements.banned_words_bodyarrayStrings not allowed in bodies.
data.posting_requirements.banned_domainsarrayLink domains not allowed.
data.billed_requestsintegerRequests billed for this call (also sent as Requests in the X-RapidAPI-Billing header when it is not RapidAPI’s default of 1).
request_paramsobjectEcho of the parameters you sent

Error Responses

Invalid input returns HTTP 400, not billed. error is a plain string that names the parameter:

1
{ "status": false, "request_id": "99a1e6cd-2e57-9e8f-4e44-2dea7f6d", "error": "Invalid parameter 'post_id': must be a post id such as z1c9z or t3_z1c9z", "request_params": { "post_id": "!!" } }
Status CodeCauseDescription
400Invalid or missing parameterPlain-English message per field. Not billed
200 with status: falseItem not availableerror.code is not_found, banned, private, quarantined. data is null. Billed 1 request
503Reddit temporarily unreachable"error": "Service temporarily unavailable". Not billed, retry later

Code Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
import requests

url = "https://reddit-scraper-api-extractor-ai-the-most-complete.p.rapidapi.com/subreddit/rules"

params = {
    "subreddit": "python",
}

headers = {
    "X-RapidAPI-Key": "YOUR_API_KEY",
    "X-RapidAPI-Host": "reddit-scraper-api-extractor-ai-the-most-complete.p.rapidapi.com"
}

response = requests.get(url, headers=headers, params=params)
data = response.json()["data"]

print(data["subreddit"])
print(data["subreddit_id"])
print("Billed requests:", data["billed_requests"])
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
const url = "https://reddit-scraper-api-extractor-ai-the-most-complete.p.rapidapi.com/subreddit/rules";

const params = new URLSearchParams({
  subreddit: "python",
});

const response = await fetch(`${url}?${params}`, {
  headers: {
    "X-RapidAPI-Key": "YOUR_API_KEY",
    "X-RapidAPI-Host": "reddit-scraper-api-extractor-ai-the-most-complete.p.rapidapi.com"
  }
});

const { data } = await response.json();
console.log(data.subreddit, data.subreddit_id);
1
2
3
4
curl -G "https://reddit-scraper-api-extractor-ai-the-most-complete.p.rapidapi.com/subreddit/rules" \
  --data-urlencode "subreddit=python" \
  -H "X-RapidAPI-Key: YOUR_API_KEY" \
  -H "X-RapidAPI-Host: reddit-scraper-api-extractor-ai-the-most-complete.p.rapidapi.com"
Start building today

Get your API key and make your first request in under a minute.

Get Your API Key on RapidAPI