{
  "openapi": "3.0.1",
  "info": {
    "title": "Reddit Posts Scraper: Comment Thread Analysis",
    "description": "Reddit Posts Scraper extracts posts with full comment threads, including post titles, content, authors, scores, comments, replies, timestamps, and URLs. Ideal for community research, sentiment analysis, engagement tracking, topic discovery, and market intelligence.",
    "version": "0.1",
    "x-build-id": "jLN0FvegpGWvc81xw"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/scrapio~reddit-posts-scraper/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-scrapio-reddit-posts-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/scrapio~reddit-posts-scraper/runs": {
      "post": {
        "operationId": "runs-sync-scrapio-reddit-posts-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/scrapio~reddit-posts-scraper/run-sync": {
      "post": {
        "operationId": "run-sync-scrapio-reddit-posts-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": {
          "redditSources": {
            "title": "🔗 Subreddits, post URLs, or keywords",
            "type": "array",
            "description": "One entry per line. Mix and match:\n• 📌 Subreddit names — e.g. news or r/technology\n• 🌐 Full Reddit URLs — e.g. https://www.reddit.com/r/news/\n• 🔍 Search keywords — e.g. artificial intelligence\n\nEach post found here is scraped together with its comment thread. (Legacy field name `startUrls` is also accepted.)",
            "items": {
              "type": "string"
            }
          },
          "postLimit": {
            "title": "📄 Posts per source",
            "minimum": 1,
            "maximum": 100,
            "type": "integer",
            "description": "Maximum posts to scrape per subreddit/keyword (1–100). old.reddit serves up to ~100 posts on one page. Example: 3 sources × 25 = up to 75 posts. Accepts legacy `maxPosts`. Default 10.",
            "default": 10
          },
          "commentLimit": {
            "title": "💬 Comments per post",
            "minimum": 0,
            "maximum": 1000,
            "type": "integer",
            "description": "Maximum comments to walk per post, counted across the whole thread including nested replies (0–1000). Set 0 to skip comments and get posts only (faster). Accepts legacy `maxComments`. Default 5.",
            "default": 5
          },
          "maxCommentDepth": {
            "title": "🪜 Maximum reply depth",
            "minimum": 0,
            "type": "integer",
            "description": "How deep to follow reply chains. 0 = unlimited depth. Example: 1 = only top-level comments and their direct replies. Default 10.",
            "default": 10
          },
          "includeCommentRows": {
            "title": "🧵 Emit comment child rows",
            "type": "boolean",
            "description": "When ON, every comment is written as its own flat row (type=comment, isChild=true, parentId, depth) in the dataset and mirrored to a per-run child dataset. When OFF, comments only appear as the nested `comments` array on the post row. Default true.",
            "default": true
          },
          "includeEngagementRollup": {
            "title": "📊 Add per-post engagement rollup",
            "type": "boolean",
            "description": "Adds topCommenters, topComment (most upvoted), commentDepthMax, commenterCount, and avgCommentScore to each post row. Default true.",
            "default": true
          },
          "topCommentersCount": {
            "title": "🏅 Top commenters to surface",
            "minimum": 0,
            "type": "integer",
            "description": "How many of the most active commenters (by comment count, then score) to list in each post's topCommenters array. Default 5.",
            "default": 5
          },
          "postSort": {
            "title": "📋 Post sort order",
            "enum": [
              "hot",
              "new",
              "top",
              "rising"
            ],
            "type": "string",
            "description": "How Reddit sorts posts before scraping. Hot = trending, New = latest, Top = most upvoted, Rising = gaining traction. Accepts legacy `sortOrder`.",
            "default": "top"
          },
          "timeRange": {
            "title": "⏱️ Time range",
            "enum": [
              "hour",
              "day",
              "week",
              "month",
              "year",
              "all"
            ],
            "type": "string",
            "description": "Time window for results. Only applies when sort is Top or Rising; ignored otherwise. Accepts legacy `timeFilter`.",
            "default": "week"
          },
          "aiCommentAnalysis": {
            "title": "🤖 Analyze comment threads with AI",
            "type": "boolean",
            "description": "Turn on LLM analysis of each comment thread (adds aiThreadSentiment, aiControversyScore, aiTopTopics, aiThreadSummary). Requires an API key below. Default false.",
            "default": false
          },
          "aiModel": {
            "title": "🤖 AI model / provider",
            "enum": [
              "claude-haiku-4-5",
              "claude-sonnet-5",
              "claude-opus-4-8",
              "gpt-4o-mini",
              "gpt-4o",
              "gpt-4.1-mini",
              "o3-mini",
              "gemini-2.0-flash-lite",
              "gemini-2.0-flash",
              "gemini-2.5-flash",
              "grok-3-mini",
              "deepseek-chat",
              "sonar",
              "mistral-small-latest"
            ],
            "type": "string",
            "description": "Provider auto-detected from the name: claude-*=Anthropic, gpt-*/o1/o3=OpenAI, gemini-*=Google, grok-*=xAI, deepseek-*=DeepSeek, sonar*=Perplexity, mistral-*=Mistral. Cheaper mini/flash/haiku models are recommended for classification.",
            "default": "claude-haiku-4-5"
          },
          "aiApiKey": {
            "title": "🔑 AI API key",
            "type": "string",
            "description": "API key for the selected provider. Only used when AI analysis is ON. Falls back to the provider env var (ANTHROPIC_API_KEY / OPENAI_API_KEY / GEMINI_API_KEY / XAI_API_KEY / DEEPSEEK_API_KEY / PERPLEXITY_API_KEY / MISTRAL_API_KEY) if left blank."
          },
          "proxyConfiguration": {
            "title": "🔐 Proxy configuration",
            "type": "object",
            "description": "Proxy selection. If Reddit blocks a request, the actor auto-escalates: no proxy → datacenter → residential. Residential is recommended for reliable Reddit access."
          }
        }
      },
      "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
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}