{
  "openapi": "3.0.1",
  "info": {
    "title": "Hacker News Scraper: Stories, Comments, Search, Monitor",
    "description": "Scrape Hacker News top, new, best, Ask HN, Show HN and jobs, or search by keyword with a date range and minimum points. One row per story and per comment with depth, plus user submissions, full threads and a monitor mode for new items only. Free public APIs, no login.",
    "version": "0.1",
    "x-build-id": "STlabawQqfxPoziNQ"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/themineworks~hacker-news-scraper/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-themineworks-hacker-news-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/themineworks~hacker-news-scraper/runs": {
      "post": {
        "operationId": "runs-sync-themineworks-hacker-news-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/themineworks~hacker-news-scraper/run-sync": {
      "post": {
        "operationId": "run-sync-themineworks-hacker-news-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 scrape",
            "enum": [
              "top",
              "new",
              "best",
              "ask",
              "show",
              "jobs",
              "search",
              "user",
              "item"
            ],
            "type": "string",
            "description": "Top, New, Best, Ask HN, Show HN and Jobs read the live list in the order the site shows it. Search uses the keywords and dates below. User reads the usernames below. Item reads the stories or comments in Item ids with the comments under them.",
            "default": "top"
          },
          "keywords": {
            "title": "Keywords (search mode)",
            "type": "array",
            "description": "Words to search for in titles, links, story text and comments, one search per line. Example: rust, postgres, claude code. All words of a line must match. Leave empty and set a date range or minimum points to list every story in that range.",
            "items": {
              "type": "string"
            }
          },
          "searchIn": {
            "title": "Search in (search mode)",
            "enum": [
              "story",
              "ask_hn",
              "show_hn",
              "comment",
              "all"
            ],
            "type": "string",
            "description": "What the keyword search returns. Comments come back as comment rows with the story they belong to.",
            "default": "story"
          },
          "sortBy": {
            "title": "Sort (search mode)",
            "enum": [
              "date",
              "relevance"
            ],
            "type": "string",
            "description": "Newest first can go back as far as Hacker News goes. Most relevant first is Algolia's ranking and stops at 1,000 results per keyword.",
            "default": "date"
          },
          "dateFrom": {
            "title": "Posted from (search and user modes)",
            "type": "string",
            "description": "First day to include, YYYY-MM-DD (UTC), or a relative date such as 7 days (meaning 7 days ago). Leave empty for no lower limit."
          },
          "dateTo": {
            "title": "Posted until (search and user modes)",
            "type": "string",
            "description": "Last day to include, YYYY-MM-DD (UTC), the whole day counts, or a relative date such as 1 day (meaning up to 1 day ago). Leave empty for up to now."
          },
          "minPoints": {
            "title": "Minimum points (search and user modes)",
            "minimum": 0,
            "type": "integer",
            "description": "Only stories with at least this many points, for example 100. Leave empty for no limit."
          },
          "minComments": {
            "title": "Minimum comments (search and user modes)",
            "minimum": 0,
            "type": "integer",
            "description": "Only stories with at least this many comments. Leave empty for no limit."
          },
          "usernames": {
            "title": "Usernames (user mode)",
            "type": "array",
            "description": "Hacker News usernames or profile links, one per line, for example pg or https://news.ycombinator.com/user?id=dang. Names are case sensitive.",
            "items": {
              "type": "string"
            }
          },
          "userContent": {
            "title": "User content (user mode)",
            "enum": [
              "stories",
              "comments",
              "all"
            ],
            "type": "string",
            "description": "Which of the user's submissions to return, newest first.",
            "default": "stories"
          },
          "itemIds": {
            "title": "Item ids or links (item mode)",
            "type": "array",
            "description": "Story or comment ids or links, one per line, for example 8863 or https://news.ycombinator.com/item?id=8863. Each gives its own row and the comments under it.",
            "items": {
              "type": "string"
            }
          },
          "maxItems": {
            "title": "Max stories per source",
            "minimum": 1,
            "maximum": 10000,
            "type": "integer",
            "description": "The most stories (or comments, when you search comments) per list, keyword or user, 1 to 10,000. Top and New hold 500 stories, Best 200. Comments under stories do not count here; see Max comments per story. In monitor mode this is the window: the first this many items of each list or search are checked and only the new ones are returned.",
            "default": 100
          },
          "includeComments": {
            "title": "Include comments",
            "type": "boolean",
            "description": "On: each story is followed by its comments as separate rows, in the order the thread shows them, with depth, parent and story id. Always on in item mode.",
            "default": false
          },
          "maxCommentDepth": {
            "title": "Max comment depth",
            "minimum": 1,
            "maximum": 100,
            "type": "integer",
            "description": "How many levels of replies to read. 1 = only direct replies to the story, 2 = those and the replies to them, and so on.",
            "default": 5
          },
          "maxCommentsPerStory": {
            "title": "Max comments per story",
            "minimum": 1,
            "maximum": 10000,
            "type": "integer",
            "description": "The most comment rows under one story or item, 1 to 10,000. When a thread is larger, the higher levels are kept first.",
            "default": 100
          },
          "monitorMode": {
            "title": "Monitor mode (only new items)",
            "type": "boolean",
            "description": "For scheduled runs: return only stories and comments that no earlier monitor run with the same mode and the same keywords, users or items delivered. Items skipped this way are not charged. Example: a keyword search for your product name every hour.",
            "default": 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
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}