Support needed? Reach out! ๐Ÿ“ง

How to Scrape Reddit Subreddit Posts

This tutorial shows how to use Reddit Subreddit Posts API to scrape and crawl structured Reddit data in real-time.
Target any subreddit with our posts API and extract top, new, or hot posts along with upvote ratios, comment counts, and flair data for focused niche research and community intelligence.

Access Reddit Data in 3 Steps

Start crawling Reddit subreddit search data. Follow these steps to extract social media data in minutes.

1

Create Your Account

Go to our registration page and make an account. It's free, no credit card, and you get credits right away to play around with.

2

Verify Your Email Address

You'll get a verification email, click the link in it. Once that's done, you can grab your API token from the dashboard.

3

Make Your First API Call

Copy the code snippet below, swap in your API key, and run it. You'll get Reddit data back as JSON within a few seconds.

Code Sample

Here's a JavaScript example to get you going. Swap out the token and you're good, works the same way in any language that can make HTTP requests. Start collecting subreddit search data via our REST API!

javascript-logo JavaScript
Reddit Subreddit Posts
1 const root = 'https://ensembledata.com/apis'
2 const endpoint = '/reddit/subreddit/posts'
3 const params = {
4   "name""SkincareAddiction",
5   "sort""new",
6   "period""hour",
7   "cursor""",
8   "token""YOUR-TOKEN-HERE"
9 }
10  
11 const queryString = new URLSearchParams(params).toString();
12 const url = `${root}${endpoint}?${queryString}`;
13  
14 await fetch(url)
15   .then(response => response.json())
16   .then(data => console.log(data))
17   .catch(error => console.error(error));
18  

Parameters

name (string) Subreddit to be searched. REQUIRED
sort Type of posts to fetch. REQUIRED
period ATTENTION: The time filter applies only to sort type 'top'. REQUIRED
cursor (string) Parameter to manually handle pagination. Each response contains a `nextCursor` which can be used to retrieve the next page of results by sending it as the next `cursor`. If the `nextCursor` is not present in the response, it means that there are no more results to retrieve.
token (string) Private token assigned to each client to access the APIs. REQUIRED

Example Response

Explore the fields returned by this endpoint. Click a row to expand nested objects and arrays, hover a value to copy it, or use "Expand all" to see everything at once.

JSON
Reddit Subreddit Posts
dataarray1 item ยท schema from #0 1 item
kindstring"t3"
dataobject107 fields
approved_at_utcnullnull
subredditstring"SkincareAddiction"
selftextstring""
author_fullnamestring"t2_raliabz"
savedbooleanfalse
mod_reason_titlenullnull
gildednumber1
clickedbooleanfalse
titlestring"[B&A] Finished my 5 month course of accutane just in time for gradโ€ฆ"
link_flair_richtextarray1 item ยท schema from #0 1 item
estring"text"
tstring"Selfie/B&A"
subreddit_name_prefixedstring"r/SkincareAddiction"
hiddenbooleanfalse
pwlsnumber6
link_flair_css_classstring"BA"
downsnumber0
thumbnail_heightnumber105
top_awarded_typenullnull
hide_scorebooleanfalse
namestring"t3_8pv3gg"
quarantinebooleanfalse
link_flair_text_colorstring"dark"
upvote_rationumber1
author_flair_background_colorstring""
subreddit_typestring"public"
upsnumber22353
total_awards_receivednumber0
media_embedobject0 fields
empty
thumbnail_widthnumber140
author_flair_template_idnullnull
is_original_contentbooleanfalse
user_reportsarray0 items
empty
secure_medianullnull
is_reddit_media_domainbooleantrue
is_metabooleanfalse
categorynullnull
secure_media_embedobject0 fields
empty
link_flair_textstring"Selfie/B&A"
can_mod_postbooleanfalse
scorenumber22353
approved_bynullnull
is_created_from_ads_uibooleanfalse
author_premiumbooleanfalse
thumbnailstring"https://b.thumbs.redditmedia.com/d_kAXp7s27m3gRw0BJeh7egWtSqMU9pitQWJNโ€ฆ"
editedbooleanfalse
author_flair_css_classstring"notag"
author_flair_richtextarray0 items
empty
gildingsobject0 fields
empty
post_hintstring"image"
content_categoriesnullnull
is_selfbooleanfalse
mod_notenullnull
creatednumber1528571476
link_flair_typestring"richtext"
wlsnumber6
removed_by_categorynullnull
banned_bynullnull
author_flair_typestring"text"
domainstring"i.redd.it"
allow_live_commentsbooleantrue
selftext_htmlnullnull
likesnullnull
suggested_sortnullnull
banned_at_utcnullnull
url_overridden_by_deststring"https://i.redd.it/6m0n0fc9y0311.jpg"
view_countnullnull
archivedbooleanfalse
no_followbooleanfalse
is_crosspostablebooleanfalse
pinnedbooleanfalse
over_18booleanfalse
previewobject2 fields
imagesarray1 item ยท schema from #0 1 item
sourceobject3 fields
urlstring"https://preview.redd.it/6m0n0fc9y0311.jpg?auto=webp&s=44f4247afef3โ€ฆ"
widthnumber3343
heightnumber2508
resolutionsarray6 items ยท schema from #0 6 items
urlstring"https://preview.redd.it/6m0n0fc9y0311.jpg?width=108&crop=smart&ampโ€ฆ"
widthnumber108
heightnumber81
variantsobject0 fields
empty
idstring"1OMM0gPYiMG9D9s4beEdm3XA23aqhaWCSu11gZI3IPQ"
enabledbooleantrue
all_awardingsarray0 items
empty
awardersarray0 items
empty
media_onlybooleanfalse
can_gildbooleanfalse
spoilerbooleanfalse
lockedbooleanfalse
author_flair_textstring""
treatment_tagsarray0 items
empty
visitedbooleanfalse
removed_bynullnull
num_reportsnullnull
distinguishednullnull
subreddit_idstring"t5_2tbbg"
author_is_blockedbooleanfalse
mod_reason_bynullnull
removal_reasonnullnull
link_flair_background_colorstring""
idstring"8pv3gg"
is_robot_indexablebooleantrue
report_reasonsnullnull
authorstring"pastabeans"
discussion_typenullnull
num_commentsnumber276
send_repliesbooleantrue
contest_modebooleanfalse
mod_reportsarray0 items
empty
author_patreon_flairbooleanfalse
author_flair_text_colorstring"dark"
permalinkstring"/r/SkincareAddiction/comments/8pv3gg/ba_finished_my_5_month_course_of_โ€ฆ"
stickiedbooleanfalse
urlstring"https://i.redd.it/6m0n0fc9y0311.jpg"
subreddit_subscribersnumber4781592
created_utcnumber1528571476
num_crosspostsnumber4
medianullnull
is_videobooleanfalse

Response Codes

Status codes this endpoint can return, so you can handle errors before they surprise you in production.

200SuccessSuccessful Response
404Client ErrorNot found
422Client ErrorValidation Error
469Client ErrorTopic restricted
491Client ErrorToken not found
492Client ErrorEmail not verified
493Client ErrorSubscription expired
495Client ErrorAll daily units used
500Server ErrorSomething went wrong

API Pricing

2 units Cost per successful call to this endpoint.

Fetch Reddit Data at Scale

Collect subreddit posts at scale for competitive research, niche trend analysis, or building datasets from specific Reddit communities.

deco-icon

Subreddit Feeds

Pull top, new, or hot posts from any specific subreddit.

deco-icon

Flair Data

Filter posts by category using returned flair information.

deco-icon

Upvote Ratios

See upvote ratios and comment counts for every post returned.