{
  "openapi": "3.0.1",
  "info": {
    "title": "Hacker News Scraper — Stories, Comments & Users",
    "description": "Scrape Hacker News stories, comments, user profiles, Ask HN, Show HN, jobs, and threaded discussions from the public Firebase API.",
    "version": "1.0",
    "x-build-id": "WZgfGlu3mBTpKyRhS"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/junipr~hacker-news-scraper/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-junipr-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/junipr~hacker-news-scraper/runs": {
      "post": {
        "operationId": "runs-sync-junipr-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/junipr~hacker-news-scraper/run-sync": {
      "post": {
        "operationId": "run-sync-junipr-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": {
          "scrapeType": {
            "title": "Scrape Type",
            "enum": [
              "topStories",
              "newStories",
              "bestStories",
              "askStories",
              "showStories",
              "jobStories",
              "search",
              "user",
              "item"
            ],
            "type": "string",
            "description": "What type of content to scrape from Hacker News. Choose a story feed (top, new, best, ask, show, jobs), search for content via Algolia, look up specific users, or fetch individual items by ID.",
            "default": "topStories"
          },
          "maxItems": {
            "title": "Max Items",
            "minimum": 1,
            "maximum": 500,
            "type": "integer",
            "description": "Maximum number of stories or items to return. Applies to story feeds and search results. Higher values take longer but return more data.",
            "default": 1
          },
          "includeComments": {
            "title": "Include Comments",
            "type": "boolean",
            "description": "Fetch and include the full comment tree for each story. Disabling this significantly speeds up scraping when you only need story metadata.",
            "default": false
          },
          "maxCommentsPerItem": {
            "title": "Max Comments Per Item",
            "minimum": 0,
            "maximum": 1000,
            "type": "integer",
            "description": "Maximum number of comments to fetch per story. Comments are fetched in order of the thread tree (top-level first, then replies). Use lower values for faster runs.",
            "default": 0
          },
          "commentDepth": {
            "title": "Comment Depth",
            "minimum": 1,
            "maximum": 20,
            "type": "integer",
            "description": "Maximum depth of nested replies to follow in comment threads. Depth 1 = top-level comments only. Depth 5 = up to 4 levels of nested replies.",
            "default": 3
          },
          "searchQuery": {
            "title": "Search Query",
            "type": "string",
            "description": "Search query string for finding stories and comments via the Algolia HN Search API. Required when scrapeType is 'search'. Supports standard search operators."
          },
          "searchTags": {
            "title": "Search Tags",
            "enum": [
              "story",
              "comment",
              "poll",
              "job"
            ],
            "type": "string",
            "description": "Filter search results by content type. Only applies when scrapeType is 'search'. Leave empty to search all content types."
          },
          "usernames": {
            "title": "Usernames",
            "type": "array",
            "description": "List of HN usernames to look up. Required when scrapeType is 'user'. Returns profile info including karma, about text, and recent submissions.",
            "items": {
              "type": "string"
            }
          },
          "itemIds": {
            "title": "Item IDs",
            "type": "array",
            "description": "List of HN item IDs to fetch directly. Required when scrapeType is 'item'. Accepts story, comment, job, poll, or poll option IDs.",
            "items": {
              "type": "integer"
            }
          },
          "minScore": {
            "title": "Minimum Score",
            "minimum": 0,
            "type": "integer",
            "description": "Only include items with a score (upvotes) greater than or equal to this value. Useful for filtering out low-quality content."
          },
          "minComments": {
            "title": "Minimum Comments",
            "minimum": 0,
            "type": "integer",
            "description": "Only include stories with at least this many comments (descendants). Useful for finding highly-discussed topics."
          },
          "sortBy": {
            "title": "Sort By",
            "enum": [
              "score",
              "date",
              "comments"
            ],
            "type": "string",
            "description": "How to sort the output results. 'score' sorts by upvotes (highest first), 'date' sorts by newest first, 'comments' sorts by most-discussed first.",
            "default": "score"
          }
        }
      },
      "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
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}