{
  "openapi": "3.0.1",
  "info": {
    "title": "Reddit Comment Scraper",
    "description": "Scrape Reddit Comments from a post on Reddit. Provides comment text, the parent of the thread, score and timestamps.",
    "version": "2.0",
    "x-build-id": "gH2BGgbMy7OMi4Sq8"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/crawlerbros~reddit-comment-scraper/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-crawlerbros-reddit-comment-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/crawlerbros~reddit-comment-scraper/runs": {
      "post": {
        "operationId": "runs-sync-crawlerbros-reddit-comment-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/crawlerbros~reddit-comment-scraper/run-sync": {
      "post": {
        "operationId": "run-sync-crawlerbros-reddit-comment-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": [
          "postUrls"
        ],
        "properties": {
          "postUrls": {
            "title": "Reddit Post URLs",
            "minItems": 1,
            "type": "array",
            "description": "Post URLs, comment URLs, share links or bare post IDs. Accepted forms: full post URL (https://www.reddit.com/r/x/comments/1abc/title/), short URL (https://www.reddit.com/comments/1abc or with ?sort=top), comment URL (.../comments/1abc/title/comment/xyz/), mobile share link (https://www.reddit.com/r/x/s/token), bare post id (1abc123) or t3_1abc123.",
            "items": {
              "type": "string"
            }
          },
          "maxComments": {
            "title": "Maximum comments per post",
            "minimum": 1,
            "maximum": 100000,
            "type": "integer",
            "description": "Maximum number of comments to scrape from each post (including nested replies).",
            "default": 100
          },
          "commentSort": {
            "title": "Sort comments by",
            "enum": [
              "confidence",
              "top",
              "new",
              "controversial",
              "old",
              "qa"
            ],
            "type": "string",
            "description": "How to sort the comment threads.",
            "default": "confidence"
          },
          "includePost": {
            "title": "Include the parent post record",
            "type": "boolean",
            "description": "When enabled, the parent post is emitted as the first record of each thread (full post data included).",
            "default": false
          },
          "postedAfter": {
            "title": "Comments created on or after (YYYY-MM-DD)",
            "type": "string",
            "description": "Only keep comments created on or after this date (UTC)."
          },
          "postedBefore": {
            "title": "Comments created on or before (YYYY-MM-DD)",
            "type": "string",
            "description": "Only keep comments created on or before this date (interpreted as the end of that day, UTC)."
          },
          "minDepth": {
            "title": "Minimum reply depth",
            "minimum": 0,
            "maximum": 100,
            "type": "integer",
            "description": "Only keep comments nested at or deeper than this depth (0 = keep everything, 1 = drop top-level comments and keep only replies, 2 = keep only replies-to-replies and deeper, etc.). Leave empty for no limit."
          },
          "maxDepth": {
            "title": "Maximum reply depth",
            "minimum": 0,
            "maximum": 100,
            "type": "integer",
            "description": "Only keep comments nested at or above this depth (0 = top-level comments only, 1 = top-level + first-level replies, etc.). Leave empty for no limit."
          },
          "minCommentScore": {
            "title": "Minimum comment score",
            "minimum": -1000000,
            "maximum": 1000000,
            "type": "integer",
            "description": "Only keep comments with a score (upvotes minus downvotes) at or above this value. Leave empty for no limit."
          },
          "maxCommentScore": {
            "title": "Maximum comment score",
            "minimum": -1000000,
            "maximum": 1000000,
            "type": "integer",
            "description": "Only keep comments with a score (upvotes minus downvotes) at or below this value. Leave empty for no limit."
          },
          "onlyOP": {
            "title": "Only original poster's comments",
            "type": "boolean",
            "description": "When enabled, only comments written by the post's original author are kept.",
            "default": false
          },
          "excludeDeletedRemoved": {
            "title": "Exclude deleted/removed comments",
            "type": "boolean",
            "description": "When enabled, comments whose body or author show as [deleted] or [removed] are dropped (no real content left to scrape).",
            "default": false
          },
          "excludeStickied": {
            "title": "Exclude stickied comments",
            "type": "boolean",
            "description": "When enabled, moderator-pinned (stickied) comments — e.g. AutoModerator notices — are dropped.",
            "default": false
          },
          "excludeCollapsed": {
            "title": "Exclude collapsed comments",
            "type": "boolean",
            "description": "When enabled, comments Reddit collapses by default (low score or crowd control) are dropped.",
            "default": false
          },
          "distinguishedFilter": {
            "title": "Filter by distinguished status",
            "enum": [
              "any",
              "moderator",
              "admin",
              "none"
            ],
            "type": "string",
            "description": "Restrict output to comments with a specific 'distinguished' badge (moderator/admin posting in an official capacity), or only regular (non-distinguished) comments. Leave as 'Any' to keep everyone.",
            "default": "any"
          },
          "authors": {
            "title": "Filter by comment author(s)",
            "type": "array",
            "description": "Only keep comments written by these Reddit usernames (case-insensitive). Leave empty to keep comments from all authors.",
            "items": {
              "type": "string"
            }
          },
          "excludeAuthors": {
            "title": "Exclude comment author(s)",
            "type": "array",
            "description": "Drop comments written by these Reddit usernames (case-insensitive), e.g. bots like AutoModerator. Leave empty to keep comments from all authors. Applied after `authors` (an author listed in both is excluded).",
            "items": {
              "type": "string"
            }
          },
          "keywords": {
            "title": "Filter by keyword(s) in comment body",
            "type": "array",
            "description": "Only keep comments whose body contains at least one of these keywords or phrases (case-insensitive substring match). Leave empty to keep all comments.",
            "items": {
              "type": "string"
            }
          },
          "excludeKeywords": {
            "title": "Exclude keyword(s) in comment body",
            "type": "array",
            "description": "Drop comments whose body contains any of these keywords or phrases (case-insensitive substring match), e.g. spam/boilerplate phrases. Applied after `keywords` (a keyword listed in both still excludes the comment). Leave empty to keep all comments.",
            "items": {
              "type": "string"
            }
          },
          "minAwards": {
            "title": "Minimum total awards received",
            "minimum": 0,
            "maximum": 1000000,
            "type": "integer",
            "description": "Only keep comments with at least this many total awards. Leave empty for no limit."
          },
          "minCommentLength": {
            "title": "Minimum comment length (characters)",
            "minimum": 0,
            "maximum": 10000,
            "type": "integer",
            "description": "Only keep comments whose body text is at least this many characters long. Useful for filtering out one-word/emoji-only noise when building NLP datasets. Leave empty for no limit."
          },
          "maxCommentLength": {
            "title": "Maximum comment length (characters)",
            "minimum": 0,
            "maximum": 10000,
            "type": "integer",
            "description": "Only keep comments whose body text is at most this many characters long (Reddit's hard cap is 10,000 characters). Leave empty for no limit."
          },
          "controversialOnly": {
            "title": "Only controversial comments",
            "type": "boolean",
            "description": "When enabled, only keep comments Reddit flags as controversial (near-even up/downvote split, i.e. `controversiality: 1`).",
            "default": false
          },
          "focusOnTargetComment": {
            "title": "Focus on the specific comment in the URL",
            "type": "boolean",
            "description": "When a `postUrls` item is a specific comment permalink (e.g. .../comments/1abc123/title/comment/xyz987/), only that comment plus its ancestor chain (see `commentContext`) is fetched instead of the full thread. Guarantees the target comment is captured even in huge threads where `maxComments` pagination might not reach it. Has no effect on plain post URLs.",
            "default": false
          },
          "commentContext": {
            "title": "Ancestor context depth (mode = focusOnTargetComment)",
            "minimum": 0,
            "maximum": 8,
            "type": "integer",
            "description": "How many levels of parent comments above the target comment to include when `focusOnTargetComment` is enabled (matches Reddit's own comment-permalink page). Ignored otherwise.",
            "default": 3
          }
        }
      },
      "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
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}