{
  "openapi": "3.0.1",
  "info": {
    "title": "Reddit API Scraper With Comment Threads",
    "description": "Reddit API Scraper — Scrape Reddit posts with complete comment threads, including nested replies, authors, scores, timestamps, and engagement metrics. Extract structured discussion data for audience research, sentiment analysis, trend discovery, and community insights.",
    "version": "0.1",
    "x-build-id": "0Xan2eOepbDtsfUi9"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/simpleapi~reddit-api-scraper/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-simpleapi-reddit-api-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/simpleapi~reddit-api-scraper/runs": {
      "post": {
        "operationId": "runs-sync-simpleapi-reddit-api-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/simpleapi~reddit-api-scraper/run-sync": {
      "post": {
        "operationId": "run-sync-simpleapi-reddit-api-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": {
          "startUrls": {
            "title": "🔗 Reddit post URLs",
            "type": "array",
            "description": "Optional. Paste one or more direct Reddit post/thread URLs (permalinks) to fetch that exact post plus its full comment thread. Example: https://www.reddit.com/r/webscraping/comments/abc123/some_title/. Can be used together with or instead of Search keywords below.",
            "items": {
              "type": "string"
            }
          },
          "searchKeywords": {
            "title": "🔑 Search keywords",
            "type": "array",
            "description": "Words or phrases to search on Reddit (e.g. webscraping, python, ChatGPT). One keyword per line in bulk mode; each keyword is searched separately and results are grouped by keyword. Optional if Reddit post URLs above are provided.",
            "items": {
              "type": "string"
            }
          },
          "subredditNames": {
            "title": "📌 Subreddit names",
            "type": "array",
            "description": "Optional. Restrict keyword search to specific subreddits only (e.g. python, programming). Leave empty to search all of Reddit. Ignored for direct post URLs.",
            "items": {
              "type": "string"
            }
          },
          "resultsLimitPerKeyword": {
            "title": "📊 Results limit per keyword",
            "minimum": 1,
            "maximum": 1000,
            "type": "integer",
            "description": "Maximum number of posts to fetch per keyword (1–1000). Only applies to keyword search, not direct post URLs. Default: 10.",
            "default": 10
          },
          "sorting": {
            "title": "📅 Post sort order",
            "enum": [
              "new",
              "hot",
              "top",
              "relevance"
            ],
            "type": "string",
            "description": "How keyword search results are ordered when no subreddit is given (a global keyword search): New (latest first), Hot/Top (highest-scored first), or Relevance (best match, scored). When one or more subreddit names are set, results are always returned newest-first regardless of this setting. Default: New.",
            "default": "new"
          },
          "includeComments": {
            "title": "💬 Include comment threads",
            "type": "boolean",
            "description": "When on, the actor also fetches the full nested comment tree for every post (from keyword search and from direct URLs) and saves each comment as its own dataset row. Turn off to collect posts only (faster, fewer rows).",
            "default": true
          },
          "maxCommentsPerPost": {
            "title": "🔢 Max comments per post",
            "minimum": 1,
            "maximum": 10000,
            "type": "integer",
            "description": "Maximum number of comments to save per post (1–10000). Applies once per post, whether it came from search or a direct URL. Default: 100.",
            "default": 100
          },
          "commentSort": {
            "title": "🧵 Comment sort order",
            "enum": [
              "best",
              "top",
              "new",
              "controversial",
              "old",
              "qa"
            ],
            "type": "string",
            "description": "Order in which Reddit returns comments for each post: Best, Top, New, Controversial, Old, or Q&A. Default: Best.",
            "default": "best"
          },
          "replyDepth": {
            "title": "🌳 Reply depth",
            "minimum": 0,
            "maximum": 20,
            "type": "integer",
            "description": "How many reply levels deep to follow under each top-level comment. 0 = top-level comments only (no nested replies collected). Higher values collect more nested replies but take longer and use more comment quota. Default: 3.",
            "default": 3
          },
          "maxRetries": {
            "title": "🔁 Max retries per request",
            "minimum": 1,
            "maximum": 10,
            "type": "integer",
            "description": "How many times to retry a single request after a temporary network hiccup or rate limit before giving up on it. Default: 3.",
            "default": 3
          }
        }
      },
      "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
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}