GET /subreddit/flairs

Subreddit Flairs

Post and user flair templates of a subreddit. Reddit Scraper API endpoint /subreddit/flairs: parameters, JSON response fields and code examples.

A community’s post flair templates (id, text, rich text, type, colours, mod-only and editable flags, allowed content), its user flair templates and its post-flair settings (flair on, authors can pick one) and whether custom emojis are on. Use a flair’s text as the flair filter of /subreddit/posts. Billed 1 request per call.

HTTP Request

GET /subreddit/flairs

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/flairs?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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
{
  "status": true,
  "request_id": "35c3d9eb-ada9-fb10-d5e4-d9639d0c",
  "data": {
    "subreddit_id": "t5_2qh0y",
    "post_flairs": [
      {
        "flair_id": "f35fb004-c1ff-11ee-8305-565bc5d0cc73",
        "text": "Showcase",
        "rich_text": [
          {
            "type": "text",
            "text": "Showcase",
            "url": null
          }
        ],
        "type": "richtext",
        "background_color": "#FF66AC",
        "text_color": "light",
        "is_mod_only": false,
        "is_editable": false,
        "allowed_content": "all",
        "max_emojis": 10
      },
      {
        "flair_id": "0ad780a0-1c5e-11ea-978c-0ee7bacb2bff",
        "text": "News",
        "rich_text": [
          {
            "type": "text",
            "text": "News",
            "url": null
          }
        ],
        "type": "richtext",
        "background_color": "#7193FF",
        "text_color": "light",
        "is_mod_only": false,
        "is_editable": false,
        "allowed_content": "all",
        "max_emojis": 10
      }
    ],
    "user_flairs": [
      {
        "flair_id": "4cc838b8-3159-11e1-83e4-12313d18ad57",
        "text": null,
        "background_color": "transparent",
        "text_color": "dark",
        "is_mod_only": false
      },
      {
        "flair_id": "67d01c9c-537b-11ee-b0d0-7225f76af176",
        "text": "Pythonista",
        "background_color": "transparent",
        "text_color": "dark",
        "is_mod_only": false
      }
    ],
    "user_flairs_available": true,
    "post_flair_settings": {
      "is_enabled": true,
      "is_self_assignable": true
    },
    "is_emojis_enabled": true,
    "billed_requests": 1
  },
  "request_params": {
    "subreddit": "python"
  }
}

Response Fields

FieldTypeDescription
statusbooleantrue when the request succeeded
request_idstringUnique request identifier
dataobjectFlairs; null with error.code = not_found.
data.subreddit_idstringSubreddit id.
data.post_flairsarray of objectsPost flair templates.
data.post_flairs[].flair_idstringFlair template id, the same as flair.flair_id on posts. A reference id, not an input of this API.
data.post_flairs[].textstringFlair text.
data.post_flairs[].rich_textarray of objectsRich-text flair as parts in display order (text, and emoji with their image URL); null for a plain-text flair.
data.post_flairs[].rich_text[].typestringtext or emoji.
data.post_flairs[].rich_text[].textstringThe text, or the emoji’s short code (e.g. :nba-1:).
data.post_flairs[].rich_text[].urlstring / nullEmoji image URL (emoji parts only).
data.post_flairs[].typestringtext or richtext.
data.post_flairs[].background_colorstringHex background colour.
data.post_flairs[].text_colorstringlight or dark.
data.post_flairs[].is_mod_onlybooleanOnly moderators can assign it.
data.post_flairs[].is_editablebooleanUsers may edit the text.
data.post_flairs[].allowed_contentstringall, text or emoji.
data.post_flairs[].max_emojisintegerMaximum emojis allowed.
data.user_flairsarray of objectsUser flair templates (often empty: see user_flairs_available).
data.user_flairs[].flair_idstringFlair template id, the same as flair.flair_id on posts. A reference id, not an input of this API.
data.user_flairs[].textstring / nullFlair text.
data.user_flairs[].background_colorstringHex background colour.
data.user_flairs[].text_colorstringlight or dark.
data.user_flairs[].is_mod_onlybooleanOnly moderators can assign it.
data.user_flairs_availablebooleanTrue when user_flairs is the real list (the templates came back, or the community has user flair turned off); false when user flair is on but Reddit does not publish the templates; null when unknown.
data.post_flair_settingsobjectPost-flair settings of the community.
data.post_flair_settings.is_enabledbooleanPosts in this community can carry a flair; null when unknown.
data.post_flair_settings.is_self_assignablebooleanAuthors can pick the flair of their own post; null when unknown.
data.is_emojis_enabledbooleanThe community has custom emojis turned on; null when unknown.
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/flairs"

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_id"])
print(data["user_flairs_available"])
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/flairs";

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_id, data.user_flairs_available);
1
2
3
4
curl -G "https://reddit-scraper-api-extractor-ai-the-most-complete.p.rapidapi.com/subreddit/flairs" \
  --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