{
  "openapi": "3.0.1",
  "info": {
    "title": "Reddit Comment & Top Ranking Scraper",
    "description": "Automatically extract Reddit comments and replies using Reddit Comments Scraper. Collect comment text, usernames, scores, and timestamps to support sentiment tracking, brand monitoring, and community research.",
    "version": "0.1",
    "x-build-id": "0J2UJj99wjPmNy7hy"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/api-empire~reddit-comment-scraper/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-api-empire-reddit-comment-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/api-empire~reddit-comment-scraper/runs": {
      "post": {
        "operationId": "runs-sync-api-empire-reddit-comment-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/api-empire~reddit-comment-scraper/run-sync": {
      "post": {
        "operationId": "run-sync-api-empire-reddit-comment-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": {
          "redditPostUrls": {
            "title": "🔗 Reddit Post URLs to Rank",
            "type": "array",
            "description": "📋 Paste one or more Reddit post URLs. Each post's comments are fetched, ranked by upvotes, and (optionally) merged into a cross-post leaderboard.\n\nExample: https://www.reddit.com/r/subreddit/comments/post_id/title/\n\nAlso accepts the base field name `startUrls` for backward compatibility.",
            "items": {
              "type": "string"
            }
          },
          "maxCommentsPerPost": {
            "title": "🔢 Maximum Comments per Post",
            "minimum": 1,
            "maximum": 10000,
            "type": "integer",
            "description": "⚙️ Maximum number of comments to extract and rank per post. Range: 1-10,000. Also accepts the base field name `maxComments`."
          },
          "maxReplyDepth": {
            "title": "💬 Reply Depth per Comment",
            "minimum": 0,
            "maximum": 100,
            "type": "integer",
            "description": "🌳 How many LEVELS of nested replies to embed inside each comment's `replies` field (1 = direct replies only, 2 = replies + their replies, 0 = unlimited depth). This only shapes the nested `replies` field — every reply is still scraped, ranked and returned as its own flat row regardless of this value. Use 🔢 Maximum Comments per Post to cap volume. Also accepts the legacy field name `replyLimit`."
          },
          "sortMode": {
            "title": "📶 Reddit Fetch Sort Mode",
            "enum": [
              "hot",
              "new",
              "top",
              "controversial",
              "old"
            ],
            "type": "string",
            "description": "🔽 The comment order Reddit itself serves — this genuinely changes WHICH comments you get, not just their order, because Reddit only returns a slice of a large thread. Use ⬆️ Top for real top-ranked comments, 🆕 New for the latest ones, 🕰️ Old together with 📅 Only Comments Until to reach older parts of a thread. `rank_in_post` is always recomputed from real upvotes. Also accepts the legacy field name `sortOrder`."
          },
          "searchUrls": {
            "title": "🌐 Subreddit / Search URLs",
            "type": "array",
            "description": "🕵️ Paste subreddit listing URLs (e.g. https://www.reddit.com/r/ChatGPT/) or Reddit search URLs (e.g. https://www.reddit.com/r/ChatGPT/search/?q=gpt5) to discover posts to rank, instead of pasting individual post URLs.",
            "items": {
              "type": "string"
            }
          },
          "searchQuery": {
            "title": "🔑 Keyword Search Query",
            "type": "string",
            "description": "💡 A plain keyword/phrase to search Reddit site-wide for matching posts (used together with or instead of 🌐 Subreddit / Search URLs)."
          },
          "maxPostsToDiscover": {
            "title": "🔢 Max Posts to Discover",
            "minimum": 1,
            "maximum": 500,
            "type": "integer",
            "description": "📈 Maximum number of posts to discover in total from 🌐 Subreddit / Search URLs and 🔑 Keyword Search Query combined. Ignored when only direct 🔗 Reddit Post URLs are used.",
            "default": 10
          },
          "safeSearch": {
            "title": "🚫 Exclude NSFW Posts from Discovery",
            "type": "boolean",
            "description": "🔞 When enabled, skip over_18/NSFW posts found via discovery. Has no effect on directly-provided 🔗 Reddit Post URLs.",
            "default": false
          },
          "sinceDate": {
            "title": "📅 Only Comments Since",
            "type": "string",
            "description": "⏱️ Only rank comments created on/after this date. Accepts an absolute date or a relative value like `3 days`/`1 week`."
          },
          "untilDate": {
            "title": "📅 Only Comments Until",
            "type": "string",
            "description": "⏱️ Only rank comments created on/before this date. Accepts an absolute date or a relative value like `3 days`/`1 week`."
          },
          "enrichAuthorProfile": {
            "title": "🏅 Enrich Author Karma & Account Age",
            "type": "boolean",
            "description": "📈 When enabled, adds an `authorProfile` object (post/comment/total karma, account creation date, trophy list, Reddit Premium status) to every comment row, resolved once per unique author (max 300 unique authors per run).",
            "default": false
          },
          "enableCrossPostRanking": {
            "title": "🏆 Merge Comments Across All Posts into One Leaderboard",
            "type": "boolean",
            "description": "📊 When enabled, the top comments from every submitted post are merged by upvotes into a single cross-post leaderboard (`topCommentsAcrossPosts`), saved as a named dataset and to the key-value store. When disabled, only the per-post ranked rows are produced (matches base behavior).",
            "default": false
          },
          "crossPostLeaderboardSize": {
            "title": "🥇 Cross-Post Leaderboard Size",
            "minimum": 1,
            "maximum": 500,
            "type": "integer",
            "description": "🔝 Maximum number of top-ranked comments to keep in the merged cross-post leaderboard when 'Merge Comments Across All Posts' is enabled. Ignored otherwise.",
            "default": 50
          },
          "proxyConfiguration": {
            "title": "🛡️ Proxy Configuration (Direct → Your Choice → Fallback)",
            "type": "object",
            "description": "🔒 Configure proxy settings. Your selection here is tried first (after a direct attempt); if it fails, the scraper automatically falls back through datacenter then residential proxies with retries. By default, no proxy is used."
          }
        }
      },
      "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
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}