{
  "openapi": "3.0.1",
  "info": {
    "title": "Reddit Scraper — All Comments, Monitor Mode, Markdown ($1.5/1k)",
    "description": "Scrape Reddit posts + 100% of the comment tree (97.6% benchmarked). Monitor mode: only new items on scheduled runs. Strict keyword search, date & flair filters, LLM-ready Markdown. No API key, no login. From $1.50 per 1,000 results.",
    "version": "0.1",
    "x-build-id": "32cnd7tX2EdkkBcsy"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/theoliveirad~reddit-comments-posts-scraper/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-theoliveirad-reddit-comments-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/theoliveirad~reddit-comments-posts-scraper/runs": {
      "post": {
        "operationId": "runs-sync-theoliveirad-reddit-comments-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/theoliveirad~reddit-comments-posts-scraper/run-sync": {
      "post": {
        "operationId": "run-sync-theoliveirad-reddit-comments-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": {
          "startUrls": {
            "title": "Start URLs",
            "type": "array",
            "description": "Any Reddit URLs: posts (full comment tree), subreddits, user pages, or search result URLs.",
            "items": {
              "type": "object",
              "required": [
                "url"
              ],
              "properties": {
                "url": {
                  "type": "string",
                  "title": "URL of a web page",
                  "format": "uri"
                }
              }
            }
          },
          "searches": {
            "title": "Search terms",
            "type": "array",
            "description": "Keywords to search across Reddit (or inside one community — see 'Restrict search to community').",
            "items": {
              "type": "string"
            }
          },
          "searchCommunityName": {
            "title": "Restrict search to community",
            "type": "string",
            "description": "Subreddit name (without r/) to scope all search terms to, e.g. 'ecommerce'."
          },
          "subreddits": {
            "title": "Subreddits",
            "type": "array",
            "description": "Subreddit names (without r/) to scrape, e.g. 'webscraping'.",
            "items": {
              "type": "string"
            }
          },
          "sort": {
            "title": "Sort",
            "enum": [
              "hot",
              "new",
              "top",
              "controversial",
              "rising",
              "relevance"
            ],
            "type": "string",
            "description": "Listing/search sort order.",
            "default": "new"
          },
          "time": {
            "title": "Time window",
            "enum": [
              "hour",
              "day",
              "week",
              "month",
              "year",
              "all"
            ],
            "type": "string",
            "description": "Time filter for 'top' / 'controversial' / search sorts."
          },
          "maxItems": {
            "title": "Max items (total)",
            "minimum": 1,
            "type": "integer",
            "description": "Hard cap on total results (posts + comments) — controls your cost.",
            "default": 1000
          },
          "maxPostsPerSource": {
            "title": "Max posts per source",
            "minimum": 1,
            "type": "integer",
            "description": "Cap on posts fetched from each subreddit/search/user source.",
            "default": 100
          },
          "scrapeComments": {
            "title": "Scrape comments",
            "type": "boolean",
            "description": "Fetch the FULL comment tree for every post (all 'load more comments' branches expanded).",
            "default": true
          },
          "maxCommentsPerPost": {
            "title": "Max comments per post",
            "minimum": 0,
            "type": "integer",
            "description": "Cap per post. If hit, items are flagged commentsTruncated=true — you always know if a tree is partial.",
            "default": 2000
          },
          "commentsSort": {
            "title": "Comments sort",
            "enum": [
              "top",
              "new",
              "controversial",
              "old",
              "qa"
            ],
            "type": "string",
            "description": "Order used when expanding comment trees.",
            "default": "top"
          },
          "postedAfter": {
            "title": "Posts created on or after",
            "type": "string",
            "description": "Only keep posts created on or after this date — 'YYYY-MM-DD' (00:00 UTC) or full ISO 8601. Tip: combine with sort='new' for fastest runs (pagination stops early once posts get older than this)."
          },
          "postedBefore": {
            "title": "Posts created on or before",
            "type": "string",
            "description": "Only keep posts created on or before this date — 'YYYY-MM-DD' (23:59:59 UTC) or full ISO 8601."
          },
          "commentedAfter": {
            "title": "Comments created on or after",
            "type": "string",
            "description": "Only keep comments created on or after this date (UTC). 'YYYY-MM-DD' or ISO 8601."
          },
          "commentedBefore": {
            "title": "Comments created on or before",
            "type": "string",
            "description": "Only keep comments created on or before this date (UTC). 'YYYY-MM-DD' or ISO 8601."
          },
          "onlyWithFlair": {
            "title": "Only posts that have a flair",
            "type": "boolean",
            "description": "Drop posts without any flair assigned.",
            "default": false
          },
          "flairFilter": {
            "title": "Flair filter",
            "type": "array",
            "description": "Keep only posts whose flair matches one of these values (case-insensitive, substring match) — e.g. 'Discussion', 'Help'. Leave empty to keep all flairs.",
            "items": {
              "type": "string"
            }
          },
          "strictKeywordFilter": {
            "title": "Strict keyword filter (search)",
            "type": "boolean",
            "description": "Reddit search often returns loosely related posts. When enabled, every word of your search term must actually appear in the post's title, body, or link URL — fewer results, but they match what you asked for.",
            "default": false
          },
          "deepScan": {
            "title": "Deep scan (beat the ~1,000 post cap)",
            "type": "boolean",
            "description": "Combine all sorts and time windows per subreddit and dedupe, surfacing far more than the ~1k listing cap.",
            "default": false
          },
          "includeNSFW": {
            "title": "Include NSFW",
            "type": "boolean",
            "description": "Include posts and comments marked NSFW (over_18) in the results.",
            "default": false
          },
          "includeCommunityInfo": {
            "title": "Include community info",
            "type": "boolean",
            "description": "Push one community item (subscribers, description) per scraped subreddit.",
            "default": false
          },
          "includeUserInfo": {
            "title": "Include user info",
            "type": "boolean",
            "description": "Push one user item (karma, created date) per scraped user page.",
            "default": false
          },
          "outputFormat": {
            "title": "Output format",
            "enum": [
              "items",
              "markdown",
              "both"
            ],
            "type": "string",
            "description": "'items' = structured post/comment rows only. 'markdown' and 'both' are IDENTICAL: structured items PLUS one LLM-ready Markdown document per thread (with a token estimate). You're billed per structured item either way — the Markdown doc is a free extra.",
            "default": "items"
          },
          "markdownMaxTopComments": {
            "title": "Markdown: max top-level branches",
            "type": "integer",
            "description": "Keep only the N highest-scored top-level comment branches in Markdown output (token budgeting)."
          },
          "concurrency": {
            "title": "Thread fetch concurrency",
            "minimum": 1,
            "maximum": 10,
            "type": "integer",
            "description": "Parallel thread fetches (1-10). Higher = faster but more block risk.",
            "default": 3
          },
          "monitorMode": {
            "title": "Monitor mode (scheduled runs)",
            "type": "boolean",
            "description": "Remembers what it already saw: on scheduled runs, only NEW posts/comments since the previous run are returned. Ideal for brand/keyword monitoring. Note: the memory is keyed to your sources + sort + time window — changing startUrls/searches/subreddits/sort/time starts fresh (the next run returns everything again).",
            "default": false
          }
        }
      },
      "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
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}