crawlbaseDocs
Log in

API usage

Add &scraper=reddit-subreddit to a Crawling API request. URL-encode the target URL in the url parameter.

curl 'https://api.crawlbase.com/?token=YOUR_TOKEN' \
  --data-urlencode 'url=https://www.reddit.com/r/programming/' \
  --data-urlencode 'scraper=reddit-subreddit' -G
from crawlbase import CrawlingAPI

api = CrawlingAPI({'token': 'YOUR_TOKEN'})
res = api.get(
    'https://www.reddit.com/r/programming/',
    {'scraper': 'reddit-subreddit'}
)

import json
data = json.loads(res['body'])
const { CrawlingAPI } = require('crawlbase');
const api = new CrawlingAPI({ token: 'YOUR_TOKEN' });

const res = await api.get(
  'https://www.reddit.com/r/programming/',
  { scraper: 'reddit-subreddit' }
);
const data = JSON.parse(res.body);
require 'crawlbase'
api = Crawlbase::API.new(token: 'YOUR_TOKEN')

res = api.get('https://www.reddit.com/r/programming/', scraper: 'reddit-subreddit')
data = JSON.parse(res.body)

Example input URL

The URL passed in the url parameter (URL-decoded for readability):

https://www.reddit.com/r/programming/

Response shape

JSON response body. Field types may be null when the source page omits the value.

subreddit
string
Subreddit name (without the r/ prefix).
url
string
Canonical subreddit URL.
sort
string
Sort order of the listing (for example hot, new, top).
postCount
integer
Number of posts returned in posts.
pagination
object
Pagination cursor for the next and previous pages.
pagination.next_page_url
string | null
URL for the next page of posts, or null on the last page.
pagination.previous_page_url
string | null
URL for the previous page of posts, or null on the first page.
pagination.has_next
boolean
True when a next page is available.
posts
array
Posts on the listing, in display order.
posts[].position
integer
Position of the post in the returned list (1-based).
posts[].id
string
Reddit fullname of the post (for example t3_...).
posts[].rank
integer
Rank of the post on the subreddit listing.
posts[].title
string
Post title.
posts[].author
string
Username of the post author.
posts[].score
integer
Post score (upvotes minus downvotes).
posts[].commentsCount
integer
Number of comments on the post.
posts[].createdAt
string
Post creation time (ISO 8601).
posts[].permalink
string
Permalink to the post on Reddit.
posts[].url
string | null
Outbound link the post points to (null for text posts).
posts[].domain
string | null
Domain of the outbound link.
posts[].flair
string | null
Post flair text, when set.
posts[].isNsfw
boolean
True when the post is marked NSFW.
posts[].isStickied
boolean
True when the post is pinned to the top of the subreddit.
posts[].thumbnail
string | null
Thumbnail image URL, when present.

Sample response

{
  "subreddit": "programming",
  "url": "https://old.reddit.com/r/programming/",
  "sort": "hot",
  "postCount": 3,
  "pagination": {
    "next_page_url": "https://old.reddit.com/r/programming/?count=25&after=t3_1c8x9aa",
    "previous_page_url": null,
    "has_next": true
  },
  "posts": [
    {
      "position": 1,
      "id": "t3_1c8a1bb",
      "rank": 1,
      "title": "The hidden cost of deep dependency trees",
      "author": "buildmaster",
      "score": 2417,
      "commentsCount": 312,
      "createdAt": "2026-07-14T09:12:44+00:00",
      "permalink": "https://old.reddit.com/r/programming/comments/1c8a1bb/the_hidden_cost_of_deep_dependency_trees/",
      "url": "https://example.com/blog/dependency-trees",
      "domain": "example.com",
      "flair": null,
      "isNsfw": false,
      "isStickied": false,
      "thumbnail": "https://b.thumbs.redditmedia.com/abc.jpg"
    }
  ]
}