{
  "openapi": "3.0.1",
  "info": {
    "title": "Reddit Scraper — Posts, Comments, Users & Communities",
    "description": "Scrape Reddit at scale without login: posts, comment threads, user profiles, and communities — from URLs, keyword search, or whole subreddits. Sentiment, media downloads, and monitoring included.",
    "version": "1.0",
    "x-build-id": "XjwygyJcAetiq4rmY"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/trakk~reddit-scraper/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-trakk-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/trakk~reddit-scraper/runs": {
      "post": {
        "operationId": "runs-sync-trakk-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/trakk~reddit-scraper/run-sync": {
      "post": {
        "operationId": "run-sync-trakk-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": {
          "startUrls": {
            "title": "🔗 Reddit URLs",
            "type": "array",
            "description": "Direct Reddit URLs — posts, subreddits, user profiles, or search pages. Each is auto-detected.",
            "items": {
              "type": "object",
              "required": [
                "url"
              ],
              "properties": {
                "url": {
                  "type": "string",
                  "title": "URL of a web page",
                  "format": "uri"
                }
              }
            }
          },
          "searches": {
            "title": "🔎 Search keywords",
            "type": "array",
            "description": "Keywords or phrases to search across Reddit (use quotes for exact phrases).",
            "items": {
              "type": "string"
            }
          },
          "subreddits": {
            "title": "📚 Subreddits",
            "type": "array",
            "description": "Subreddits to scrape in full — accepts a name, r/name, or full URL.",
            "items": {
              "type": "string"
            }
          },
          "searchWithinSubreddit": {
            "title": "Restrict search to subreddit",
            "type": "string",
            "description": "Limit keyword searches to one subreddit (name or r/name). Leave empty to search all of Reddit."
          },
          "searchPosts": {
            "title": "Search posts",
            "type": "boolean",
            "description": "Include posts in search results.",
            "default": true
          },
          "searchComments": {
            "title": "Search comments",
            "type": "boolean",
            "description": "Include comments in search results.",
            "default": false
          },
          "searchCommunities": {
            "title": "Search communities",
            "type": "boolean",
            "description": "Include subreddits in search results.",
            "default": false
          },
          "searchUsers": {
            "title": "Search users",
            "type": "boolean",
            "description": "Include user profiles in search results.",
            "default": false
          },
          "sort": {
            "title": "Sort by",
            "enum": [
              "relevance",
              "hot",
              "top",
              "new",
              "rising",
              "comments"
            ],
            "type": "string",
            "description": "Ordering for listings and search.",
            "default": "new"
          },
          "time": {
            "title": "Time range",
            "enum": [
              "all",
              "hour",
              "day",
              "week",
              "month",
              "year"
            ],
            "type": "string",
            "description": "Time window for Top / Controversial / search results.",
            "default": "all"
          },
          "includeNSFW": {
            "title": "Include NSFW (18+)",
            "type": "boolean",
            "description": "Include adult / over-18 content.",
            "default": false
          },
          "scrapeComments": {
            "title": "💬 Scrape comment threads",
            "type": "boolean",
            "description": "For every post found, also collect its comment thread (deep, with collapsed replies expanded).",
            "default": false
          },
          "maxCommentsPerPost": {
            "title": "Max comments per post",
            "minimum": 0,
            "maximum": 100000,
            "type": "integer",
            "description": "Cap on comments collected per post.",
            "default": 10
          },
          "commentSort": {
            "title": "Comment sort",
            "enum": [
              "top",
              "new",
              "controversial",
              "old",
              "qa",
              "confidence"
            ],
            "type": "string",
            "description": "Ordering used when collecting a post's comment thread.",
            "default": "top"
          },
          "skipUserPosts": {
            "title": "Skip user posts",
            "type": "boolean",
            "description": "When scraping a user profile, skip their post/comment history (keep profile only).",
            "default": false
          },
          "skipCommunityInfo": {
            "title": "Skip community info",
            "type": "boolean",
            "description": "When scraping a subreddit, skip the community info/rules record.",
            "default": false
          },
          "postedAfter": {
            "title": "Posts after",
            "type": "string",
            "description": "Keep only posts created on/after this date (YYYY-MM-DD or ISO-8601)."
          },
          "postedBefore": {
            "title": "Posts before",
            "type": "string",
            "description": "Keep only posts created on/before this date."
          },
          "commentedAfter": {
            "title": "Comments after",
            "type": "string",
            "description": "Keep only comments created on/after this date."
          },
          "commentedBefore": {
            "title": "Comments before",
            "type": "string",
            "description": "Keep only comments created on/before this date."
          },
          "onlyWithFlair": {
            "title": "Only posts with flair",
            "type": "boolean",
            "description": "Keep only posts that have a link flair.",
            "default": false
          },
          "strictKeywordMatch": {
            "title": "Strict keyword match",
            "type": "boolean",
            "description": "For searches, keep only results whose title/body contain every keyword.",
            "default": false
          },
          "maxItems": {
            "title": "Max results",
            "minimum": 0,
            "type": "integer",
            "description": "Global cap across all sources and data types. 0 = unlimited.",
            "default": 100
          },
          "maxPostsPerSource": {
            "title": "Max posts per source",
            "minimum": 1,
            "maximum": 1000,
            "type": "integer",
            "description": "Posts pulled per subreddit / search / user (Reddit lists cap near 1000).",
            "default": 25
          },
          "sentiment": {
            "title": "🧠 Sentiment analysis",
            "type": "boolean",
            "description": "Add a sentiment score and label to posts and comments.",
            "default": false
          },
          "downloadMedia": {
            "title": "🖼️ Download post media",
            "type": "boolean",
            "description": "Save post images/videos to storage and add permanent links (Reddit media URLs can rotate).",
            "default": false
          },
          "downloadAvatars": {
            "title": "🧑 Download user avatars",
            "type": "boolean",
            "description": "Save user avatars to storage and add a permanent link.",
            "default": false
          },
          "dedupe": {
            "title": "Remove duplicates",
            "type": "boolean",
            "description": "Save each post/comment/user/community only once per run.",
            "default": true
          },
          "onlyNewerThan": {
            "title": "⏱️ Only newer than (Unix time)",
            "minimum": 0,
            "type": "integer",
            "description": "Skip items created at/before this Unix timestamp — useful for scheduled monitoring.",
            "default": 0
          },
          "proxyConfiguration": {
            "title": "🌐 Proxy",
            "type": "object",
            "description": "Defaults to fast, low-cost datacenter proxies. The scraper automatically escalates to residential IPs only if Reddit rate-limits the run.",
            "default": {
              "useApifyProxy": true
            }
          },
          "maxConcurrency": {
            "title": "Parallel sources",
            "minimum": 1,
            "maximum": 50,
            "type": "integer",
            "description": "Sources processed at once.",
            "default": 8
          },
          "maxRetries": {
            "title": "Request retries",
            "minimum": 0,
            "maximum": 10,
            "type": "integer",
            "description": "Retries for a failed Reddit request.",
            "default": 5
          },
          "requestTimeoutSecs": {
            "title": "Request timeout (s)",
            "minimum": 5,
            "maximum": 120,
            "type": "integer",
            "description": "Maximum time for one request.",
            "default": 30
          }
        }
      },
      "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
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}