Reddit image and video search API
Posts with an image, video or gallery that match a query, with the media type, media URL and thumbnail; kind keeps one type.
GET /v1/reddit/search/media2 credits per callRefunded on failureimport os, requests
res = requests.get(
"https://api.groundsocial.dev/v1/reddit/search/media?q=sunset&kind=image",
headers={"Authorization": f"Bearer {os.environ['GROUNDSOCIAL_API_KEY']}"},
)
res.raise_for_status()
data = res.json()Response
200 · 2 credits{ "kind": "Listing", "data": { "after": "t3_1pxjur5", "before": null, "dist": 22, "modhash": null, "geo_filter": "", "children": [ { "kind": "t3", "data": { "id": "1hirsaz", "name": "t3_1hirsaz", "title": "Florida Sunsets", "author": "DrumsNPhotos", "author_fullname": "t2_8j38q23t", "subreddit": "sunset", "subreddit_name_prefixed": "r/sunset", "subreddit_id": "t5_2sjcy", "permalink": "/r/sunset/comments/1hirsaz/florida_sunsets/", "over_18": false, "spoiler": false, "media_type": "image", "media_url": "https://preview.redd.it/florida-sunsets-v0-ey68rzpa328e1.jpg?width=640&crop=smart&auto=webp&s=514572f7c078c133d8dc4cdca9…", "thumbnail": "https://preview.redd.it/florida-sunsets-v0-ey68rzpa328e1.jpg?width=640&crop=smart&auto=webp&s=514572f7c078c133d8dc4cdca9…", "gallery_count": null } }, { "kind": "t3", "data": { "id": "1uhw2au", "name": "t3_1uhw2au", "title": "One of the best sunsets I’ve seen from my window", "author": "ughhatemylife", "author_fullname": "t2_4wz39i4i", "subreddit": "sunset", "subreddit_name_prefixed": "r/sunset", "subreddit_id": "t5_2sjcy", "permalink": "/r/sunset/comments/1uhw2au/one_of_the_best_sunsets_ive_seen_from_my_window/", "over_18": false, "spoiler": false, "media_type": "image", "media_url": "https://preview.redd.it/one-of-the-best-sunsets-ive-seen-from-my-window-v0-qkaxodtvo0ah1.jpeg?width=640&crop=smart&auto=…", "thumbnail": "https://preview.redd.it/one-of-the-best-sunsets-ive-seen-from-my-window-v0-qkaxodtvo0ah1.jpeg?width=640&crop=smart&auto=…", "gallery_count": null } }, "… 20 more" ] }}Parameters
| Name | Type | Description |
|---|---|---|
qquery · required | string | Search query. Example: cats. |
subredditquery | string | Only this subreddit. Example: typescript. |
kindquery | "all" | "image" | "video" | "gallery" | all (default), image, video or gallery. One of all, image, video, gallery. |
sortquery | "relevance" | "new" | "top" | "comments" | "hot" | Result order. Default relevance. One of relevance, new, top, comments, hot. |
tquery | "hour" | "day" | "week" | "month" | "year" | "all" | Time window for top and controversial. Default day. One of hour, day, week, month, year, all. |
limitquery | integer | Items per page, 1 to 100. Default 25. |
afterquery | string | Cursor: the previous page's data.after. Omit for the first page. |
Response fields
200 with a MediaPostListing, in Reddit’s own Things and Listings.
| Field | Type | Description |
|---|---|---|
kind | "Listing" | |
data | object |
Status codes
| Status | Meaning |
|---|---|
200 | Matching media posts. |
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
Reddit is a trademark of Reddit, Inc. We are not affiliated with or endorsed by Reddit.