{
  "openapi": "3.0.1",
  "info": {
    "title": "Reddit Comments Scraper: Nested Threads & Markdown",
    "description": "Extract nested Reddit comment trees as structured rows or LLM-ready Markdown from post URLs, share links, post IDs, or subreddits. Filter AMA replies, track only new comments, and skip charges on errors. Not affiliated with Reddit.",
    "version": "0.0",
    "x-build-id": "ks3KUIscAxoZqO7n2"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/kizukidata~reddit-comments-scraper/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-kizukidata-reddit-comments-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/kizukidata~reddit-comments-scraper/runs": {
      "post": {
        "operationId": "runs-sync-kizukidata-reddit-comments-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/kizukidata~reddit-comments-scraper/run-sync": {
      "post": {
        "operationId": "run-sync-kizukidata-reddit-comments-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": {
          "mode": {
            "title": "Output mode",
            "enum": [
              "comments",
              "threads"
            ],
            "type": "string",
            "description": "comments (default): 1 row/comment with depth, parentId, isSubmitter, bodyMarkdown. threads: 1 row/post with nested comments[] and threadMarkdown (up to 60,000 characters).",
            "default": "comments"
          },
          "postUrls": {
            "title": "Post URLs or IDs",
            "type": "array",
            "description": "Reddit post URLs, redd.it links, /r/{subreddit}/s/... share links, or post IDs (up to 50). Empty input reads sample post 1k2vnz0.",
            "items": {
              "type": "string"
            }
          },
          "subreddits": {
            "title": "Subreddits (optional)",
            "type": "array",
            "description": "Read the newest 20 posts of each subreddit (up to 50 subreddits) and extract their comment trees.",
            "items": {
              "type": "string"
            }
          },
          "queries": {
            "title": "Keywords (optional)",
            "type": "array",
            "description": "Keywords (2-120 chars, up to 10) matched against post titles and text inside the listed subreddits. Without subreddits, searches up to 5 communities whose names start with the keyword. Not a Reddit-wide search.",
            "items": {
              "type": "string"
            }
          },
          "commentSort": {
            "title": "Comment sort order",
            "enum": [
              "top",
              "best",
              "new",
              "old",
              "controversial"
            ],
            "type": "string",
            "description": "Order comments within each tree level: top (default), best, new, old, or controversial.",
            "default": "top"
          },
          "amaFilter": {
            "title": "AMA filter",
            "enum": [
              "all",
              "answered",
              "unanswered"
            ],
            "type": "string",
            "description": "Filter top-level comment threads (root comment plus all replies) by OP replies: all (default), answered (OP replied somewhere in the thread), or unanswered (no OP reply).",
            "default": "all"
          },
          "maxCommentsPerPost": {
            "title": "Max comments per post",
            "minimum": 0,
            "maximum": 2000,
            "type": "integer",
            "description": "Maximum comments extracted per post (0-2000; 0 = no per-post cap). Default 100.",
            "default": 100
          },
          "after": {
            "title": "Posts after",
            "type": "string",
            "description": "For subreddit/keyword runs: oldest post boundary (YYYY-MM-DD, epoch seconds, or 24h/7d/30d).",
            "default": ""
          },
          "before": {
            "title": "Posts before",
            "type": "string",
            "description": "For subreddit/keyword runs: newest post boundary (YYYY-MM-DD, epoch seconds, or 7d).",
            "default": ""
          },
          "includeNsfw": {
            "title": "Include NSFW",
            "type": "boolean",
            "description": "Include posts marked NSFW (over_18) when discovering posts by subreddit/keyword.",
            "default": false
          },
          "includeRemoved": {
            "title": "Include removed posts",
            "type": "boolean",
            "description": "Also read comments under posts that moderators, Reddit or the author removed or deleted. Off by default: when posts are found by subreddit or keyword, removed and deleted posts are skipped, so the comment budget goes to threads people can still see. Posts you name in postUrls are always read.",
            "default": false
          },
          "onlyNewItems": {
            "title": "Only new comments",
            "type": "boolean",
            "description": "true skips comments or threads delivered by prior runs with the same input (90-day state); false (default) returns all.",
            "default": false
          },
          "maxItems": {
            "title": "Maximum rows",
            "minimum": 1,
            "maximum": 5000,
            "type": "integer",
            "description": "Max charged rows returned per run (1-5000, default 20). Status rows (error set) are free and do not count toward this cap.",
            "default": 20
          },
          "proxyConfiguration": {
            "title": "Proxy configuration",
            "type": "object",
            "description": "Proxy settings. Default uses no proxy. Residential proxies are not available.",
            "default": {
              "useApifyProxy": false
            }
          }
        }
      },
      "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
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}