{
  "openapi": "3.0.1",
  "info": {
    "title": "Reddit Scraper API - Posts, Comments, Subreddits, Users",
    "description": "Reddit scraper for posts and full comment trees from subreddits, search, post URLs and user profiles. Your OAuth credentials (official Data API) or keyless public JSON; keyless runs need own proxies or a Reddit app key (Apify shared pools get 403s). $0.50 per 1,000 posts, $0.25 per 1,000 comments.",
    "version": "0.1",
    "x-build-id": "awHdsC5Bqkl2Bn627"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/offgrid-labs~reddit-scraper/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-offgrid-labs-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/offgrid-labs~reddit-scraper/runs": {
      "post": {
        "operationId": "runs-sync-offgrid-labs-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/offgrid-labs~reddit-scraper/run-sync": {
      "post": {
        "operationId": "run-sync-offgrid-labs-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": {
          "clientId": {
            "title": "Reddit client ID (optional)",
            "type": "string",
            "description": "Optional. Client ID of your own Reddit app (the string under the app name at https://www.reddit.com/prefs/apps). Used only for application-only OAuth (client_credentials grant, read-only). Leave empty with the secret to use the public JSON path. Example: p-jcoLKBynTLew"
          },
          "clientSecret": {
            "title": "Reddit client secret (optional)",
            "type": "string",
            "description": "Optional. Secret of the same Reddit app (field labelled \"secret\" at https://www.reddit.com/prefs/apps). Stored encrypted by Apify; never logged. If the ID/secret is rejected, the actor falls back to the public JSON path."
          },
          "appName": {
            "title": "Your Reddit app name (User-Agent)",
            "type": "string",
            "description": "Name of your Reddit app, sent as a descriptive User-Agent when OAuth credentials are provided, e.g. apify:offgrid-labs-reddit-scraper:0.1 (app: my-research-app). Example: my-research-app"
          },
          "redditUsername": {
            "title": "Your Reddit username (optional, User-Agent)",
            "type": "string",
            "description": "Optional. The Reddit username that owns the app; appended to the User-Agent as (by /u/<name>) as Reddit recommends. Not used to log in. Example: my_reddit_name"
          },
          "subreddits": {
            "title": "Subreddits",
            "type": "array",
            "description": "Subreddit names or URLs, one per line; posts are read from each subreddit's listing chosen in Sort. Formats: webscraping, r/webscraping, https://www.reddit.com/r/webscraping. all = r/all.",
            "items": {
              "type": "string"
            }
          },
          "sort": {
            "title": "Subreddit / user sort",
            "enum": [
              "hot",
              "new",
              "top",
              "rising",
              "controversial"
            ],
            "type": "string",
            "description": "Listing used for subreddits and user profiles. top and controversial use the Time filter. Default hot.",
            "default": "hot"
          },
          "timeFilter": {
            "title": "Time filter",
            "enum": [
              "hour",
              "day",
              "week",
              "month",
              "year",
              "all"
            ],
            "type": "string",
            "description": "Time window for top/controversial listings and for search (relevance/top/comments sorts). Default day.",
            "default": "day"
          },
          "searchQueries": {
            "title": "Search queries",
            "type": "array",
            "description": "Optional. Reddit search queries, one per line; each returns matching posts. Reddit search syntax works, e.g. \"exact phrase\", title:pricing, author:name, OR. Example: \"web scraping\" api",
            "items": {
              "type": "string"
            }
          },
          "searchInSubreddits": {
            "title": "Restrict search to subreddits",
            "type": "array",
            "description": "Optional. Limit Search queries to these subreddits (searched together). Empty = all of Reddit. Example: python, learnpython",
            "items": {
              "type": "string"
            }
          },
          "searchSort": {
            "title": "Search sort",
            "enum": [
              "relevance",
              "hot",
              "top",
              "new",
              "comments"
            ],
            "type": "string",
            "description": "Order of search results. Default new.",
            "default": "new"
          },
          "postUrls": {
            "title": "Post URLs (full comment trees)",
            "type": "array",
            "description": "Optional. Reddit post URLs, redd.it links or post IDs; each returns the post plus its comment tree (limited by Max comments per post and Comment depth). Example: https://www.reddit.com/r/AskReddit/comments/abc123/title/",
            "items": {
              "type": "string"
            }
          },
          "users": {
            "title": "Usernames (public posts / comments)",
            "type": "array",
            "description": "Optional. Reddit usernames or profile URLs, one per line; returns their public posts and/or comments (see User content). Example: spez or https://www.reddit.com/user/spez",
            "items": {
              "type": "string"
            }
          },
          "userContent": {
            "title": "User content",
            "enum": [
              "both",
              "submitted",
              "comments"
            ],
            "type": "string",
            "description": "Which public profile listings to read for Usernames. Default both.",
            "default": "both"
          },
          "maxItemsPerSource": {
            "title": "Max posts per source",
            "minimum": 1,
            "maximum": 1000,
            "type": "integer",
            "description": "Maximum records read from each subreddit, search query or user listing (Reddit's listings stop at about 1,000). One saved record = one charged event. Default 100. Example: 25",
            "default": 100
          },
          "includeComments": {
            "title": "Also fetch comments of listed posts",
            "type": "boolean",
            "description": "If true, the comment tree of every post from subreddits and searches is fetched too (one extra API request per post; comments are charged as comment events). Post URLs always include comments. Default false.",
            "default": false
          },
          "maxCommentsPerPost": {
            "title": "Max comments per post",
            "minimum": 0,
            "maximum": 10000,
            "type": "integer",
            "description": "Maximum comments saved per post (Post URLs, and listed posts when Also fetch comments is on). Collapsed \"load more\" branches are expanded until this limit. 0 = posts only. Default 100.",
            "default": 100
          },
          "commentDepth": {
            "title": "Comment depth",
            "minimum": 0,
            "maximum": 50,
            "type": "integer",
            "description": "Maximum reply depth: 0 = top-level comments only, 1 = plus direct replies, and so on. Default 10.",
            "default": 10
          },
          "commentSort": {
            "title": "Comment sort",
            "enum": [
              "confidence",
              "top",
              "new",
              "controversial",
              "old",
              "qa"
            ],
            "type": "string",
            "description": "Order in which comments are read (matters when Max comments per post cuts the tree). Default confidence (Reddit's \"Best\").",
            "default": "confidence"
          },
          "expandMoreComments": {
            "title": "Expand \"load more comments\"",
            "type": "boolean",
            "description": "If true (default), collapsed comment branches are expanded via the API's morechildren endpoint until Max comments per post is reached.",
            "default": true
          },
          "includeDeleted": {
            "title": "Include deleted / removed items",
            "type": "boolean",
            "description": "If true, deleted and removed posts/comments are saved (body and author null, isDeleted / isRemoved = true) and charged. Default false: they are skipped and not charged.",
            "default": false
          },
          "skipNsfw": {
            "title": "Skip NSFW (over 18) posts",
            "type": "boolean",
            "description": "If true, posts and comments marked over_18 are skipped and not charged. Default false.",
            "default": false
          },
          "demo": {
            "title": "Demo mode (fixed sample, not charged)",
            "type": "boolean",
            "description": "If true, the actor returns a small fixed sample (demo: true) without contacting Reddit, and never charges. Turn it off for live data (public JSON path or your own OAuth credentials).",
            "default": false
          },
          "publicRequestBudget": {
            "title": "Public path request budget",
            "minimum": 1,
            "maximum": 5000,
            "type": "integer",
            "description": "Maximum HTTP requests the public (no-credential) JSON path may make per run. Reaching it ends the run cleanly with whatever was collected. Ignored when OAuth credentials are used. Default 300.",
            "default": 300
          },
          "proxyList": {
            "title": "Proxy list (optional, secret)",
            "type": "string",
            "description": "One proxy per line (or comma-separated), as http(s)://user:pass@host:port or host:port (credentials optional). The actor rotates across them and fails over to the next healthy one on 403/429/5xx/timeout. Leave empty to connect directly (or pair with Use Apify proxy)."
          },
          "useApifyProxy": {
            "title": "Use Apify proxy",
            "type": "boolean",
            "description": "If true (and no proxy list is supplied), route requests through Apify's managed proxy using the group chosen below. Requires Apify proxy to be enabled for this actor. Default false.",
            "default": false
          },
          "proxyGroups": {
            "title": "Apify proxy group",
            "enum": [
              "DATACENTERS",
              "RESIDENTIAL",
              "UNBLOCKER"
            ],
            "type": "string",
            "description": "Apify proxy pool: DATACENTERS (fastest), RESIDENTIAL (rotating IPs), or UNBLOCKER (most reliable against blocking).",
            "default": "RESIDENTIAL"
          },
          "proxyRotation": {
            "title": "Proxy rotation strategy",
            "enum": [
              "round_robin",
              "random",
              "sticky_window"
            ],
            "type": "string",
            "description": "How proxies are chosen. round_robin cycles in order (default); random picks uniformly; sticky_window holds one proxy for the configured window then moves on. Default round_robin.",
            "default": "round_robin"
          },
          "stickyWindow": {
            "title": "Sticky window size",
            "minimum": 1,
            "maximum": 1000,
            "type": "integer",
            "description": "Requests per proxy before rotating, when rotation strategy is sticky_window. Default 15.",
            "default": 15
          },
          "proxyMaxRetries": {
            "title": "Proxy failover retries",
            "minimum": 0,
            "maximum": 10,
            "type": "integer",
            "description": "How many additional proxies to try after a request fails (403/429/5xx/timeout) before giving up on that request. Default 2.",
            "default": 2
          },
          "proxyMaxFailures": {
            "title": "Max failures before blacklisting a proxy",
            "minimum": 1,
            "maximum": 100,
            "type": "integer",
            "description": "Consecutive failures after which a proxy is blacklisted (skipped) for the rest of the run. A proxy-auth rejection (407/401) blacklists immediately. Default 5.",
            "default": 5
          },
          "userAgent": {
            "title": "Custom User-Agent (advanced, optional)",
            "type": "string",
            "description": "Optional. Overrides the default User-Agent sent on the public JSON path (ignored on the official Data API path)."
          }
        }
      },
      "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
                  },
                  "PROXY_UNBLOCKER_UNITS": {
                    "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
                  },
                  "PROXY_UNBLOCKER_UNITS": {
                    "type": "integer",
                    "example": 0
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}