{
  "openapi": "3.0.1",
  "info": {
    "title": "Reddit Comments Scraper",
    "description": "Use Reddit Comments Scraper to gather Reddit comment data at scale. Capture comment threads, upvotes, authors, and posting time to analyze discussions, audience sentiment, and community engagement patterns.",
    "version": "0.1",
    "x-build-id": "R16lITGarySxROhLM"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/scrapio~reddit-comments-scraper/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-scrapio-reddit-comments-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-comments-scraper/runs": {
      "post": {
        "operationId": "runs-sync-scrapio-reddit-comments-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-comments-scraper/run-sync": {
      "post": {
        "operationId": "run-sync-scrapio-reddit-comments-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": [
          "startUrls"
        ],
        "properties": {
          "startUrls": {
            "title": "🔗 Reddit URLs (posts, subreddits or users)",
            "type": "array",
            "description": "Paste one or more Reddit URLs. Supported:\n• Post URL → scrapes its comments (e.g. https://www.reddit.com/r/ChatGPT/comments/1epeshq/these_are_all_ai/)\n• Subreddit URL → auto-discovers the latest posts and scrapes each (e.g. https://www.reddit.com/r/ChatGPT/)\n• User URL → scrapes that user's recent comments (e.g. https://www.reddit.com/user/spez/)\nBare post IDs and redd.it short links are also accepted.",
            "items": {
              "type": "string"
            }
          },
          "sortOrder": {
            "title": "🔀 Comment Sort Order",
            "enum": [
              "best",
              "top",
              "new",
              "controversial",
              "old",
              "qa",
              "hot"
            ],
            "type": "string",
            "description": "How Reddit sorts the comment thread before scraping. 'Best' (confidence) surfaces the highest-quality comments first; 'Top' the highest-scored; 'New' the newest. Default: Top.",
            "default": "top"
          },
          "maxComments": {
            "title": "🔢 Max Top-Level Comments per Post",
            "minimum": 0,
            "maximum": 10000,
            "type": "integer",
            "description": "Maximum number of TOP-LEVEL comments to collect from each post. Replies are additional and capped separately by 'Max Replies per Comment'. Set 0 for unlimited. Example: maxComments=10 + maxRepliesPerComment=3 → up to 10 comments plus up to 3 replies each. Default: 50.",
            "default": 50
          },
          "includeReplies": {
            "title": "↩️ Include Replies",
            "type": "boolean",
            "description": "Collect nested replies (child comments) in addition to top-level comments. Reply rows are labelled type='reply', isReply=true, linked to their parent via parentId, and mirrored to a per-run 'replies-<runId>' dataset. Default: true.",
            "default": true
          },
          "maxRepliesPerComment": {
            "title": "🌳 Max Replies per Comment",
            "minimum": 0,
            "maximum": 5000,
            "type": "integer",
            "description": "Maximum reply rows (all nesting levels) to collect under each top-level comment. Set 0 for unlimited. Only applies when 'Include Replies' is on. Default: 10.",
            "default": 10
          },
          "includePost": {
            "title": "📌 Include Post Record",
            "type": "boolean",
            "description": "Emit one row (type='post') per post with the submission details: title, selftext, score, upvote ratio, number of comments, author and creation date. Default: true.",
            "default": true
          },
          "maxPosts": {
            "title": "📰 Max Posts per Subreddit / User (discovery)",
            "minimum": 1,
            "maximum": 250,
            "type": "integer",
            "description": "When a subreddit or user URL is provided, how many posts to auto-discover and scrape. Ignored for direct post URLs. Default: 10.",
            "default": 10
          },
          "keywords": {
            "title": "🔍 Keywords (include)",
            "type": "array",
            "description": "Only keep comments whose text contains at least one of these words/phrases (case-insensitive). Leave empty to keep all. Does not filter out the post record.",
            "items": {
              "type": "string"
            }
          },
          "excludeKeywords": {
            "title": "🚫 Exclude Keywords",
            "type": "array",
            "description": "Drop comments whose text contains any of these words/phrases (case-insensitive).",
            "items": {
              "type": "string"
            }
          },
          "minScore": {
            "title": "⬆️ Minimum Score (upvotes)",
            "type": "integer",
            "description": "Only keep comments with at least this many upvotes (score). Default: 0 (keep all). Note: scores can be negative on Reddit.",
            "default": 0
          },
          "oldestDate": {
            "title": "📅 Oldest Date",
            "type": "string",
            "description": "Only keep comments created on or after this date. Accepts an absolute date (YYYY-MM-DD) or a relative value like '7 days', '3 months'. Leave empty for no date filter."
          },
          "excludeDeleted": {
            "title": "🗑️ Exclude Deleted / Removed",
            "type": "boolean",
            "description": "Skip comments whose author or body is [deleted] or [removed]. Default: false.",
            "default": false
          },
          "excludeAutoMod": {
            "title": "🤖 Exclude AutoModerator",
            "type": "boolean",
            "description": "Skip comments posted by AutoModerator (bot stickies/rules). Default: false.",
            "default": false
          },
          "onlyOP": {
            "title": "👑 Only Original Poster (OP)",
            "type": "boolean",
            "description": "Keep only comments written by the post's original poster (is_submitter=true). Default: false.",
            "default": false
          },
          "aiEnhancement": {
            "title": "🤖 Enable AI Enrichment",
            "type": "boolean",
            "description": "Analyze each comment's text with an LLM to add sentiment, emotion, topics, language and a toxicity score. Requires an API key below (or the matching provider env var). Adds cost and runtime. 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/lite models are recommended for classification.",
            "default": "claude-haiku-4-5"
          },
          "aiApiKey": {
            "title": "🔑 AI API Key",
            "type": "string",
            "description": "API key for the selected provider. Optional if the matching env var is set on the Actor (ANTHROPIC_API_KEY / OPENAI_API_KEY / GEMINI_API_KEY / XAI_API_KEY / DEEPSEEK_API_KEY / PERPLEXITY_API_KEY / MISTRAL_API_KEY)."
          },
          "proxyConfiguration": {
            "title": "🌐 Proxy Configuration",
            "type": "object",
            "description": "Reddit rate-limits and blocks datacenter IPs on its public JSON endpoints, so RESIDENTIAL proxy is strongly recommended for reliable results. Your selection here is honored exactly — no hidden fallback. Leave proxy off to connect directly (may be blocked by Reddit)."
          }
        }
      },
      "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
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}