/v1/reddit/subreddit/search
Subreddit Search
Search within a subreddit for posts, comments, or media matching a query
| Credit cost | Default: 1 credit How charges are determinedCost is decided per call, not per endpoint: the same operation can cost different amounts depending on what it returns. A call that fails costs 0 credits. A result served from cache costs 0 credits. `default` is the cost when no rule matches. Rules are evaluated in order and the first whose conditions all hold wins. A `when` condition is one of: `param` (the request parameter is true), `outcome` (the classifier's outcome), `empty` / `nonEmpty` (a response field is empty and absent, or a non-empty array or string), `flag` (a response field is exactly true). A cost of `{ perStartedMinute: n, of: [fields] }` is n x max(1, ceil(seconds / 60)), so even a short result bills at least one minute. |
|---|---|
| Cache support | Not specified in the published contract. |
| Pagination | No explicit pagination metadata in the published contract. Consult the parameters and response fields below. |
Parameters
| Name | Location / required | Schema |
|---|---|---|
subredditSubreddit name (e.g. 'Fitness', not 'r/Fitness' or a full URL) | query / required |
|
querySearch query to find matching content | query / optional |
|
sortSort order. For posts/media: relevance, hot, top, new, comments. For comments: relevance, top, new | query / optional |
Allowed values |
timeframeTimeframe to filter results | query / optional |
Allowed values |
cursorCursor to get more results. Get 'cursor' from previous response. | query / optional |
|
Request examples
Replace placeholder values and supply your own API key. For operations with a request body, populate the body using the schema above.
cURL
curl --request GET 'https://api.fetchproof.com/v1/reddit/subreddit/search?subreddit=YOUR_SUBREDDIT' \
--header 'x-api-key: YOUR_API_KEY'JavaScript
const response = await fetch("https://api.fetchproof.com/v1/reddit/subreddit/search?subreddit=YOUR_SUBREDDIT", {
method: 'GET',
headers: { 'x-api-key': process.env.FETCHPROOF_API_KEY }
});
console.log(await response.text());Python
import os
import requests
response = requests.get("https://api.fetchproof.com/v1/reddit/subreddit/search?subreddit=YOUR_SUBREDDIT",
headers={"x-api-key": os.environ["FETCHPROOF_API_KEY"]})
print(response.text)Responses
200Success. Envelope: success / credits_remaining / credits_charged.
application/json
object
successrequired
boolean
credits_remainingrequired
integer
credits_chargedrequired
integer
postsrequired
array
Array items
object
idrequired
string
post_idrequired
string
titlerequired
string
urlrequired
string
permalinkrequired
string
nsfwoptional
boolean
spoilerrequired
boolean
is_crosspostoptional
boolean
subredditrequired
schema
anyOf
object
idrequired
string
namerequired
string
nsfwrequired
boolean
quarantinedrequired
boolean
iconrequired
string
bannerrequired
null
descriptionrequired
string
weekly_visitorsrequired
integer
weekly_contributionsrequired
integer
anyOf
string
votesoptional
integer
num_commentsrequired
integer
created_atoptional
string
created_at_isorequired
string
{
"format": "date-time"
}thumbnailrequired
null
thumbnail_blurredrequired
boolean
positionrequired
integer
relative_positionrequired
integer
authoroptional
string
author_fullnameoptional
string
selftextoptional
null
selftext_htmloptional
null
downsoptional
integer
nameoptional
string
upvote_ratiooptional
null
upsoptional
integer
total_awards_receivedoptional
null
scoreoptional
integer
createdoptional
integer
created_utcoptional
integer
subreddit_subscribersoptional
null
is_videooptional
boolean
over_18optional
boolean
commentsoptional
array
Array items
object
idrequired
string
post_idrequired
string
parent_comment_idrequired
null
is_reply_to_commentrequired
boolean
authorrequired
string
author_avatarrequired
null
author_nsfwrequired
boolean
bodyrequired
string
body_htmlrequired
string
imagesrequired
array
votesrequired
integer
urlrequired
string
permalinkrequired
string
created_atrequired
string
created_at_isorequired
string
{
"format": "date-time"
}postrequired
object
idrequired
string
titlerequired
string
urlrequired
string
permalinkrequired
string
nsfwrequired
boolean
spoilerrequired
boolean
votesrequired
integer
num_commentsrequired
integer
created_atrequired
string
created_at_isorequired
string
{
"format": "date-time"
}subredditrequired
object
idrequired
string
namerequired
string
nsfwrequired
boolean
quarantinedrequired
boolean
iconrequired
string
positionrequired
integer
mediaoptional
array
Array items
object
idrequired
string
titlerequired
string
urlrequired
string
permalinkrequired
string
media_typerequired
string
videorequired
null
imagerequired
object
srcrequired
string
widthrequired
integer
heightrequired
integer
resolutionsrequired
array
Array items
object
urlrequired
string
widthrequired
integer
gallery_countrequired
null
aspect_ratiorequired
number
nsfwrequired
boolean
spoilerrequired
boolean
is_blurredrequired
boolean
subredditrequired
object
idrequired
string
namerequired
string
nsfwrequired
boolean
quarantinedrequired
boolean
positionrequired
integer
safe_searchrequired
string
cursorrequired
string