Reddit subreddit sidebar widgets API
Every sidebar widget of a community in order: the community card with weekly visitors, rules, post flairs with their colours, bookmarks and buttons, related communities with member counts, events and text widgets.
GET /v1/reddit/subreddits/{name}/widgets1 credit per callRefunded on failureimport os, requests
res = requests.get(
"https://api.groundsocial.dev/v1/reddit/subreddits/selfhosted/widgets",
headers={"Authorization": f"Bearer {os.environ['GROUNDSOCIAL_API_KEY']}"},
)
res.raise_for_status()
data = res.json()Response
200 · 1 credit{ "items": { "widget_id-card-32hch": { "id": "widget_id-card-32hch", "kind": "id-card", "shortName": "Self-Hosters", "textHtml": null, "data": [ { "text": "A place to share, discuss, discover, assist with, gain assistance for, and critique self-hosted alternatives to our favo…", "url": null, "descriptionHtml": null, "backgroundColor": null, "subscribers": 493908, "iconUrl": null, "when": null, "where": null } ] } }, "layout": { "idCardWidget": "widget_id-card-32hch", "sidebar": { "order": [] } }}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 SubredditWidgets, in Reddit’s own Things and Listings.
| Field | Type | Description |
|---|---|---|
items | object | |
layout | object |
Status codes
| Status | Meaning |
|---|---|
200 | The widgets, keyed by id, and their order. |
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
Where are the post flairs?
In the post-flair widget: each item has the flair text, its background colour and the link that filters the community by it.
Reddit is a trademark of Reddit, Inc. We are not affiliated with or endorsed by Reddit.