{
  "openapi": "3.0.1",
  "info": {
    "title": "Reddit Scraper",
    "description": "Scrape Reddit posts, threads, and comments from any subreddit, search, or user — clean structured JSON, fast.",
    "version": "0.1",
    "x-build-id": "r7cAxLOfrKbPze0pR"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/alwaysprimedev~reddit-scraper/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-alwaysprimedev-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/alwaysprimedev~reddit-scraper/runs": {
      "post": {
        "operationId": "runs-sync-alwaysprimedev-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/alwaysprimedev~reddit-scraper/run-sync": {
      "post": {
        "operationId": "run-sync-alwaysprimedev-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": {
          "searchType": {
            "title": "What to scrape",
            "enum": [
              "subreddit",
              "search",
              "user",
              "urls"
            ],
            "type": "string",
            "description": "Choose the source of posts: a subreddit's listing, a keyword search, a user's submissions/comments, or a custom list of Reddit URLs.",
            "default": "subreddit"
          },
          "subreddits": {
            "title": "Subreddits",
            "uniqueItems": true,
            "type": "array",
            "description": "List of subreddit names to scrape (without the r/ prefix). Used when search type is 'subreddit', or to scope a search to specific subreddits.",
            "items": {
              "type": "string"
            }
          },
          "query": {
            "title": "Search query",
            "type": "string",
            "description": "Keywords to search for. Required when search type is 'search'. Reddit's search supports operators like author:USERNAME, subreddit:NAME, self:yes/no, flair:NAME."
          },
          "users": {
            "title": "Users",
            "uniqueItems": true,
            "type": "array",
            "description": "Reddit usernames to scrape (without the u/ prefix). Used when search type is 'user'.",
            "items": {
              "type": "string"
            }
          },
          "userContent": {
            "title": "User content type",
            "enum": [
              "submitted",
              "comments"
            ],
            "type": "string",
            "description": "When scraping a user, choose whether to fetch their submitted posts or their comments.",
            "default": "submitted"
          },
          "sortBy": {
            "title": "Sort by",
            "enum": [
              "hot",
              "new",
              "top",
              "rising",
              "controversial",
              "relevance",
              "comments"
            ],
            "type": "string",
            "description": "How Reddit should order results before scraping. Available options depend on search type: subreddits use hot/new/top/rising/controversial; search adds 'relevance' and 'comments'; users use hot/new/top/controversial.",
            "default": "hot"
          },
          "time": {
            "title": "Time window",
            "enum": [
              "hour",
              "day",
              "week",
              "month",
              "year",
              "all"
            ],
            "type": "string",
            "description": "Time range filter — only matters when sort is 'top' or 'controversial'. Otherwise ignored by Reddit.",
            "default": "all"
          },
          "maxItems": {
            "title": "Max items",
            "minimum": 0,
            "maximum": 100000,
            "type": "integer",
            "description": "Stop after this many posts have been scraped. Set to 0 for unlimited (the scraper will paginate until Reddit runs out of results).",
            "default": 50
          },
          "scrapeComments": {
            "title": "Scrape comments",
            "type": "boolean",
            "description": "If on, fetches each post's full comment thread (one extra request per post — slower and ~2× the cost). If off, you get post metadata only, which is much cheaper for large indexing runs.",
            "default": false
          },
          "commentDepth": {
            "title": "Max comments per post",
            "minimum": 1,
            "maximum": 5000,
            "type": "integer",
            "description": "Cap on how many comments to keep per post (counted breadth-first across the comment tree). Only applies when 'Scrape comments' is on.",
            "default": 200
          },
          "since": {
            "title": "Only posts newer than",
            "type": "string",
            "description": "Optional ISO 8601 cutoff (e.g. 2026-01-01T00:00:00Z). Posts created before this timestamp are skipped — perfect for incremental/diff runs that only pull what's new since last time."
          },
          "concurrency": {
            "title": "Concurrency",
            "minimum": 1,
            "maximum": 25,
            "type": "integer",
            "description": "How many simultaneous detail fetches to run. Higher is faster but burns Reddit's per-IP rate budget — leave at 5 unless you've configured a proxy pool.",
            "default": 5
          },
          "startUrls": {
            "title": "Start URLs (advanced)",
            "uniqueItems": true,
            "type": "array",
            "description": "Bypass the searchType-based URL builder and scrape exactly these Reddit URLs. Any reddit.com or old.reddit.com URL works — the scraper appends .json automatically.",
            "items": {
              "type": "string"
            }
          }
        }
      },
      "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
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}