{
  "openapi": "3.0.1",
  "info": {
    "title": "Reddit Post & Modqueue Scraper — MCP, Community Intel + AI",
    "description": "RAG-ready Reddit feed with 99%+ run success — posts, comments, modqueue, sentiment at $0.002/post, no OAuth. MCP-compatible alternative to Brandwatch/Sprout/Mention ($4 vs $249/mo). AI digest across 5 LLM providers. Trudax-grade with bonus moderation. x402-ready.",
    "version": "1.9",
    "x-build-id": "NBRgFzws7fthFtzFb"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/harvestlab~reddit-scraper/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-harvestlab-reddit-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/harvestlab~reddit-scraper/runs": {
      "post": {
        "operationId": "runs-sync-harvestlab-reddit-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/harvestlab~reddit-scraper/run-sync": {
      "post": {
        "operationId": "run-sync-harvestlab-reddit-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",
        "properties": {
          "mode": {
            "title": "Scraping Mode",
            "enum": [
              "subreddit",
              "search",
              "modqueue"
            ],
            "type": "string",
            "description": "Choose whether to browse a specific subreddit, search across Reddit, or scrape a moderation queue. Moderation Queue mode requires moderator credentials (see Reddit OAuth section below) and charges a separate PPE event per item.",
            "default": "subreddit"
          },
          "subreddit": {
            "title": "Subreddit",
            "type": "string",
            "description": "Subreddit name without r/ (e.g. \"python\", \"webdev\", \"startups\"). Used in subreddit mode."
          },
          "searchQuery": {
            "title": "Search Query",
            "type": "string",
            "description": "Search query to find posts across Reddit. Used in 'search' mode only (ignored for 'subreddit' mode). Examples: 'AI agents', 'remote jobs', 'startup mistakes'."
          },
          "searchSubreddit": {
            "title": "Search Scope (Subreddit)",
            "type": "string",
            "description": "Subreddit to scope the search to (without r/ prefix). Leave as \"all\" to search across all of Reddit (equivalent to r/all). Scoping to a specific subreddit (e.g. \"python\", \"datascience\") is far more reliable because Reddit's bot filters are aggressive on the site-wide /search endpoint. Used in search mode only.",
            "default": "all"
          },
          "sortBy": {
            "title": "Sort By",
            "enum": [
              "hot",
              "top",
              "new",
              "rising",
              "relevance"
            ],
            "type": "string",
            "description": "How to sort the results. \"Most Relevant\" only applies to search mode.",
            "default": "hot"
          },
          "timeFilter": {
            "title": "Time Filter",
            "enum": [
              "hour",
              "day",
              "week",
              "month",
              "year",
              "all"
            ],
            "type": "string",
            "description": "Time period for filtering results. Applies to \"Top\" and \"Most Relevant\" sort modes.",
            "default": "week"
          },
          "maxPosts": {
            "title": "Max Posts",
            "minimum": 1,
            "maximum": 100,
            "type": "integer",
            "description": "Maximum number of posts to scrape. Each Reddit page shows ~25 posts; higher values paginate.",
            "default": 25
          },
          "maxItems": {
            "title": "Max Items (CLI alias)",
            "minimum": 1,
            "maximum": 100,
            "type": "integer",
            "description": "CLI alias for maxPosts. Hidden from Console form; exposed so `apify call -i '{\"maxItems\":5}'` works consistently across the portfolio."
          },
          "includeComments": {
            "title": "Include Comments",
            "type": "boolean",
            "description": "Scrape top-level comments for each post. Also enriches each post with `selftext` (full post body) and `upvote_ratio` from the post-detail page — fields that aren't available in listing markup. Adds ~2-3s per post.",
            "default": false
          },
          "maxCommentsPerPost": {
            "title": "Max Comments per Post",
            "minimum": 1,
            "maximum": 50,
            "type": "integer",
            "description": "Maximum number of top-level comments to scrape per post. Replies to comments are not scraped.",
            "default": 10
          },
          "modqueueFeed": {
            "title": "Moderation Feed",
            "enum": [
              "modqueue",
              "reports",
              "spam",
              "unmoderated"
            ],
            "type": "string",
            "description": "Which moderation feed to scrape (used only when mode = 'Moderation Queue'). 'modqueue' = all items awaiting moderator action (reports + auto-filtered spam + new submissions awaiting approval). 'reports' = items with user reports. 'spam' = items auto-classified as spam by Reddit. 'unmoderated' = never-actioned-on posts (useful for catching what fell through the cracks).",
            "default": "modqueue"
          },
          "modqueueOnly": {
            "title": "Item Type Filter (Modqueue)",
            "enum": [
              "",
              "links",
              "comments"
            ],
            "type": "string",
            "description": "Narrow the moderation feed to posts only or comments only. Leave as 'Both' to return everything. Applies only in Moderation Queue mode.",
            "default": ""
          },
          "useJsonApi": {
            "title": "Use Reddit OAuth JSON API",
            "type": "boolean",
            "description": "Opt in to the authenticated Reddit JSON API. Requires your own Reddit app credentials (redditClientId + redditClientSecret). Benefits: upvote_ratio populated on every post (not just PDP-enriched ones), subreddit_subscribers, awards_count, author_flair, edited/distinguished/num_crossposts flags, and ~3x higher rate limit (~100 req/min vs ~30 req/min unauthenticated). Zero HTML-parsing intermittency. Register an app at https://www.reddit.com/prefs/apps (type: \"script\" — simplest). Falls back to HTML scraping on any auth error.",
            "default": false
          },
          "redditClientId": {
            "title": "Reddit Client ID",
            "type": "string",
            "description": "Your Reddit app's client ID (the short string shown under the app name in https://www.reddit.com/prefs/apps). Required when useJsonApi is enabled. Alternatively set REDDIT_CLIENT_ID env var."
          },
          "redditClientSecret": {
            "title": "Reddit Client Secret",
            "type": "string",
            "description": "Your Reddit app's secret (shown in https://www.reddit.com/prefs/apps). Required when useJsonApi is enabled. Alternatively set REDDIT_CLIENT_SECRET env var. For 'script' type apps the secret is shown directly; for 'web app' type follow Reddit's OAuth docs."
          },
          "redditUsername": {
            "title": "Reddit Username (modqueue mode)",
            "type": "string",
            "description": "Reddit username of a moderator of the target subreddit. Required for modqueue mode with password grant. Works only for 'script' type Reddit apps where this user is listed as a developer on the app. Alternatively set REDDIT_USERNAME env var. For web apps, use redditRefreshToken instead."
          },
          "redditPassword": {
            "title": "Reddit Password (modqueue mode)",
            "type": "string",
            "description": "Reddit password for the moderator account. Required for modqueue mode password grant. Alternatively set REDDIT_PASSWORD env var. Use an app password if 2FA is enabled. Prefer redditRefreshToken for production pipelines."
          },
          "redditRefreshToken": {
            "title": "Reddit Refresh Token (modqueue mode, preferred)",
            "type": "string",
            "description": "Pre-obtained Reddit OAuth refresh token (issued via the authorization code flow for a 'web app' type Reddit app with 'modposts' + 'read' scopes). Preferred over username/password for production. Alternatively set REDDIT_REFRESH_TOKEN env var. See the README 'Modqueue OAuth setup' section for how to mint a refresh token."
          },
          "enableAiAnalysis": {
            "title": "Enable AI Analysis",
            "type": "boolean",
            "description": "Generate AI-powered sentiment and trend analysis from the scraped posts. Requires an API key for your chosen LLM provider.",
            "default": false
          },
          "llmProvider": {
            "title": "LLM Provider",
            "enum": [
              "openrouter",
              "anthropic",
              "google",
              "openai",
              "ollama"
            ],
            "type": "string",
            "description": "AI backend for sentiment/trend analysis. 'OpenRouter' (default) is cheapest — Gemini Flash via OpenRouter is ~$0.001 per analysis. 'Anthropic' = Claude, 'Google AI' = Gemini direct, 'OpenAI' = GPT-4o mini, 'Ollama' = self-hosted (no API cost). Each provider needs its own API key field below.",
            "default": "openrouter"
          },
          "llmModel": {
            "title": "LLM Model",
            "type": "string",
            "description": "Specific model to use. Leave empty for the provider default (google/gemini-2.0-flash-001 for OpenRouter, claude-sonnet-4-20250514 for Anthropic, gemini-2.0-flash for Google AI, gpt-4o-mini for OpenAI, llama3.1 for Ollama)."
          },
          "openrouterApiKey": {
            "title": "OpenRouter API Key",
            "type": "string",
            "description": "Your OpenRouter API key. Get one at openrouter.ai/keys"
          },
          "anthropicApiKey": {
            "title": "Anthropic API Key",
            "type": "string",
            "description": "Your Anthropic API key. Get one at console.anthropic.com"
          },
          "googleApiKey": {
            "title": "Google AI API Key",
            "type": "string",
            "description": "API key for Google AI (Gemini). Get one at aistudio.google.com/app/apikey"
          },
          "openaiApiKey": {
            "title": "OpenAI API Key",
            "type": "string",
            "description": "API key from platform.openai.com (required if using OpenAI provider)"
          },
          "ollamaBaseUrl": {
            "title": "Ollama Base URL",
            "type": "string",
            "description": "Base URL for Ollama API. Default: http://localhost:11434"
          },
          "proxyConfiguration": {
            "title": "Proxy Configuration",
            "type": "object",
            "description": "Proxy settings. Reddit rate-limits and 429-blocks datacenter IPs at scale — RESIDENTIAL (default) is strongly recommended, especially for runs >50 posts or repeated calls within a few minutes. Reddit detects curl_cffi TLS impersonation, so this actor uses plain httpx with rotating User-Agents — proxy rotation is the main anti-block lever."
          }
        }
      },
      "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
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}