{
  "openapi": "3.0.1",
  "info": {
    "title": "Hacker News Scraper",
    "description": "Stories, comments, users and the live front page from the Hacker News APIs. Time-slices past the 1,000-result ceiling that caps every other HN scraper, and flags upstream's match count as an estimate when it is one — the two search endpoints disagree about it by up to 111x.",
    "version": "0.1",
    "x-build-id": "vm8rELGkfEAb6YSBc"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/scrapyx~hackernews-scraper/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-scrapyx-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/scrapyx~hackernews-scraper/runs": {
      "post": {
        "operationId": "runs-sync-scrapyx-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/scrapyx~hackernews-scraper/run-sync": {
      "post": {
        "operationId": "run-sync-scrapyx-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",
        "properties": {
          "mode": {
            "title": "What to collect",
            "enum": [
              "search",
              "items",
              "users",
              "lists"
            ],
            "type": "string",
            "description": "search = full-text search over every HN item ever posted. items = full comment threads for specific item IDs. users = account profiles and their submissions. lists = the live front page and the other ranked lists.",
            "default": "search"
          },
          "queries": {
            "title": "Search phrases",
            "type": "array",
            "description": "Search terms for mode='search'. Each runs as its own query with its own summary row. Leave empty and set tags instead to list everything of one kind (e.g. every Show HN post in a date range).",
            "items": {
              "type": "string"
            }
          },
          "tags": {
            "title": "Item kinds",
            "type": "array",
            "description": "Restrict to certain kinds of item: story, comment, poll, pollopt, job, ask_hn, show_hn, launch_hn, front_page. Also accepts author_<username> and story_<id>. Several entries are ANDed. Note front_page is a live snapshot of roughly 30 items — the exact count moves (30 one hour, 29 the next) and is reported in the summary, so it can never return much more than that however deep you page.",
            "items": {
              "type": "string"
            }
          },
          "sortBy": {
            "title": "Sort order",
            "enum": [
              "date",
              "relevance"
            ],
            "type": "string",
            "description": "date = newest first, and the ONLY order that can be walked past 1,000 results (the actor time-slices the query automatically; 8,000 stories took 8 requests). relevance = best match first, but Hacker News caps it at 1,000 results and no workaround exists, so the summary reports depthCapped.",
            "default": "date"
          },
          "dateFrom": {
            "title": "Posted on or after (YYYY-MM-DD)",
            "type": "string",
            "description": "Only return items created at or after this date. Also accepts a raw epoch second."
          },
          "dateTo": {
            "title": "Posted on or before (YYYY-MM-DD)",
            "type": "string",
            "description": "Only return items created at or before this date. Also accepts a raw epoch second."
          },
          "minPoints": {
            "title": "Minimum points",
            "minimum": 0,
            "type": "integer",
            "description": "Only return items with at least this many points. Job posts carry no points at all and are excluded by any value here."
          },
          "minComments": {
            "title": "Minimum comments",
            "minimum": 0,
            "type": "integer",
            "description": "Only return stories with at least this many comments. Applies to stories only — comments themselves have no comment count."
          },
          "itemIds": {
            "title": "Item IDs",
            "type": "array",
            "description": "For mode='items'. A number (8863) or a news.ycombinator.com/item?id=... URL. Each fetch returns the whole pre-joined comment tree in ONE request.",
            "items": {
              "type": "string"
            }
          },
          "usernames": {
            "title": "Usernames",
            "type": "array",
            "description": "For mode='users'. A handle (pg) or a news.ycombinator.com/user?id=... URL. Read from the Firebase API, which carries the account age and the full submission list — the Algolia user endpoint returns only three fields and no submissions.",
            "items": {
              "type": "string"
            }
          },
          "lists": {
            "title": "Which ranked lists",
            "type": "array",
            "description": "For mode='lists'. Any of: topstories (the front page, in order), newstories, beststories, askstories, showstories, jobstories. List position is preserved as listRank. These are as long as HN has live items — measured 500, 500, 200, 28, 165 and 31 — not a fixed size.",
            "items": {
              "type": "string"
            }
          },
          "includeComments": {
            "title": "Include comment threads",
            "type": "boolean",
            "description": "Emit every comment as its own row, with treeDepth and rootStoryId. In search mode this costs one extra request per story returned; in items mode the tree is what you asked for. A busy thread can be thousands of rows.",
            "default": false
          },
          "maxCommentDepth": {
            "title": "Max comment depth",
            "minimum": 0,
            "maximum": 50,
            "type": "integer",
            "description": "Stop descending a comment tree at this depth (0 = the story only, 1 = top-level replies). Leave empty for the whole tree."
          },
          "includeTextHtml": {
            "title": "Keep the raw HTML of item text",
            "type": "boolean",
            "description": "HN item text is HTML with entity-escaped punctuation. A readable plain-text version is always emitted as `text`; turn this on to also keep the original markup as `textHtml`.",
            "default": false
          },
          "includeSubmittedIds": {
            "title": "Include the full submission ID list",
            "type": "boolean",
            "description": "users mode only. Off by default because the list can be enormous — pg has 15,565 IDs. submissionCount is always reported either way.",
            "default": false
          },
          "maxSubmissionsPerUser": {
            "title": "Fetch this many recent submissions per user",
            "minimum": 0,
            "maximum": 500,
            "type": "integer",
            "description": "users mode only. Hydrates the user's newest N submissions into full ITEM rows, one request each. 0 fetches none.",
            "default": 0
          },
          "maxResultsPerQuery": {
            "title": "Max items per query",
            "minimum": 0,
            "type": "integer",
            "description": "Set 0 for unlimited. With sortBy='date' the actor time-slices past Hacker News's 1,000-result ceiling, so this really is the only limit. With sortBy='relevance' nothing above 1,000 is reachable and the summary says so.",
            "default": 200
          },
          "pageSize": {
            "title": "Results per request",
            "minimum": 1,
            "maximum": 1000,
            "type": "integer",
            "description": "Between 1 and 1000. Values above 1000 are silently clamped by Hacker News, with no error. Leave at 1000 for the fewest requests.",
            "default": 1000
          },
          "maxConcurrency": {
            "title": "Max concurrent requests",
            "minimum": 1,
            "maximum": 20,
            "type": "integer",
            "description": "Requests in flight at once. Both APIs are fast and unmetered; 60 back-to-back requests returned 200 sixty times with no throttling.",
            "default": 4
          },
          "minRequestInterval": {
            "title": "Min seconds between request starts",
            "minimum": 0,
            "maximum": 30,
            "type": "integer",
            "description": "Politeness pacing shared across all workers. 0 uses the built-in default.",
            "default": 0
          },
          "proxyConfiguration": {
            "title": "Proxy configuration",
            "type": "object",
            "description": "Optional and OFF by default. Both API hosts are public and keyless and showed no WAF — all seven TLS profiles plus a plain urllib request returned identical responses.",
            "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
                  }
                }
              },
              "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
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}