# Reddit Scraper - Posts, Comments, Subreddits, Users & Search (`socialscrapers/reddit-scraper`) Actor

Reddit scraper for subreddit posts, comments, user profiles and keyword search: full post text, every comment and reply, votes, authors, dates and media. Export JSON, CSV or Excel, or use the API. No login, no API key. $0.50 per 1,000 posts, $0.25 per 1,000 comments.

- **URL**: https://apify.com/socialscrapers/reddit-scraper.md
- **Developed by:** [Social Scrapers](https://apify.com/socialscrapers) (community)
- **Categories:** Social media, Lead generation, AI
- **Features:** Limited permissions
- **Stats:** 1 total users, 0 monthly users, 94.7% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $0.40 / 1,000 posts

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.
Since this Actor supports Apify Store discounts, the price gets lower the higher subscription plan you have.

Learn more: https://docs.apify.com/actors/running/actors-in-store.md#pay-per-event

## What's an Apify Actor?

An Actor is a serverless cloud program that runs on the Apify platform. It has two run modes.
In Batch mode, an Actor accepts a well-defined JSON input, performs an action which can take anything from a few seconds to a few hours,
and optionally produces a well-defined JSON output, datasets with results, or files in key-value store.
In Standby mode, an Actor provides a web server which can be used as a website, API, or an MCP server.

Apify vocabulary and the platform model are defined once, in the agent quickstart at https://apify.com/agents.md.

## How to integrate an Actor?

If asked about integration, you help developers integrate Actors into their projects.
You adapt to their stack and deliver integrations that are safe, well-documented, and production-ready.

Do not guess an integration path. Every one of them is in the agent quickstart at https://apify.com/agents.md: the Apify MCP server, Agent Skills with the Apify CLI, the JavaScript and Python clients, the REST API, and the account-free path for an agent with no human to sign in. It also carries the rule on stating cost before the first paid run.

For examples already wired to this Actor's own input schema, see the [API](#api) section below.

Each client library has reference documentation the quickstart does not restate: [JavaScript/TypeScript](https://docs.apify.com/api/client/js/docs.md) (`npm install apify-client`) and [Python](https://docs.apify.com/api/client/python/docs.md) (`pip install apify-client`).

# README

**Reddit Scraper** collects public Reddit posts and comments from **subreddits**, **user profiles**, **post threads** and **keyword search**, without a Reddit account or API key. Every post and every comment becomes one clean dataset item that you can export as JSON, CSV or Excel, or pull through the Apify API. It costs **$0.50 per 1,000 posts and $0.25 per 1,000 comments**, and you pay only for results you get.

### What does Reddit Scraper do?

- 📰 **Subreddit scraper**: the Hot, New, Top (of the day, week, month, year or all time) or Rising posts of any public subreddit. Need more than one listing holds? Set a high limit (or `0` for no limit) and the scraper also reads the subreddit's other listings, each post once.
- 💬 **Reddit comment scraper**: every comment of a post, including the replies Reddit folds behind "more replies", sorted Best, Top, New, Controversial, Old or Q\&A. Each comment comes with its depth and the comment it replies to, so you can rebuild the whole thread.
- 🔎 **Reddit search scraper**: Reddit's post search for any number of keywords, by relevance, new, top or most comments, over any time range. Each result comes with its title, votes, comment count, author, subreddit and date; turn on **Full post text for search results** to also get the post's full text, link, flair, upvote ratio and media. One search on Reddit ends near 250 posts; ask for more and the scraper reads the same keyword in other orders and narrower time ranges, inside your time range, without duplicates.
- 👤 **Reddit user scraper**: a user's posts and comments, newest first, or only their posts, or only their comments.
- 🔗 **Any mix in one run**: paste subreddit, profile, post and search URLs side by side, add keywords, and get one dataset back. An item found by two inputs is stored, and charged, once.
- 🧾 **Stable output**: every item has the same fields, with ISO dates, full links, media links, and `null` where a value does not apply.

### What data can you extract from Reddit?

One dataset item per post or comment. `dataType` tells them apart. A field that does not apply to an item's type is `null` (a title on a comment, a depth on a post), and `imageUrls` is then an empty list.

| Field | Type | Description |
|---|---|---|
| `dataType` | string | `"post"` or `"comment"`. |
| `id` | string | Reddit's full ID of the item: `t3_…` for a post, `t1_…` for a comment. |
| `url` | string | Link to the post or comment. |
| `postId` | string | Full ID (`t3_…`) of the post the item belongs to. For a post, the same as `id`. |
| `parentId` | string or null | Comments: what the comment replies to, `t3_…` for the post itself or `t1_…` for another comment. |
| `title` | string or null | Posts: the title. |
| `body` | string or null | Post text or comment text. Empty for link posts. `null` for a search result unless "Full post text for search results" is on. |
| `bodyHtml` | string or null | The same text as Reddit renders it, in HTML. |
| `author` | string | Username without `u/`; `"[deleted]"` when the account was deleted. |
| `authorId` | string or null | The author's account ID (`t2_…`). |
| `authorFlair` | string or null | The author's flair text in the subreddit, when Reddit shows it. |
| `subreddit` | string | Subreddit name without `r/`. Posts on a user's profile show `u_<username>`. |
| `subredditId` | string or null | The subreddit's ID (`t5_…`). |
| `createdAt` | string or null | When it was posted, ISO 8601 (UTC). |
| `editedAt` | string or null | When it was last edited, ISO 8601 (UTC), when Reddit shows it. |
| `score` | number or null | Net votes as Reddit shows them; `null` when Reddit hides the score. |
| `upvoteRatio` | number or null | Posts: share of votes that are upvotes, from 0 to 1. |
| `numComments` | number or null | Posts: number of comments Reddit reports (it counts removed ones too). |
| `flair` | string or null | Posts: the post flair text. |
| `isOver18` | boolean or null | Posts: `true` when marked NSFW (18+). |
| `linkUrl` | string or null | Posts: where a link post points; `null` for text posts. |
| `domain` | string or null | Posts: the domain of `linkUrl`, for example `i.redd.it` or `youtube.com`. |
| `thumbnailUrl` | string or null | Posts: the thumbnail image. |
| `imageUrls` | list of strings | Posts: full-size images of an image or gallery post, in gallery order. Empty otherwise. |
| `videoUrl` | string or null | Posts: playable link to a video hosted on Reddit. |
| `removedByCategory` | string or null | Posts: why the post was removed, for example `"moderator"` or `"deleted"`. |
| `postTitle` | string or null | Comments: title of the post the comment is on, when known. |
| `postUrl` | string or null | Comments: link to the post the comment is on, when known. |
| `depth` | number or null | Comments collected from a post: how deeply the comment is nested (0 = a direct reply to the post). |
| `isSubmitter` | boolean or null | Comments: `true` when the commenter is the post's author. |
| `sourceType` | string | The kind of input that found the item: `"subreddit"`, `"user"`, `"post"` or `"search"`. |
| `sourceInput` | string | The start URL or search keyword that found the item. |
| `scrapedAt` | string | When the item was collected, ISO 8601 (UTC). |

### How to scrape Reddit

1. Open **Reddit Scraper** on Apify and click **Try for free**.
2. Add what to scrape. **Start URLs** take any mix of:
   - subreddits: `https://www.reddit.com/r/AskReddit/` or `r/AskReddit`, or a URL with a sort such as `https://www.reddit.com/r/AskReddit/top/?t=week`;
   - user profiles: `https://www.reddit.com/user/<username>/` or `u/<username>` (end in `/submitted/` for posts only, `/comments/` for comments only);
   - posts: a post's link, a `redd.it` short link, a gallery link, or a link to one of its comments;
   - share links from the Reddit app (`https://www.reddit.com/r/<subreddit>/s/<id>`, `/u/<username>/s/<id>`) and `v.redd.it` video links, also on `old.`, `np.`, `m.` and `i.reddit.com`;
   - search pages: `https://www.reddit.com/search/?q=coffee&sort=new`, or a search inside one subreddit: `https://www.reddit.com/r/Coffee/search/?q=grinder`.
     **Search keywords** each run their own search.
3. Set **Max items per source** (posts per subreddit or keyword; `0` = no limit).
4. To get comments, turn on **Include comments** and set **Max comments per post** (`0` = every comment) and **Sort comments by**.
5. Click **Start**. Results appear in the **Output** tab as they are scraped. Download them as JSON, CSV, Excel, XML or HTML, or read them through the API.

Share links from the Reddit app (`/s/…`) work as they are: the scraper follows each one to the post, comment, subreddit or profile it opens, without logging in and without charging for it. A share link Reddit no longer knows (it then opens the subreddit's front page instead) is reported as expired, not scraped as that subreddit.

### How much does it cost to scrape Reddit?

| Result | Price per 1,000 | Silver plan (−10%) | Gold plan (−20%) |
|---|---|---|---|
| Post | $0.50 | $0.45 | $0.40 |
| Comment | $0.25 | $0.225 | $0.20 |
| Search result with full text (option on) | $1.45 | $1.305 | $1.16 |

Platform usage and proxies are included. You pay only for results that are stored: a post found by two of your inputs is stored, and charged, once, and a search result left out by the keyword filter costs nothing. A search result is a post ($0.50 per 1,000) unless **Full post text for search results** is on: then each result whose post page is read for its full text is a "Search result with full text" instead.

- **10,000 posts** from a list of subreddits: **$5.00**.
- **2,000 search results with 20 comments each** (2,000 posts + 40,000 comments): $1.00 + $10.00 = **$11.00**.
- **1,000 search results with full text**: **$1.45**.

Apify's free plan includes $5 of platform credit every month, enough for about 10,000 posts. To cap a run, set a **maximum total charge** in the run options: the scraper stops cleanly when it is reached and never stores a result your limit cannot pay for. **Max items in total** caps a run by result count the same way.

### Input example

The week's top 500 posts of two subreddits, each with its 100 best comments:

```json
{
  "startUrls": ["https://www.reddit.com/r/Coffee/", "r/espresso"],
  "subredditSort": "top",
  "subredditTime": "week",
  "maxItemsPerSource": 500,
  "includeComments": true,
  "maxCommentsPerPost": 100,
  "commentSort": "best"
}
```

Every comment of one post, newest first:

```json
{
  "startUrls": ["https://www.reddit.com/r/StandingDesks/comments/1q9v2ks/best_standing_desks_in_2026_so_far/"],
  "includeComments": true,
  "maxCommentsPerPost": 0,
  "commentSort": "new"
}
```

Keyword search: this month's posts for two keywords, 1,000 each, with full text:

```json
{
  "searches": ["standing desk", "ergonomic chair"],
  "searchSort": "relevance",
  "searchTime": "month",
  "maxItemsPerSource": 1000,
  "searchIncludePostDetails": true
}
```

A user's latest 300 posts and comments:

```json
{
  "startUrls": ["u/<username>"],
  "maxItemsPerSource": 300
}
```

### Output example

A search result with its full text, then one of its comments (trimmed):

```json
[
  {
    "dataType": "post",
    "id": "t3_1q9v2ks",
    "url": "https://www.reddit.com/r/StandingDesks/comments/1q9v2ks/best_standing_desks_in_2026_so_far/",
    "postId": "t3_1q9v2ks",
    "parentId": null,
    "title": "Best standing desks in 2026 so far?",
    "body": "Hey guys, my friend asked me for standing desk recommendations and I realized I probably know way too much about them lol. ...",
    "author": "<username>",
    "authorId": "t2_<user-id>",
    "subreddit": "StandingDesks",
    "subredditId": "t5_2tf0s",
    "createdAt": "2026-01-11T09:24:51.000Z",
    "score": 10,
    "upvoteRatio": 0.86,
    "numComments": 45,
    "flair": null,
    "isOver18": false,
    "linkUrl": null,
    "imageUrls": [],
    "depth": null,
    "sourceType": "search",
    "sourceInput": "standing desk",
    "scrapedAt": "2026-11-08T11:17:22.418Z"
  },
  {
    "dataType": "comment",
    "id": "t1_nz4075k",
    "url": "https://www.reddit.com/r/StandingDesks/comments/1q9v2ks/comment/nz4075k/",
    "postId": "t3_1q9v2ks",
    "parentId": "t1_nz2ggbi",
    "title": null,
    "body": "Good to hear another vote for the Uplift v3. How’s the stability at full standing height with dual monitors?",
    "author": "<username>",
    "authorId": "t2_<user-id>",
    "subreddit": "StandingDesks",
    "createdAt": "2026-01-12T04:59:23.000Z",
    "score": 1,
    "postTitle": "Best standing desks in 2026 so far?",
    "postUrl": "https://www.reddit.com/r/StandingDesks/comments/1q9v2ks/best_standing_desks_in_2026_so_far/",
    "depth": 1,
    "isSubmitter": true,
    "sourceType": "search",
    "sourceInput": "standing desk",
    "scrapedAt": "2026-11-08T11:17:22.418Z"
  }
]
```

The **Output** tab shows three table views: **Overview**, **Posts overview** and **Comments overview**.

### Use cases

- **Brand and product monitoring**: follow what people say about a product, a competitor or a topic, every day on a schedule.
- **Market and product research**: collect questions, complaints, feature requests and recommendations in a niche.
- **Trend tracking**: watch new posts in the communities you care about.
- **Text and sentiment analysis**: build datasets of real conversations, with whole comment threads, for NLP, classification or LLM work.
- **Community research**: see what a subreddit discusses, which posts take off and how threads unfold.
- **Lead and audience research**: find the people who ask for the problem you solve, and the subreddits where they gather.
- **Academic research**: gather public discussion data on a topic over a time range.

### Use Reddit Scraper via API, Python, JavaScript and integrations

Run it from your own code with the Apify API clients.

**JavaScript / Node.js:**

```js
import { ApifyClient } from 'apify-client';

const client = new ApifyClient({ token: 'YOUR_APIFY_TOKEN' });
const run = await client.actor('socialscrapers/reddit-scraper').call({
  searches: ['standing desk'],
  maxItemsPerSource: 500,
  includeComments: true,
  maxCommentsPerPost: 50,
});
const { items } = await client.dataset(run.defaultDatasetId).listItems();
console.log(items.length);
```

**Python:**

```python
from apify_client import ApifyClient

client = ApifyClient("YOUR_APIFY_TOKEN")
run = client.actor("socialscrapers/reddit-scraper").call(
    run_input={"startUrls": ["https://www.reddit.com/r/Coffee/"], "maxItemsPerSource": 1000}
)
for item in client.dataset(run["defaultDatasetId"]).iterate_items():
    print(item["dataType"], item["title"] or item["body"][:80])
```

You can also:

- **Schedule** runs (every hour, every day) to collect new posts and comments on a topic.
- Send results to **Google Sheets**, **Slack**, **Airtable** and other apps through **Make**, **Zapier** or **n8n**, or call a **webhook** when a run finishes.
- Let an **AI agent** run it through the Apify MCP server.
- Read results as **JSON, CSV, Excel, XML, HTML or RSS** from the dataset API.

### Reddit API vs this scraper

| | Official Reddit API | Reddit Scraper |
|---|---|---|
| Account and app | Reddit account, registered app and OAuth credentials | None |
| Rate limit | 100 requests per minute on the free tier | Handled for you |
| Comments | You page through "load more" yourself | Every comment, already flattened in reading order |
| Search depth | About 250 results per query | Thousands per keyword (other orders and time ranges) |
| Output | Raw JSON | Clean items, CSV, Excel, JSON, API |
| Commercial use | Needs Reddit's approval | You pay per result |

### Limits

- **Public content only, no login.** Private, quarantined and banned subreddits, and anything that needs a Reddit account, are out of reach; the run log names each one.
- **Hidden profiles.** Reddit lets users hide their posts and comments from their profile; such a profile shows nothing to logged-out visitors, and the run log says so.
- **Removed and deleted comments are not listed.** Reddit's comment count includes them, so a post may report a few more comments than you get.
- **Listings end near 1,000 posts each.** Reddit stops every subreddit listing and profile listing around 1,000 entries; with a higher limit the scraper reads the other listings to reach more.
- **Some fields depend on where an item comes from.** `editedAt` and `authorFlair` are filled when Reddit serves them (Hot listings and profiles), and `null` otherwise. Missing values are always `null`, never guessed.
- **Residential proxy.** Reddit refuses most datacenter IPs, so keep the default residential proxy. If you pick Apify Proxy without the RESIDENTIAL group, the first session Reddit refuses moves the run to RESIDENTIAL, in the same country; custom proxy URLs are used exactly as given.
- **A run with 0 results still succeeds when your input was fine.** When a subreddit, profile, post or share link has nothing public (it does not exist, is private, banned, hidden or deleted, or a search matches nothing), the run ends as Succeeded with a status message naming each input and why, and nothing is charged. A run fails only when no start URL can be used at all, or when Reddit refuses every one of 3 or more inputs (the scraper is then blocked, and worth retrying later).

### FAQ

**Is it legal to scrape Reddit?**
Reddit Scraper collects only public data that anyone can see without logging in. Scraping public data is lawful in many countries, but Reddit's terms of service and data-protection laws such as the GDPR may apply to how you collect and use it, especially personal data. You are responsible for your use; ask a lawyer if unsure.

**Do I need a Reddit account or API key?**
No. The scraper reads only what Reddit shows to logged-out visitors.

**How many results can I get?**
As many as Reddit has. Set **Max items per source** to `0` for no limit, or **Max comments per post** to `0` for every comment of a post. One search on Reddit ends near 250 posts, so for more the scraper reads the keyword in other orders and narrower time ranges; one listing ends near 1,000 posts, so for more it reads the subreddit's other listings.

**Why did I get fewer results than I asked for?**
The subreddit, profile or keyword has fewer posts, the profile's owner hides their activity, the keyword filter left out results that do not mention every word (turn off **Only posts that mention every keyword word** to keep them all), or the run reached its maximum charge. The run log says which, for each input.

**Can I paste share links from the Reddit app?**
Yes. Links like `https://www.reddit.com/r/AskReddit/s/AbCdEf1234` are followed to the post, comment, subreddit or profile they open, then scraped like the full URL. Resolving a link is never charged.

**My run finished with 0 results. What happened?**
Your input was valid but had nothing public to collect: the status message and the run log name each input and the reason (not found, private, hidden profile, expired share link, no matching posts). Nothing was charged.

**How do I collect only new posts?**
Use the **New** sort on a subreddit or search, and **Search time range** such as the past 24 hours, on a schedule.

**How do I get the comments of search results or subreddit posts?**
Turn on **Include comments**. Each post is followed by its comments, up to **Max comments per post**.

**Why do my search results have no text?**
Reddit's search results show only a post's title, votes, comment count, author, subreddit and date. Turn on **Full post text for search results** and the scraper reads each result's post page for its full text, link, flair, upvote ratio and media ($1.45 per 1,000 such results). It is off by default because those runs are slower.

**How do I tell which input found an item?**
`sourceType` and `sourceInput` on every item name the start URL or keyword that found it.

### Other scrapers by Social Scrapers

| Scraper | What it collects |
|---|---|
| [Facebook Groups Scraper](https://apify.com/socialscrapers/facebook-groups-scraper) | Posts from public Facebook groups |
| [Facebook Profile Scraper](https://apify.com/socialscrapers/facebook-profile-scraper) | Public details of Facebook profiles and Pages |
| [Facebook Profile Posts Scraper](https://apify.com/socialscrapers/facebook-profile-posts-scraper) | Recent posts of Facebook profiles and Pages |
| [Facebook Ads Library Scraper](https://apify.com/socialscrapers/facebook-ads-library-scraper) | Ads from Meta's public Ad Library |
| [X (Twitter) Profile Scraper](https://apify.com/socialscrapers/x-profile-scraper) | Public X profiles: followers, bio, counts |
| [Quora Scraper](https://apify.com/socialscrapers/quora-scraper) | Quora questions, answers and profiles |
| [Instagram Profile Scraper](https://apify.com/socialscrapers/instagram-profile-scraper) | Instagram profiles with their latest posts |
| [Instagram Post Scraper](https://apify.com/socialscrapers/instagram-post-scraper) | Instagram posts and reels with comments |
| [YouTube Scraper](https://apify.com/socialscrapers/youtube-scraper) | YouTube videos, channels, search and comments |
| [YouTube Transcript Scraper](https://apify.com/socialscrapers/youtube-transcript-scraper) | Transcripts and captions of YouTube videos |
| [LinkedIn Jobs Scraper](https://apify.com/socialscrapers/linkedin-jobs-scraper) | Public LinkedIn job postings |
| [Threads Scraper](https://apify.com/socialscrapers/threads-scraper) | Threads profiles, posts, replies and search |

# Actor input Schema

## `startUrls` (type: `array`):

Reddit URLs to scrape, in any mix. Subreddits: https://www.reddit.com/r/AskReddit/ or r/AskReddit. User profiles: https://www.reddit.com/user/NAME/ or u/NAME (end in /submitted/ for posts only, /comments/ for comments only). Posts: a post's link or a redd.it short link. Share links from the Reddit app (reddit.com/r/NAME/s/…) and v.redd.it links work too: each is followed to the page it opens. Search pages: https://www.reddit.com/search/?q=coffee or https://www.reddit.com/r/Coffee/search/?q=grinder. A subreddit URL that names a sort, like /top/?t=week, keeps that sort.

## `searches` (type: `array`):

Keywords to search Reddit posts for, for example "standing desk" or "best budget headphones". Each keyword is its own search and returns up to "Max items per source" posts.

## `maxItemsPerSource` (type: `integer`):

Most posts to take from each subreddit and each search keyword, and most posts and comments from each user profile. 0 = no limit: the scraper keeps going while Reddit has more (it reads other sort orders and time ranges once one listing ends). Comments collected with "Include comments" do not count here (see "Max comments per post"). Example: 500.

## `includeComments` (type: `boolean`):

For subreddit posts, post URLs and search results, also collect each post's comments: one result per comment, right after its post, with its depth and parent. User profiles always include the user's own comments.

## `maxCommentsPerPost` (type: `integer`):

Most comments to collect for each post when "Include comments" is on. 0 = every comment of the post, including the replies Reddit folds behind "more replies". Example: 200.

## `commentSort` (type: `string`):

The order comments are collected in, as on Reddit: Best (Reddit's default), Top, New, Controversial, Old or Q\&A. With a comment limit, it decides which comments you get.

## `searchSort` (type: `string`):

Order of search results. When you ask for more posts than one search returns (about 250), the scraper also reads the other orders within your time range and removes duplicates.

## `searchTime` (type: `string`):

Only find posts from this period, for example the past week.

## `searchIncludePostDetails` (type: `boolean`):

Off by default: each search result comes with its title, votes, comment count, author, subreddit and date. Turn on to also read each result's post page, so every result has its full text, link, flair, upvote ratio, images and video, like subreddit posts do. A result read this way is priced as "Search result with full text" ($1.45 per 1,000) instead of a post ($0.50 per 1,000).

## `searchMatchAllWords` (type: `boolean`):

Keep only posts whose title or text mentions every word of the keyword (plurals and accents count). Reddit's search also returns posts that match only in their comments. Turn off to keep every post the search returns.

## `subredditSort` (type: `string`):

Which listing to read for subreddit URLs that do not name one: Hot (Reddit's default), New, Top or Rising.

## `subredditTime` (type: `string`):

The period the Top listing covers, for example the past month. Used only when sorting by Top.

## `maxItems` (type: `integer`):

Overall cap on results (posts plus comments) for the whole run. The run stops once it is reached. Leave empty (or 0) for no cap. Example: 10000.

## `proxyConfiguration` (type: `object`):

Keep the default: Apify Proxy with the RESIDENTIAL group. Reddit refuses most datacenter IPs: with another Apify Proxy group, sessions Reddit refuses are retried on RESIDENTIAL (same country).

## Actor input object example

```json
{
  "startUrls": [
    "https://www.reddit.com/r/AskReddit/"
  ],
  "maxItemsPerSource": 100,
  "includeComments": false,
  "maxCommentsPerPost": 50,
  "commentSort": "best",
  "searchSort": "relevance",
  "searchTime": "all",
  "searchIncludePostDetails": false,
  "searchMatchAllWords": true,
  "subredditSort": "hot",
  "subredditTime": "all",
  "proxyConfiguration": {
    "useApifyProxy": true,
    "apifyProxyGroups": [
      "RESIDENTIAL"
    ]
  }
}
```

# Actor output Schema

## `results` (type: `string`):

No description

# API

You can run this Actor programmatically using our API. Below are code examples in JavaScript, Python, and CLI, as well as the OpenAPI specification and MCP server setup.

## JavaScript example

```javascript
import { ApifyClient } from 'apify-client';

// Initialize the ApifyClient with your Apify API token
// Replace the '<YOUR_API_TOKEN>' with your token
const client = new ApifyClient({
    token: '<YOUR_API_TOKEN>',
});

// Prepare Actor input
const input = {
    "startUrls": [
        "https://www.reddit.com/r/AskReddit/"
    ],
    "proxyConfiguration": {
        "useApifyProxy": true,
        "apifyProxyGroups": [
            "RESIDENTIAL"
        ]
    }
};

// Run the Actor and wait for it to finish
const run = await client.actor("socialscrapers/reddit-scraper").call(input);

// Fetch and print Actor results from the run's dataset (if any)
console.log('Results from dataset');
console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
const { items } = await client.dataset(run.defaultDatasetId).listItems();
items.forEach((item) => {
    console.dir(item);
});

// 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/js/docs

```

## Python example

```python
from apify_client import ApifyClient

# Initialize the ApifyClient with your Apify API token
# Replace '<YOUR_API_TOKEN>' with your token.
client = ApifyClient("<YOUR_API_TOKEN>")

# Prepare the Actor input
run_input = {
    "startUrls": ["https://www.reddit.com/r/AskReddit/"],
    "proxyConfiguration": {
        "useApifyProxy": True,
        "apifyProxyGroups": ["RESIDENTIAL"],
    },
}

# Run the Actor and wait for it to finish
run = client.actor("socialscrapers/reddit-scraper").call(run_input=run_input)

# Fetch and print Actor results from the run's dataset (if there are any)
print(f"💾 Check your data here: https://console.apify.com/storage/datasets/{run.default_dataset_id}")
for item in client.dataset(run.default_dataset_id).iterate_items():
    print(item)

# 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/python/docs/quick-start

```

## CLI example

```bash
echo '{
  "startUrls": [
    "https://www.reddit.com/r/AskReddit/"
  ],
  "proxyConfiguration": {
    "useApifyProxy": true,
    "apifyProxyGroups": [
      "RESIDENTIAL"
    ]
  }
}' |
apify call socialscrapers/reddit-scraper --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,socialscrapers/reddit-scraper"
        }
    }
}
```

The hosted server signs you in with OAuth on first connect, so no API token belongs in this config. Clients without OAuth support can send an `Authorization: Bearer <APIFY_API_TOKEN>` header instead, using a token from API & Integrations in Apify Console (https://console.apify.com/settings/integrations).

## OpenAPI specification

Download the OpenAPI definition: https://api.apify.com/v2/actors/GN42ibsBemoEnaqmD/builds/PbyqTM53GEL9jGSfx/openapi.json
