{
  "openapi": "3.0.1",
  "info": {
    "title": "Reddit Posts Scraper — (with Comments & Replies)",
    "description": "Extract Reddit posts, comments & subreddit data with no login required. Returns title, score, author, flair, body text, and dates. JSON API-powered for 99%+ reliability.",
    "version": "1.0",
    "x-build-id": "UPRqd96ZMU4LkX99z"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/khadinakbar~reddit-posts-scraper/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-khadinakbar-reddit-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/khadinakbar~reddit-posts-scraper/runs": {
      "post": {
        "operationId": "runs-sync-khadinakbar-reddit-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/khadinakbar~reddit-posts-scraper/run-sync": {
      "post": {
        "operationId": "run-sync-khadinakbar-reddit-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": {
          "subreddits": {
            "title": "Subreddits",
            "type": "array",
            "description": "Use this field when the user provides subreddit names (with or without r/ prefix). Each subreddit fetches posts using the Sort and Time Filter settings. Leave empty if using Search Queries or Start URLs instead. Examples: 'programming', 'r/learnpython', 'MachineLearning'.",
            "items": {
              "type": "string"
            }
          },
          "searchQueries": {
            "title": "Search Queries",
            "type": "array",
            "description": "Use this field when the user describes a topic or keyword to search across all of Reddit. Each query runs a full Reddit search. Do NOT use this when the user provides a subreddit name — use Subreddits instead. Examples: 'best laptop 2025', 'AI news', 'side hustle ideas'.",
            "items": {
              "type": "string"
            }
          },
          "startUrls": {
            "title": "Start URLs",
            "type": "array",
            "description": "Use this field when the user provides a specific Reddit URL. Supports any Reddit URL: subreddit pages, post pages, search pages, or user profile pages. Examples: https://www.reddit.com/r/datascience/, https://www.reddit.com/r/programming/top/.",
            "items": {
              "type": "object",
              "required": [
                "url"
              ],
              "properties": {
                "url": {
                  "type": "string",
                  "title": "URL of a web page",
                  "format": "uri"
                }
              }
            }
          },
          "redditClientId": {
            "title": "Reddit Client ID (for cloud use)",
            "type": "string",
            "description": "Optional Reddit app client_id for OAuth. Needed when running on cloud servers (Apify cloud IPs are blocked by Reddit). Get one free in 2 min: go to reddit.com/prefs/apps → create app → choose \"installed app\" → copy the ID shown under the app name. No user login or secret required."
          },
          "sort": {
            "title": "Sort By",
            "enum": [
              "hot",
              "new",
              "top",
              "rising",
              "controversial",
              "relevance"
            ],
            "type": "string",
            "description": "How to sort posts. 'hot' = currently popular. 'new' = most recent. 'top' = highest score (use with Time Filter). 'rising' = gaining momentum. 'controversial' = most debated. 'relevance' = best match for search queries only.",
            "default": "hot"
          },
          "time": {
            "title": "Time Filter",
            "enum": [
              "all",
              "hour",
              "day",
              "week",
              "month",
              "year"
            ],
            "type": "string",
            "description": "Time range for 'top', 'controversial', and search results. Ignored for 'hot', 'new', and 'rising'. Options: hour, day, week, month, year, all.",
            "default": "all"
          },
          "maxResults": {
            "title": "Max Posts",
            "minimum": 1,
            "maximum": 1000000,
            "type": "integer",
            "description": "Maximum number of posts to save in total across all sources. Each page returns up to 100 posts. Set to 0 for unlimited (up to Reddit's per-source caps). Default: 50.",
            "default": 50
          },
          "includeComments": {
            "title": "Include Comments",
            "type": "boolean",
            "description": "If enabled, scrapes the top comments for each post scraped. Significantly increases run time and data output. Each comment is saved as a separate record with data_type: 'comment'.",
            "default": false
          },
          "maxCommentsPerPost": {
            "title": "Max Comments Per Post",
            "minimum": 1,
            "maximum": 500,
            "type": "integer",
            "description": "Maximum number of comments to scrape per post (only when Include Comments is enabled). Comments are flattened from nested threads. Default: 20.",
            "default": 20
          },
          "includeNSFW": {
            "title": "Include NSFW Content",
            "type": "boolean",
            "description": "Include posts marked as NSFW (Not Safe For Work / 18+). Disabled by default.",
            "default": false
          },
          "minScore": {
            "title": "Minimum Score (Upvotes)",
            "type": "integer",
            "description": "Only include posts with at least this many upvotes. Leave empty for no minimum. Useful for filtering to only high-quality posts."
          },
          "maxScore": {
            "title": "Maximum Score (Upvotes)",
            "type": "integer",
            "description": "Only include posts with at most this many upvotes. Leave empty for no maximum."
          },
          "minComments": {
            "title": "Minimum Comments",
            "type": "integer",
            "description": "Only include posts with at least this many comments. Leave empty for no minimum."
          },
          "flairFilter": {
            "title": "Flair Filter",
            "type": "string",
            "description": "Only include posts with this exact flair text. Case-sensitive. Example: 'Question', 'Discussion', 'Tutorial'. Leave empty to include all flairs."
          },
          "authorFilter": {
            "title": "Author Filter",
            "type": "string",
            "description": "Only include posts from this specific Reddit username (without u/). Leave empty to include all authors."
          },
          "postDateLimit": {
            "title": "Post Date Limit (exclude posts older than)",
            "type": "string",
            "description": "Only include posts created after this date. Format: YYYY-MM-DD or ISO 8601 (e.g., 2025-01-01). Pagination stops automatically when posts older than this date are encountered."
          },
          "proxyConfiguration": {
            "title": "Proxy Configuration",
            "type": "object",
            "description": "Proxy settings for Reddit scraping. Reddit blocks some datacenter IPs. Using Apify Residential proxies improves reliability significantly. Highly recommended for large-scale runs."
          }
        }
      },
      "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
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}