{
  "openapi": "3.0.1",
  "info": {
    "title": "Hacker News Scraper",
    "description": "Scrape Hacker News stories, comments, jobs, and user profiles. Modes: top/new/best/ask/show/jobs/past/item/user/search. Filters: minScore, domainFilter, dateRange, commentMinScore. No proxy, no auth.",
    "version": "1.0",
    "x-build-id": "RkbQDT2Z3x4b78DTO"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/crawlerbros~hackernews-scraper/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-crawlerbros-hackernews-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~hackernews-scraper/runs": {
      "post": {
        "operationId": "runs-sync-crawlerbros-hackernews-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~hackernews-scraper/run-sync": {
      "post": {
        "operationId": "run-sync-crawlerbros-hackernews-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": [
          "mode"
        ],
        "properties": {
          "mode": {
            "title": "Mode",
            "enum": [
              "topStories",
              "newStories",
              "bestStories",
              "askStories",
              "showStories",
              "jobStories",
              "item",
              "user",
              "search"
            ],
            "type": "string",
            "description": "What to scrape. `topStories` / `newStories` / `bestStories` / `askStories` / `showStories` / `jobStories` walk the public feeds. `item` fetches specific item IDs (`itemIds`). `user` fetches profiles (`usernames`). `search` uses the Algolia HN API (`searchQuery`).",
            "default": "topStories"
          },
          "itemIds": {
            "title": "Item IDs (mode=item)",
            "type": "array",
            "description": "Direct Hacker News item IDs (numeric strings or integers). Used when mode=`item`.",
            "default": [],
            "items": {
              "type": "string"
            }
          },
          "usernames": {
            "title": "Usernames (mode=user)",
            "type": "array",
            "description": "Hacker News usernames. Used when mode=`user`.",
            "default": [],
            "items": {
              "type": "string"
            }
          },
          "searchQuery": {
            "title": "Search query (mode=search)",
            "type": "string",
            "description": "Free-text query passed to the Algolia HN search API."
          },
          "startUrls": {
            "title": "Start URLs (optional)",
            "type": "array",
            "description": "Hacker News URLs to scrape directly. Supports `news.ycombinator.com/item?id=N` and `news.ycombinator.com/user?id=USER`. Each URL is converted to an item or user fetch.",
            "default": [],
            "items": {
              "type": "string"
            }
          },
          "enableCommentHierarchy": {
            "title": "Build comment tree",
            "type": "boolean",
            "description": "When true, attach a nested `comments[]` array to each story (recursive replies). When false, comments are emitted as flat sibling records (one per row, with `parentId` and `depth`).",
            "default": false
          },
          "maxItems": {
            "title": "Max items",
            "minimum": 1,
            "maximum": 5000,
            "type": "integer",
            "description": "Hard cap on emitted records (stories + comments + users combined).",
            "default": 100
          },
          "maxComments": {
            "title": "Max comments per story",
            "minimum": 0,
            "maximum": 5000,
            "type": "integer",
            "description": "Cap on comments fetched per story. 0 = no comments. Default 0 (skip comments).",
            "default": 0
          },
          "maxDepth": {
            "title": "Max comment depth",
            "minimum": 0,
            "maximum": 20,
            "type": "integer",
            "description": "Maximum reply depth when fetching comments (only applies when `maxComments` > 0). Root comments are depth 0.",
            "default": 5
          },
          "minScore": {
            "title": "Min story score",
            "minimum": 0,
            "maximum": 100000,
            "type": "integer",
            "description": "Drop stories with fewer points than this. Comments are unaffected."
          },
          "domainAllowlist": {
            "title": "Domain allowlist",
            "type": "array",
            "description": "Only emit stories whose URL host contains one of these substrings (case-insensitive). e.g. ['github.com','arxiv.org'].",
            "default": [],
            "items": {
              "type": "string"
            }
          },
          "domainBlocklist": {
            "title": "Domain blocklist",
            "type": "array",
            "description": "Drop stories whose URL host contains one of these substrings. e.g. ['twitter.com','x.com'].",
            "default": [],
            "items": {
              "type": "string"
            }
          },
          "excludeDeadOrDeleted": {
            "title": "Exclude dead/deleted",
            "type": "boolean",
            "description": "Drop items flagged `dead: true` or `deleted: true` by Hacker News.",
            "default": true
          },
          "dateRangeFrom": {
            "title": "Date range from (ISO YYYY-MM-DD)",
            "type": "string",
            "description": "Drop items posted before this date (UTC). Empty = no lower bound."
          },
          "dateRangeTo": {
            "title": "Date range to (ISO YYYY-MM-DD)",
            "type": "string",
            "description": "Drop items posted after this date (UTC). Empty = no upper bound."
          },
          "commentMinScore": {
            "title": "Min comment score",
            "minimum": 0,
            "maximum": 100000,
            "type": "integer",
            "description": "Drop comments below this score. (Note: HN exposes comment scores only sporadically; comments without a score are kept.)"
          },
          "commentAuthorFilter": {
            "title": "Comment author allowlist",
            "type": "array",
            "description": "Only emit comments authored by one of these usernames (case-insensitive substring match).",
            "default": [],
            "items": {
              "type": "string"
            }
          },
          "minCommentCount": {
            "title": "Min number of comments",
            "minimum": 0,
            "maximum": 100000,
            "type": "integer",
            "description": "Drop stories with fewer than this many comments."
          }
        }
      },
      "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
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}