/v1/reddit/subreddit
Subreddit Posts
Get recent posts from a subreddit with engagement metrics
| 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 | Use a cached response this old or newer for 0 credits. If none is available, fetch live at the endpoint’s normal price. |
| Pagination | No explicit pagination metadata in the published contract. Consult the parameters and response fields below. |
Parameters
| Name | Location / required | Schema |
|---|---|---|
subredditSubreddit name | query / required |
|
timeframeTimeframe to get posts from | query / optional |
Allowed values |
sortSort order | query / optional |
Allowed values |
trimSet true for a trimmed response. | query / optional |
|
cache_max_ageUse a cached response this old or newer for 0 credits. If none is available, fetch live at the endpoint’s normal price. | query / optional |
Allowed values |
afterAfter to get more posts. Get 'after' 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?subreddit=YOUR_SUBREDDIT' \
--header 'x-api-key: YOUR_API_KEY'JavaScript
const response = await fetch("https://api.fetchproof.com/v1/reddit/subreddit?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?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
authorrequired
string
author_fullnamerequired
string
subredditrequired
string
titlerequired
string
link_flair_textrequired
string
selftextrequired
string
selftext_htmlrequired
string
downsrequired
integer
namerequired
string
upvote_ratiorequired
number
upsrequired
integer
total_awards_receivedrequired
integer
scorerequired
integer
createdrequired
integer
created_utcrequired
integer
created_at_isooptional
string
{
"format": "date-time"
}num_commentsrequired
integer
urlrequired
string
permalinkoptional
string
subreddit_subscribersrequired
integer
is_videorequired
boolean
over_18optional
boolean
spoileroptional
boolean
domainoptional
string
subreddit_idoptional
string
post_hintoptional
string
afterrequired
string
cachedoptional
boolean
cached_atoptional
string
{
"format": "date-time"
}