{
  "openapi": "3.0.1",
  "info": {
    "title": "Reddit Scraper | Threads & Linked Comments",
    "description": "Export public Reddit threads, comments, searches and community data. When Reddit blocks thread data, up to 10 threads a run return their page comments, with shortfalls stated.",
    "version": "99.95",
    "x-build-id": "n3MD9xZFlEbnUSbg6"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/danthedataman~reddit-thread-ledger/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-danthedataman-reddit-thread-ledger",
        "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/danthedataman~reddit-thread-ledger/runs": {
      "post": {
        "operationId": "runs-sync-danthedataman-reddit-thread-ledger",
        "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/danthedataman~reddit-thread-ledger/run-sync": {
      "post": {
        "operationId": "run-sync-danthedataman-reddit-thread-ledger",
        "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": {
          "urls": {
            "title": "Reddit URLs",
            "type": "array",
            "description": "HTTPS thread, focused-comment, community, user or search URLs. Mixed sources are processed in input order; duplicate records are exported once.",
            "items": {
              "type": "string"
            }
          },
          "subreddits": {
            "title": "Subreddits",
            "type": "array",
            "description": "Community names, bare or r/ prefixed. Read about/rules and current listings, selected by dataTypes.",
            "items": {
              "type": "string"
            }
          },
          "users": {
            "title": "User profiles and history",
            "type": "array",
            "description": "Public usernames, bare or u/ prefixed. Read about, submitted posts and comments; URL lanes can select submitted or comments. History at sort new with timeRange=all can use HTML when JSON is refused; profile metadata keeps JSON.",
            "items": {
              "type": "string"
            }
          },
          "queries": {
            "title": "Search queries",
            "type": "array",
            "description": "Reddit search queries, combined with other sources. No omitted query triggers a scrape. Post and comment searches at sort new or relevance with timeRange=all can use HTML when JSON is refused. HTML field values differ; see the README table.",
            "items": {
              "type": "string"
            }
          },
          "searchCommunity": {
            "title": "Search within community",
            "type": "string",
            "description": "Optional bare community, r/name or HTTPS community URL; applies to queries."
          },
          "dataTypes": {
            "title": "Record families",
            "type": "array",
            "description": "Selected output families; [] performs no requests.",
            "items": {
              "type": "string",
              "enum": [
                "post",
                "comment",
                "community",
                "user"
              ]
            },
            "default": [
              "post",
              "comment",
              "community",
              "user"
            ]
          },
          "searchTypes": {
            "title": "Search families",
            "type": "array",
            "description": "Search posts, comments, communities, users or media-bearing posts. [] skips queries.",
            "items": {
              "type": "string",
              "enum": [
                "posts",
                "comments",
                "communities",
                "users",
                "media"
              ]
            },
            "default": [
              "posts"
            ]
          },
          "sort": {
            "title": "Listing and search sort",
            "enum": [
              "new",
              "hot",
              "top",
              "rising",
              "controversial",
              "relevance",
              "comments"
            ],
            "type": "string",
            "description": "Ordering. relevance and comments apply to search; community listings accept new, hot, top, rising and controversial. A community listing sort in the URL path takes precedence. When JSON is refused, HTML covers community new, profile new with timeRange=all, and search new or relevance with timeRange=all. Other post and profile sorts keep JSON and report the refusal. At those search settings, comment search reads the search page directly when it shows comment results; any other comment search takes comment IDs from the page and details from JSON. When Apify fills an omitted sort with the default new, search HTML requests sort=new. When sort reaches the Actor absent or null, search keeps the page's relevance default.",
            "default": "new"
          },
          "timeRange": {
            "title": "Reddit time window",
            "enum": [
              "all",
              "hour",
              "day",
              "week",
              "month",
              "year"
            ],
            "type": "string",
            "description": "Provider time window for top/search routes; exact UTC dates are filtered separately.",
            "default": "all"
          },
          "includeComments": {
            "title": "Include thread comments",
            "type": "boolean",
            "description": "Expand trees for discovered posts when comment rows are selected. False omits thread comment rows; user history and explicit comment searches remain independently selected.",
            "default": true
          },
          "commentSort": {
            "title": "Thread comment ordering",
            "enum": [
              "old",
              "new",
              "top",
              "best",
              "controversial",
              "qa"
            ],
            "type": "string",
            "description": "Initial tree and continuations use the same Reddit comment sort; the browser snapshot requests this sort too.",
            "default": "old"
          },
          "maxItems": {
            "title": "Maximum billable output rows",
            "minimum": 0,
            "type": "integer",
            "description": "Global output row ceiling, default 1000 when omitted/null. 0 performs no requests. Bundled formats count one post bundle as one row."
          },
          "maxPostsPerSource": {
            "title": "Maximum listing/search candidates",
            "minimum": 0,
            "type": "integer",
            "description": "Scanned candidate ceiling per listing/search family and sort; 0 drains available cursors. Reddit listings commonly stop around 1000, and filtered yield can be lower.",
            "default": 1000
          },
          "maxCommentsPerPost": {
            "title": "Maximum captured comments per thread",
            "minimum": 0,
            "type": "integer",
            "description": "0 captures no thread comments. Count includes comments before filters; JSON continuations are drained until this ceiling or the request budget. Browser snapshots capture only comments present in the page.",
            "default": 50000
          },
          "maxCommentDepth": {
            "title": "Maximum exported comment depth",
            "minimum": 0,
            "type": "integer",
            "description": "Optional export depth: top-level is 0. Omitted/null exports every captured depth; this does not reduce tree retrieval work."
          },
          "maxRequestsPerThread": {
            "title": "Maximum thread JSON requests",
            "minimum": 1,
            "type": "integer",
            "description": "Initial tree plus continuation/info reads; stops honestly partial at the ceiling.",
            "default": 1000
          },
          "commentContextDepth": {
            "title": "Focused comment context depth",
            "minimum": 0,
            "type": "integer",
            "description": "For a focused URL, include target, up to this many ancestors and descendant levels. Missing targets are ERRORS, never replaced with a different comment.",
            "default": 3
          },
          "postedAfter": {
            "title": "Post interval start",
            "type": "string",
            "description": "Inclusive UTC post creation lower bound. YYYY-MM-DD or ISO timestamp. Filters apply only to discovered items; no historical recall promise."
          },
          "postedBefore": {
            "title": "Post interval end",
            "type": "string",
            "description": "Inclusive UTC post creation upper bound; date-only includes the whole day. YYYY-MM-DD or ISO timestamp. Filters apply only to discovered items; no historical recall promise."
          },
          "commentedAfter": {
            "title": "Comment interval start",
            "type": "string",
            "description": "Inclusive UTC comment creation lower bound, independent of the post's date. YYYY-MM-DD or ISO timestamp. Filters apply only to discovered items; no historical recall promise."
          },
          "commentedBefore": {
            "title": "Comment interval end",
            "type": "string",
            "description": "Inclusive UTC comment creation upper bound; date-only includes the whole day. YYYY-MM-DD or ISO timestamp. Filters apply only to discovered items; no historical recall promise."
          },
          "strictSearch": {
            "title": "Exact search tokens",
            "type": "boolean",
            "description": "Require every word token of each query in post title/body/content URL or comment body, case insensitive with word boundaries.",
            "default": false
          },
          "filterKeywords": {
            "title": "Keyword filters",
            "type": "array",
            "description": "Optional literal keywords; empty means no keyword filter.",
            "items": {
              "type": "string"
            }
          },
          "filterKeywordMode": {
            "title": "Keyword matching",
            "enum": [
              "any",
              "all",
              "titleOnly",
              "exactPhrase"
            ],
            "type": "string",
            "description": "any/all match title, body and content URL; titleOnly/exactPhrase match literal strings in the title.",
            "default": "any"
          },
          "maximizeCoverage": {
            "title": "Search sort fanout",
            "type": "boolean",
            "description": "Fan out post/media search across new/relevance/top/comments/hot and deduplicate. This broadens discovery but does not defeat Reddit's search/listing horizon.",
            "default": false
          },
          "includeNSFW": {
            "title": "Include NSFW records",
            "type": "boolean",
            "description": "Request provider NSFW results; false excludes marked NSFW post/comment rows.",
            "default": true
          },
          "onlyWithFlair": {
            "title": "Posts with flair only",
            "type": "boolean",
            "description": "Only export posts with nonempty flair; independent comment filters still apply.",
            "default": false
          },
          "outputFormat": {
            "title": "Post/comment representation",
            "enum": [
              "default",
              "rag-markdown",
              "jsonl-finetune"
            ],
            "type": "string",
            "description": "default exports flat rows. Other formats bundle a post and selected comments with markdown/chunkId or messages; community/user metadata stays flat.",
            "default": "default"
          },
          "changeFeed": {
            "title": "Changes since dataset",
            "type": "boolean",
            "description": "Compare current selected rows against a compatible full export. Emit new/updated rows only; never infer deletions from an absent or partial result. Browser fallback is disabled in this mode; blocked thread reads go to ERRORS without result charges.",
            "default": false
          },
          "baselineDatasetId": {
            "title": "Baseline dataset ID",
            "type": "string",
            "description": "Required with changeFeed. Readable dataset from this Actor's compatible export; an unreadable/incompatible baseline fails before any target read."
          },
          "maxRetriesPerRequest": {
            "title": "Retries per HTTP request",
            "minimum": 0,
            "type": "integer",
            "description": "Retries for network and gate failures. A supported listing whose JSON returns 403 or 302 goes straight to HTML; an HTML page refused with 403 or 302 stops without identity retries. An initial thread JSON 403 or 302 goes straight to the browser when browser reads are enabled, except in change-feed runs. A login redirect never uses the browser, and an exhausted browser budget sends the thread to ERRORS unread. When a saved anonymous session is reused and a 429 arrives with the rate limit used up and a stated reset time, the run switches to another saved session or waits for the reset within maxRunSeconds. Otherwise it reports the refusal. With session reuse active, any other 429 ends with a refusal, and neither starts a new session. Other retries may keep the current session, use another saved session, or set up a new one. Missing targets and unknown challenges do not retry.",
            "default": 3
          },
          "maxRunSeconds": {
            "title": "Target read time budget",
            "minimum": 1,
            "type": "integer",
            "description": "Wall budget for target reads, checked before requests; an in-flight request can take its 30-second timeout.",
            "default": 900
          },
          "rotateAfterRequests": {
            "title": "Fresh identity interval",
            "minimum": 0,
            "type": "integer",
            "description": "Requests after which a session is retired, when session reuse is not active; 0 disables it. While session reuse is active, sessions are not retired after a request count, but a failed request can still replace one.",
            "default": 24
          },
          "proxyConfiguration": {
            "title": "Proxy configuration",
            "type": "object",
            "description": "Optional Apify proxy override. Platform default uses RESIDENTIAL (datacenter was blocked in measured qualification); local execution without override uses direct HTTP."
          }
        }
      },
      "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
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}