# Reddit Posts Search Scraper (`khadinakbar/reddit-posts-search-scraper`) Actor

Search Reddit posts globally or inside subreddits. Export titles, bodies, scores, authors, comment counts, media, permalinks, and top-comment previews. MCP optimized for SEO and AI agents. $0.002/post.

- **URL**: https://apify.com/khadinakbar/reddit-posts-search-scraper.md
- **Developed by:** [Khadin Akbar](https://apify.com/khadinakbar) (community)
- **Categories:** Social media, SEO tools, MCP servers
- **Stats:** 1 total users, 0 monthly users, 0.0% runs succeeded, NaN bookmarks
- **User rating**: No ratings yet

## Pricing

from $2.00 / 1,000 post scrapeds

This Actor is paid per event and usage. You are charged both the fixed price for specific events and for Apify platform usage.

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

## What's an Apify Actor?

Actors are a software tools running on the Apify platform, for all kinds of web data extraction and automation use cases.
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.
Actors are written with capital "A".

## 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.
The best way to integrate Actors is as follows.

In JavaScript/TypeScript projects, use official [JavaScript/TypeScript client](https://docs.apify.com/api/client/js.md):

```bash
npm install apify-client
```

In Python projects, use official [Python client library](https://docs.apify.com/api/client/python.md):

```bash
pip install apify-client
```

In shell scripts, use [Apify CLI](https://docs.apify.com/cli/docs.md):

````bash
# MacOS / Linux
curl -fsSL https://apify.com/install-cli.sh | bash
# Windows
irm https://apify.com/install-cli.ps1 | iex
```bash

In AI frameworks, you might use the [Apify MCP server](https://docs.apify.com/platform/integrations/mcp.md).

If your project is in a different language, use the [REST API](https://docs.apify.com/api/v2.md).

For usage examples, see the [API](#api) section below.

For more details, see Apify documentation as [Markdown index](https://docs.apify.com/llms.txt) and [Markdown full-text](https://docs.apify.com/llms-full.txt).


# README

## Reddit Posts Search Scraper

Search Reddit posts globally or inside selected subreddits and get clean, flat, agent-friendly JSON. This actor is MCP optimized, perfect for SEO and AI agents, and built for social listening, trend discovery, market research, content research, competitor monitoring, and community analysis.

### What it extracts

- Reddit post titles, bodies, authors, scores, upvote ratios, comment counts, flairs, domains, media URLs, permalinks, and timestamps
- Global Reddit search results for any keyword, phrase, brand, product, competitor, or pain point
- Optional subreddit-scoped search across one or many communities
- Optional compact top-comment previews embedded on each post record
- Source diagnostics so API users and AI agents can see whether data came from Reddit OAuth or a managed provider fallback

### Input examples

Global Reddit search:

```json
{
  "queries": ["AI search visibility", "best CRM for startups"],
  "sort": "relevance",
  "timeRange": "month",
  "maxPosts": 50,
  "includeTopComments": false
}
````

Search inside specific subreddits:

```json
{
  "queries": ["AI search", "ChatGPT alternatives"],
  "subreddits": ["r/SEO", "r/marketing"],
  "sort": "top",
  "timeRange": "year",
  "maxPosts": 100,
  "includeTopComments": true,
  "maxTopCommentsPerPost": 3
}
```

### Output shape

The dataset contains one `recordType: "post"` row per unique Reddit post. Rows are intentionally flat for spreadsheets, APIs, and AI agents. Top comments are included only when `includeTopComments` is enabled.

Example row:

```json
{
  "recordType": "post",
  "postId": "1abc234",
  "subreddit": "r/SEO",
  "title": "How are you tracking AI search visibility?",
  "body": "Looking for tools and workflows...",
  "author": "u/example_user",
  "score": 128,
  "upvoteRatio": 0.92,
  "numComments": 41,
  "permalink": "https://www.reddit.com/r/SEO/comments/1abc234/how_are_you_tracking_ai_search_visibility/",
  "domain": "self.SEO",
  "postType": "text",
  "createdAt": "2026-06-10T12:00:00.000Z",
  "query": "AI search visibility",
  "sourceInput": "AI search visibility in r/SEO",
  "source": "reddit-oauth",
  "scrapedAt": "2026-06-11T10:00:00.000Z"
}
```

### Input options

| Option | Default | Description |
|---|---:|---|
| `queries` | required | Keywords, phrases, brands, products, competitors, or topics to search |
| `subreddits` | empty | Optional subreddit names or URLs. Leave empty for global Reddit search |
| `sort` | `relevance` | `relevance`, `new`, `top`, `comments`, or `hot` |
| `timeRange` | `month` | `hour`, `day`, `week`, `month`, `year`, or `all` |
| `maxPosts` | `100` | Hard cap on unique posts returned and billed |
| `includeTopComments` | `false` | Adds compact top-comment previews to each post |
| `maxTopCommentsPerPost` | `5` | Maximum comment previews per post |
| `postDateLimit` | empty | Optional ISO date. Older posts are skipped after retrieval |
| `includeNsfw` | `false` | Include NSFW posts when intentionally needed |

### Data sources

The actor uses Reddit OAuth when `REDDIT_CLIENT_ID` and `REDDIT_CLIENT_SECRET` are configured. If OAuth is unavailable or returns no posts, it falls back to owner-managed ScrapeCreators and SociaVault keys when present. End users can also pass their own Reddit app credentials in the input.

Runs finish with a diagnostic `RUN_SUMMARY` and `OUTPUT` key-value record. Empty or blocked searches finish successfully with a clear warning instead of crashing, which makes the actor safer for scheduled monitors and MCP tool calls.

### Pricing

- `$0.002` per Reddit post returned
- Tiny actor-start event for platform usage accounting

Billing stops when `maxPosts` is reached. Duplicate posts across queries and subreddit scopes are deduplicated before billing.

### Use from an AI agent

This actor is designed for MCP and natural-language tool calls. An AI agent can pass a plain topic like `AI search visibility`, optionally scope it to subreddits like `r/SEO`, and receive structured Reddit posts ready for summarization, lead research, sentiment analysis, or SEO content planning.

### Notes

Reddit may restrict deleted, quarantined, private, banned, or geo-sensitive communities. This actor collects public Reddit content only. You are responsible for using the data in compliance with Reddit's Terms of Service, the Reddit User Agreement, applicable data-protection laws, and any rights of content authors. Do not use this data to identify, harass, or de-anonymize individuals.

# Actor input Schema

## `queries` (type: `array`):

Keywords, phrases, brands, competitors, products, pain points, or natural-language topics to search on Reddit. AI agents should put the main user request here.

## `subreddits` (type: `array`):

Optional subreddit names or URLs. Leave empty for global Reddit search. When set, every query is searched inside each subreddit. Accepts r/SEO, SEO, or https://www.reddit.com/r/SEO.

## `sort` (type: `string`):

How Reddit orders matching posts. Relevance is best for research and AI agents, new is best for monitoring, top is best for high-signal historical posts, comments finds active discussions, and hot finds currently trending matches.

## `timeRange` (type: `string`):

Time window for search results. Use week or month for current market research, year or all for evergreen SEO research.

## `maxPosts` (type: `integer`):

Maximum number of unique post records to return across all queries and subreddits. Billing stops when this cap is reached.

## `includeTopComments` (type: `boolean`):

When true, each post record includes a compact topComments array. Use this for AI summaries and sentiment analysis. Leave off for faster, cheaper post-only extraction.

## `maxTopCommentsPerPost` (type: `integer`):

Maximum number of top comments to embed in each post when includeTopComments is enabled.

## `postDateLimit` (type: `string`):

Optional ISO date. Example: 2026-01-01. Posts older than this are skipped after retrieval.

## `includeNsfw` (type: `boolean`):

Disabled by default for business research and AI-agent workflows. Enable only when you intentionally need NSFW Reddit content.

## `proxy` (type: `object`):

Proxy settings. Defaults to Apify Residential proxies because Reddit often blocks datacenter IPs. Leave unchanged unless you know your target and plan requirements.

## `redditClientId` (type: `string`):

Optional Reddit app client ID. Leave blank to use owner-managed access when configured. Create a free app at reddit.com/prefs/apps if you want to use your own credentials.

## `redditClientSecret` (type: `string`):

Optional Reddit app client secret paired with redditClientId. This is not your Reddit password.

## Actor input object example

```json
{
  "queries": [
    "AI search visibility",
    "\"ChatGPT alternatives\"",
    "best CRM for startups"
  ],
  "subreddits": [
    "r/SEO",
    "r/marketing"
  ],
  "sort": "relevance",
  "timeRange": "month",
  "maxPosts": 25,
  "includeTopComments": false,
  "maxTopCommentsPerPost": 5,
  "includeNsfw": false,
  "proxy": {
    "useApifyProxy": true,
    "apifyProxyGroups": [
      "RESIDENTIAL"
    ]
  }
}
```

# Actor output Schema

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

Dataset items containing Reddit post rows returned by global or subreddit-scoped search.

## `summary` (type: `string`):

Run summary including posts scraped, charge counts, source counts, provider usage, dedupe counts, and diagnostics.

# 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 = {
    "queries": [
        "AI search visibility"
    ],
    "subreddits": [],
    "maxPosts": 25,
    "proxy": {
        "useApifyProxy": true,
        "apifyProxyGroups": [
            "RESIDENTIAL"
        ]
    }
};

// Run the Actor and wait for it to finish
const run = await client.actor("khadinakbar/reddit-posts-search-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 = {
    "queries": ["AI search visibility"],
    "subreddits": [],
    "maxPosts": 25,
    "proxy": {
        "useApifyProxy": True,
        "apifyProxyGroups": ["RESIDENTIAL"],
    },
}

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

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

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

```

## CLI example

```bash
echo '{
  "queries": [
    "AI search visibility"
  ],
  "subreddits": [],
  "maxPosts": 25,
  "proxy": {
    "useApifyProxy": true,
    "apifyProxyGroups": [
      "RESIDENTIAL"
    ]
  }
}' |
apify call khadinakbar/reddit-posts-search-scraper --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "command": "npx",
            "args": [
                "mcp-remote",
                "https://mcp.apify.com/?tools=khadinakbar/reddit-posts-search-scraper",
                "--header",
                "Authorization: Bearer <YOUR_API_TOKEN>"
            ]
        }
    }
}

```

## OpenAPI specification

```json
{
    "openapi": "3.0.1",
    "info": {
        "title": "Reddit Posts Search Scraper",
        "description": "Search Reddit posts globally or inside subreddits. Export titles, bodies, scores, authors, comment counts, media, permalinks, and top-comment previews. MCP optimized for SEO and AI agents. $0.002/post.",
        "version": "0.1",
        "x-build-id": "hugyLE8bbm2Zsifiw"
    },
    "servers": [
        {
            "url": "https://api.apify.com/v2"
        }
    ],
    "paths": {
        "/acts/khadinakbar~reddit-posts-search-scraper/run-sync-get-dataset-items": {
            "post": {
                "operationId": "run-sync-get-dataset-items-khadinakbar-reddit-posts-search-scraper",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor, waits for its completion, and returns Actor's dataset items in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK"
                    }
                }
            }
        },
        "/acts/khadinakbar~reddit-posts-search-scraper/runs": {
            "post": {
                "operationId": "runs-sync-khadinakbar-reddit-posts-search-scraper",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor and returns information about the initiated run in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/runsResponseSchema"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/acts/khadinakbar~reddit-posts-search-scraper/run-sync": {
            "post": {
                "operationId": "run-sync-khadinakbar-reddit-posts-search-scraper",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor, waits for completion, and returns the OUTPUT from Key-value store in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK"
                    }
                }
            }
        }
    },
    "components": {
        "schemas": {
            "inputSchema": {
                "type": "object",
                "required": [
                    "queries"
                ],
                "properties": {
                    "queries": {
                        "title": "Search queries",
                        "type": "array",
                        "description": "Keywords, phrases, brands, competitors, products, pain points, or natural-language topics to search on Reddit. AI agents should put the main user request here.",
                        "items": {
                            "type": "string"
                        }
                    },
                    "subreddits": {
                        "title": "Limit to subreddits (optional)",
                        "type": "array",
                        "description": "Optional subreddit names or URLs. Leave empty for global Reddit search. When set, every query is searched inside each subreddit. Accepts r/SEO, SEO, or https://www.reddit.com/r/SEO.",
                        "items": {
                            "type": "string"
                        }
                    },
                    "sort": {
                        "title": "Search sort",
                        "enum": [
                            "relevance",
                            "new",
                            "top",
                            "comments",
                            "hot"
                        ],
                        "type": "string",
                        "description": "How Reddit orders matching posts. Relevance is best for research and AI agents, new is best for monitoring, top is best for high-signal historical posts, comments finds active discussions, and hot finds currently trending matches.",
                        "default": "relevance"
                    },
                    "timeRange": {
                        "title": "Time range",
                        "enum": [
                            "hour",
                            "day",
                            "week",
                            "month",
                            "year",
                            "all"
                        ],
                        "type": "string",
                        "description": "Time window for search results. Use week or month for current market research, year or all for evergreen SEO research.",
                        "default": "month"
                    },
                    "maxPosts": {
                        "title": "Max posts",
                        "minimum": 1,
                        "maximum": 200000,
                        "type": "integer",
                        "description": "Maximum number of unique post records to return across all queries and subreddits. Billing stops when this cap is reached.",
                        "default": 100
                    },
                    "includeTopComments": {
                        "title": "Include top comment previews",
                        "type": "boolean",
                        "description": "When true, each post record includes a compact topComments array. Use this for AI summaries and sentiment analysis. Leave off for faster, cheaper post-only extraction.",
                        "default": false
                    },
                    "maxTopCommentsPerPost": {
                        "title": "Max top comments per post",
                        "minimum": 1,
                        "maximum": 100,
                        "type": "integer",
                        "description": "Maximum number of top comments to embed in each post when includeTopComments is enabled.",
                        "default": 5
                    },
                    "postDateLimit": {
                        "title": "Ignore posts older than",
                        "type": "string",
                        "description": "Optional ISO date. Example: 2026-01-01. Posts older than this are skipped after retrieval."
                    },
                    "includeNsfw": {
                        "title": "Include NSFW posts",
                        "type": "boolean",
                        "description": "Disabled by default for business research and AI-agent workflows. Enable only when you intentionally need NSFW Reddit content.",
                        "default": false
                    },
                    "proxy": {
                        "title": "Proxy configuration",
                        "type": "object",
                        "description": "Proxy settings. Defaults to Apify Residential proxies because Reddit often blocks datacenter IPs. Leave unchanged unless you know your target and plan requirements.",
                        "default": {
                            "useApifyProxy": true,
                            "apifyProxyGroups": [
                                "RESIDENTIAL"
                            ]
                        }
                    },
                    "redditClientId": {
                        "title": "Reddit client ID (optional)",
                        "type": "string",
                        "description": "Optional Reddit app client ID. Leave blank to use owner-managed access when configured. Create a free app at reddit.com/prefs/apps if you want to use your own credentials."
                    },
                    "redditClientSecret": {
                        "title": "Reddit client secret (optional)",
                        "type": "string",
                        "description": "Optional Reddit app client secret paired with redditClientId. This is not your Reddit password."
                    }
                }
            },
            "runsResponseSchema": {
                "type": "object",
                "properties": {
                    "data": {
                        "type": "object",
                        "properties": {
                            "id": {
                                "type": "string"
                            },
                            "actId": {
                                "type": "string"
                            },
                            "userId": {
                                "type": "string"
                            },
                            "startedAt": {
                                "type": "string",
                                "format": "date-time",
                                "example": "2025-01-08T00:00:00.000Z"
                            },
                            "finishedAt": {
                                "type": "string",
                                "format": "date-time",
                                "example": "2025-01-08T00:00:00.000Z"
                            },
                            "status": {
                                "type": "string",
                                "example": "READY"
                            },
                            "meta": {
                                "type": "object",
                                "properties": {
                                    "origin": {
                                        "type": "string",
                                        "example": "API"
                                    },
                                    "userAgent": {
                                        "type": "string"
                                    }
                                }
                            },
                            "stats": {
                                "type": "object",
                                "properties": {
                                    "inputBodyLen": {
                                        "type": "integer",
                                        "example": 2000
                                    },
                                    "rebootCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "restartCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "resurrectCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "computeUnits": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            },
                            "options": {
                                "type": "object",
                                "properties": {
                                    "build": {
                                        "type": "string",
                                        "example": "latest"
                                    },
                                    "timeoutSecs": {
                                        "type": "integer",
                                        "example": 300
                                    },
                                    "memoryMbytes": {
                                        "type": "integer",
                                        "example": 1024
                                    },
                                    "diskMbytes": {
                                        "type": "integer",
                                        "example": 2048
                                    }
                                }
                            },
                            "buildId": {
                                "type": "string"
                            },
                            "defaultKeyValueStoreId": {
                                "type": "string"
                            },
                            "defaultDatasetId": {
                                "type": "string"
                            },
                            "defaultRequestQueueId": {
                                "type": "string"
                            },
                            "buildNumber": {
                                "type": "string",
                                "example": "1.0.0"
                            },
                            "containerUrl": {
                                "type": "string"
                            },
                            "usage": {
                                "type": "object",
                                "properties": {
                                    "ACTOR_COMPUTE_UNITS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_WRITES": {
                                        "type": "integer",
                                        "example": 1
                                    },
                                    "KEY_VALUE_STORE_LISTS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_INTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_EXTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_RESIDENTIAL_TRANSFER_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_SERPS": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            },
                            "usageTotalUsd": {
                                "type": "number",
                                "example": 0.00005
                            },
                            "usageUsd": {
                                "type": "object",
                                "properties": {
                                    "ACTOR_COMPUTE_UNITS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_WRITES": {
                                        "type": "number",
                                        "example": 0.00005
                                    },
                                    "KEY_VALUE_STORE_LISTS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_INTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_EXTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_RESIDENTIAL_TRANSFER_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_SERPS": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }
}
```
