{
  "openapi": "3.0.1",
  "info": {
    "title": "Reddit Subreddit Posts Scraper",
    "description": "Reddit Subreddit Posts Scraper scrapes posts from any subreddit by hot, new, top, rising, controversial or best: title, author, score, comments, awards and subreddit info. No login, no cookies. Export JSON, CSV or Excel, or use the API.",
    "version": "0.1",
    "x-build-id": "50oLwE7bT7bQghCaJ"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/socialdataapi~reddit-subreddit-posts-scraper/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-socialdataapi-reddit-subreddit-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/socialdataapi~reddit-subreddit-posts-scraper/runs": {
      "post": {
        "operationId": "runs-sync-socialdataapi-reddit-subreddit-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/socialdataapi~reddit-subreddit-posts-scraper/run-sync": {
      "post": {
        "operationId": "run-sync-socialdataapi-reddit-subreddit-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",
        "required": [
          "subreddits"
        ],
        "properties": {
          "subreddits": {
            "title": "🔗 Subreddits",
            "type": "array",
            "description": "One or more subreddits: a bare name (e.g. 'AbsoluteUnits'), 'r/AbsoluteUnits', or a full https://www.reddit.com/r/AbsoluteUnits/ URL. Each subreddit is scraped on its own and gets its own 'Max posts per subreddit'.",
            "items": {
              "type": "string"
            }
          },
          "maxItems": {
            "title": "🔢 Max posts per subreddit",
            "minimum": 0,
            "type": "integer",
            "description": "Maximum number of posts to collect for EACH subreddit (3 subreddits x 20 = up to 60 posts). A subreddit stops earlier once its own listing ends. 0 = every post Reddit's listing gives out (up to ~1,000). Free plan: up to 20 posts per run (all subreddits together) and 200 per month; paid plans have no limit.",
            "default": 20
          },
          "sort": {
            "title": "🔃 Sort",
            "enum": [
              "hot",
              "new",
              "top",
              "rising",
              "controversial",
              "best"
            ],
            "type": "string",
            "description": "How Reddit orders the subreddit's posts. 'Top' and 'Controversial' also use 'Time window' below. A per-subreddit entry written as a URL (e.g. '.../top/?t=week') overrides this for that one subreddit.",
            "default": "hot"
          },
          "timeframe": {
            "title": "📅 Time window",
            "enum": [
              "",
              "hour",
              "day",
              "week",
              "month",
              "year",
              "all"
            ],
            "type": "string",
            "description": "Only used by 'Top' and 'Controversial' sort; Reddit ignores it for the other sorts.",
            "default": ""
          },
          "dateFrom": {
            "title": "📅 Posted after",
            "type": "string",
            "description": "ISO date (e.g. '2026-10-01') or a unix timestamp. Keeps only posts created on or after this date. Filtered on the posts already fetched for 'Max posts per subreddit' - it does not fetch extra pages to backfill a narrow window. Empty = no lower bound."
          },
          "dateTo": {
            "title": "📅 Posted before",
            "type": "string",
            "description": "ISO date (e.g. '2026-11-01') or a unix timestamp. Keeps only posts created on or before this date. Empty = no upper bound."
          },
          "trim": {
            "title": "✅ Trim to key fields",
            "type": "boolean",
            "description": "On (default): each post has the key fields (title, author, score, comments, awards, flair, media type...). Off: the key fields plus every other raw field Reddit returns for the post (~110 keys: media, preview, awards detail, flair richtext, gildings...).",
            "default": true
          },
          "includeSubredditInfo": {
            "title": "✅ Include subreddit info",
            "type": "boolean",
            "description": "Attach the subreddit's own info (subscribers, weekly active users/contributions, rules, description, icon/banner images) to every one of its post rows, under 'subreddit_info'. Off = that field is null and one less page load per subreddit.",
            "default": true
          },
          "afterCursor": {
            "title": "🔢 Resume after",
            "type": "string",
            "description": "Resume every subreddit's listing from this cursor instead of the first page - a post fullname like 't3_1w05sdh' (the status message of a run that stopped early names the cursor to continue from for each subreddit). Empty = start at page 1."
          },
          "maxRetries": {
            "title": "🔁 Max retries per request",
            "minimum": 0,
            "type": "integer",
            "description": "How many times to retry one request (token mint, a listing page, about/rules) before giving up on it.",
            "default": 3
          },
          "timeoutSecs": {
            "title": "⏳ Request timeout (seconds)",
            "minimum": 5,
            "type": "integer",
            "description": "How long to wait for one request before treating it as failed and retrying.",
            "default": 30
          },
          "proxyConfiguration": {
            "title": "🌐 Proxy configuration",
            "type": "object",
            "description": "Optional proxy to start with. If Reddit blocks requests, the actor moves to a stronger proxy automatically."
          }
        }
      },
      "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
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}