DEV Community

Алексей Спинов
Алексей Спинов

Posted on

Reddit Has a Secret JSON API — Just Add .json to Any URL

Did you know you can get structured JSON from Reddit without any API key, OAuth tokens, or rate limit headaches?

The Trick

Append .json to any Reddit URL:

https://www.reddit.com/r/webdev.json
https://www.reddit.com/r/python/top.json?t=week&limit=25
https://www.reddit.com/r/datascience/search.json?q=web+scraping&sort=new
https://www.reddit.com/user/spez/about.json
Enter fullscreen mode Exit fullscreen mode

Code Example

async function getRedditPosts(subreddit, sort = "hot", limit = 25) {
  const url = `https://www.reddit.com/r/${subreddit}/${sort}.json?limit=${limit}`;
  const res = await fetch(url, {
    headers: { "User-Agent": "MyApp/1.0" }
  });
  const data = await res.json();

  return data.data.children.map(post => ({
    title: post.data.title,
    author: post.data.author,
    score: post.data.score,
    comments: post.data.num_comments,
    url: post.data.url,
    created: new Date(post.data.created_utc * 1000).toISOString()
  }));
}

const posts = await getRedditPosts("startup", "top");
console.log(posts);
Enter fullscreen mode Exit fullscreen mode

Data You Can Extract

  • Posts: title, score, comments, author, awards, flair
  • Comments: text, score, author, replies (nested)
  • Users: karma, account age, recent posts
  • Search: across all subreddits or within one
  • Sorting: hot, new, top (hour/day/week/month/year/all)

Important: Add User-Agent

Reddit blocks requests without a User-Agent header. Always include one:

headers: { "User-Agent": "YourAppName/1.0" }
Enter fullscreen mode Exit fullscreen mode

Why Not the Official API?

Reddit's official API now requires OAuth and has strict rate limits (100 requests/minute). The JSON endpoint works without any authentication and is how old.reddit.com loads data.

Use Cases

  1. Market research — what does r/SaaS discuss most?
  2. Competitor monitoring — track mentions of your brand
  3. Content ideas — find top posts in your niche
  4. Sentiment analysis — how does a community feel about a topic?
  5. Lead generation — find people asking for help you can provide

More Free APIs


Need Reddit data extracted at scale? $20 flat rate. I'll deliver structured JSON/CSV with posts, comments, user profiles from any subreddit. Email: Spinov001@gmail.com | All services →

Top comments (0)