{
  "openapi": "3.0.1",
  "info": {
    "title": "Reddit Comments Scraper",
    "version": "0.5",
    "x-build-id": "qeno1Lp3QH4U7BR0g"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/khadinakbar~reddit-comments-scraper/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-khadinakbar-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/khadinakbar~reddit-comments-scraper/runs": {
      "post": {
        "operationId": "runs-sync-khadinakbar-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/khadinakbar~reddit-comments-scraper/run-sync": {
      "post": {
        "operationId": "run-sync-khadinakbar-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",
        "required": [
          "queries"
        ],
        "properties": {
          "queries": {
            "title": "Reddit sources (URLs, subreddits, users, or keywords)",
            "type": "array",
            "description": "List of Reddit inputs to scrape comments from. Each item is auto-detected as one of: a thread/post URL (e.g. 'https://www.reddit.com/r/technology/comments/abc123/title/'), a subreddit ('r/technology' or just 'technology'), a user profile ('u/spez' or a full /user/ URL), or a free-text keyword to search ('best mechanical keyboard'). Mixing types in one run is fine. This is NOT for post bodies only — the output unit is always a comment; for post-level subreddit analytics use the reddit-posts-comments-scraper actor.",
            "items": {
              "type": "string"
            }
          },
          "mode": {
            "title": "Detection mode",
            "enum": [
              "auto",
              "thread",
              "subreddit",
              "user",
              "search"
            ],
            "type": "string",
            "description": "How to interpret each item in 'queries'. Leave as 'auto' (default) to detect thread/subreddit/user/keyword per item from its shape. Force a single mode only when auto-detection mis-reads your inputs (e.g. force 'search' to treat a one-word input as a keyword instead of a subreddit). Does NOT change the output shape, only how inputs are routed.",
            "default": "auto"
          },
          "maxComments": {
            "title": "Max comments",
            "minimum": 1,
            "maximum": 200000,
            "type": "integer",
            "description": "Maximum number of comments to return across all inputs in this run. The actor stops and billing stops once this cap is reached (you are charged per comment returned). Defaults to 200. Raise it for full-thread or full-subreddit pulls; one viral thread can hold tens of thousands of comments.",
            "default": 200
          },
          "sort": {
            "title": "Comment sort",
            "enum": [
              "top",
              "best",
              "new",
              "controversial",
              "old",
              "qa"
            ],
            "type": "string",
            "description": "Order in which Reddit returns comments within a thread: 'top' (highest score first, default), 'best' (Reddit confidence ranking), 'new', 'controversial', 'old', or 'qa'. For subreddit and user inputs Reddit always returns newest-first regardless of this value. Affects which comments you get first when 'maxComments' is smaller than the full thread.",
            "default": "top"
          },
          "includeReplies": {
            "title": "Include nested replies",
            "type": "boolean",
            "description": "When true (default), the actor walks the full reply tree and expands collapsed 'load more comments' / 'continue this thread' stubs to capture deep replies, not just top-level comments. When false, only comments visible in the first response are returned (faster, cheaper, shallower). Only affects thread and keyword-search inputs; subreddit and user feeds are flat by nature.",
            "default": true
          },
          "maxDepth": {
            "title": "Max reply depth",
            "minimum": 0,
            "maximum": 50,
            "type": "integer",
            "description": "How many reply levels deep to traverse in a thread, where 0 is a top-level comment, 1 is a direct reply, and so on. Defaults to 10. Lower it to cap cost on deeply nested threads; raise it to capture very long back-and-forth chains. Ignored when 'includeReplies' is false or for flat subreddit/user feeds.",
            "default": 10
          },
          "responseFormat": {
            "title": "Response detail",
            "enum": [
              "concise",
              "detailed"
            ],
            "type": "string",
            "description": "'concise' (default) returns the core comment fields, kept compact for LLM/agent consumption. 'detailed' adds body HTML, author flair, controversiality, gildings, and stickied/distinguished flags. Use 'concise' for sentiment/NLP pipelines and AI agents; use 'detailed' for forensic or moderation analysis. Does not change the number of comments billed.",
            "default": "concise"
          },
          "filterCommentsByKeyword": {
            "title": "Filter comments by keyword (search mode only)",
            "type": "boolean",
            "description": "Only relevant for keyword inputs. When true, the actor returns only comments whose text contains your keyword, instead of every comment on the matched threads. When false (default), it returns all comments on threads that matched your keyword. Has no effect on thread, subreddit, or user inputs.",
            "default": false
          },
          "proxy": {
            "title": "Proxy configuration",
            "type": "object",
            "description": "Proxy settings. Defaults to Apify Residential proxies, which are required because Reddit blocks datacenter IPs and rate-limits per IP. Leave as default unless you have a specific reason to override. Datacenter proxies will be blocked by Reddit.",
            "default": {
              "useApifyProxy": true,
              "apifyProxyGroups": [
                "RESIDENTIAL"
              ]
            }
          },
          "redditClientId": {
            "title": "Reddit client ID (optional)",
            "type": "string",
            "description": "Optional. Your own Reddit app client ID. Leave blank to use the actor owner-managed Reddit access (recommended; end users and AI agents need nothing). To self-supply, create a free app of type \"web app\" at https://www.reddit.com/prefs/apps. This is the app ID shown under the app name, NOT your Reddit username."
          },
          "redditClientSecret": {
            "title": "Reddit client secret (optional)",
            "type": "string",
            "description": "Optional. The secret paired with your Reddit client ID. Leave blank to use the owner-managed access. Found beside \"secret\" under your app at reddit.com/prefs/apps. This is NOT your Reddit account password."
          }
        }
      },
      "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
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}