Reddit Subreddit Posts API
Provide one of: subreddit, url. Get recent posts from a subreddit with engagement metrics
Quick start
cURL
curl --request GET 'https://api.fetchproof.com/v1/reddit/subreddit?subreddit=nasa&sort=hot' \
--header 'x-api-key: YOUR_API_KEY' JavaScript
const response = await fetch("https://api.fetchproof.com/v1/reddit/subreddit?subreddit=nasa&sort=hot", {
method: 'GET',
headers: {
'x-api-key': process.env.FETCHPROOF_API_KEY,
},
});
const data = await response.json();
console.log(data); Python
import os
import requests
response = requests.get(
"https://api.fetchproof.com/v1/reddit/subreddit?subreddit=nasa&sort=hot",
headers={"x-api-key": os.environ["FETCHPROOF_API_KEY"]},
)
print(response.json()) Go
package main
import (
"fmt"
"io"
"net/http"
"os"
)
func main() {
req, _ := http.NewRequest("GET", "https://api.fetchproof.com/v1/reddit/subreddit?subreddit=nasa&sort=hot", nil)
req.Header.Set("x-api-key", os.Getenv("FETCHPROOF_API_KEY"))
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
} PHP
<?php
$ch = curl_init("https://api.fetchproof.com/v1/reddit/subreddit?subreddit=nasa&sort=hot");
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
'x-api-key: ' . getenv('FETCHPROOF_API_KEY'),
],
]);
$response = curl_exec($ch);
curl_close($ch);
echo $response; {
"success": true,
"credits_remaining": 100,
"credits_charged": 1,
"posts": [
{
"id": "1xy22ve",
"author": "crossposter-app",
"author_fullname": "t2_2o0216u9tr",
"subreddit": "nasa",
"title": "Image of the Cat's Head Nebula from NASA's James Webb Space Telescope",
"link_flair_text": "NASA Official",
"selftext": "",
"selftext_html": null,
"downs": 0,
"name": "t3_1xy22ve",
"upvote_ratio": 1,
"ups": 1,
"total_awards_received": 0,
"score": 1,
"created": 1794865060,
"created_utc": 1794865060,
"num_comments": 0,
"url": "https://i.redd.it/pcvhixh8n12i1.jpeg",
"permalink": "https://www.reddit.com/r/nasa/comments/1xy22ve/image_of_the_cats_head_nebula_from_nasas_james/",
"is_video": false,
"over_18": false
},
{
"id": "1xxrvsx",
"author": "teridon",
"author_fullname": "t2_4szt0",
"subreddit": "nasa",
"title": "Administrator Isaacman thanks the NASA workforce.",
"link_flair_text": "Working@NASA",
"selftext": "[removed]",
"selftext_html": null,
"downs": 0,
"name": "t3_1xxrvsx",
"upvote_ratio": 1,
"ups": 1,
"total_awards_received": 0,
"score": 1,
"created": 1794842037,
"created_utc": 1794842037,
"num_comments": 1,
"url": "https://www.reddit.com/r/nasa/comments/1xxrvsx/administrator_isaacman_thanks_the_nasa_workforce/",
"permalink": "https://www.reddit.com/r/nasa/comments/1xxrvsx/administrator_isaacman_thanks_the_nasa_workforce/",
"is_video": false,
"over_18": false
},
{
"id": "1xxojtj",
"author": "West-Bad-4916",
"author_fullname": "t2_1s1dg67od8",
"subreddit": "nasa",
"title": "Rate the collection",
"link_flair_text": "Self",
"selftext": "[removed]",
"selftext_html": null,
"downs": 0,
"name": "t3_1xxojtj",
"upvote_ratio": 1,
"ups": 1,
"total_awards_received": 0,
"score": 1,
"created": 1794833430,
"created_utc": 1794833430,
"num_comments": 1,
"url": "https://www.reddit.com/gallery/1xxojtj",
"permalink": "https://www.reddit.com/r/nasa/comments/1xxojtj/rate_the_collection/",
"is_video": false,
"over_18": false
}
],
"after": null
} What it returns
- success boolean
- credits_remaining integer
- credits_charged integer
- posts array
- after string
- cached boolean
- cached_at string
Parameters
Subreddit name
Timeframe to get posts from
Sort order
Set true for a trimmed response.
Use a cached response this old or newer for 0 credits. If none is available, fetch live at the endpoint’s normal price.
After to get more posts. Get 'after' from previous response.
Use cases
- Follow new submissions in a product’s support community
- Find recurring questions in a public niche forum
- Collect discussion links around a release
- Build a digest of posts for a selected community
Billing
Errors cost zero credits, and so do cache hits through cache_max_age. Empty results follow this operation’s rules.
Default: 1 credit
An empty result costs 0 credits.
How charges are determined
Cost 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.
Guides
Related Reddit endpoints
FAQ
How much does the Reddit Subreddit Posts API cost?
A call costs 1 credit by default. Errors cost 0 credits, and a cached result served through cache_max_age costs 0. New accounts get 100 free credits with no card. After that, credits come in one-time packs that never expire: 25,000 for $27 and 500,000 for $297 (plus any tax). There is no subscription.
What do I need to call it?
An API key in the x-api-key header, plus subreddit, and one of subreddit or url. You don't need a Reddit account or developer app.
What does it return?
Typed JSON. Top-level fields include posts, after, cached and cached_at. The full schema and a real sample response are on this page and in the API reference.
Is this an official Reddit API?
No. Fetchproof is an unofficial API that returns public Reddit data only.