{
  "openapi": "3.0.1",
  "info": {
    "title": "Hacker News Scraper",
    "description": "Scrapes Hacker News stories, comments, jobs, polls, and user profiles via the official Firebase and Algolia APIs. Supports full-text search, Who's Hiring thread extraction, author karma snapshots, and deep comment trees.",
    "version": "1.0",
    "x-build-id": "pRvFdTfxPQRT0wKrZ"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/constructive_calm~hacker-news-scraper/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-constructive_calm-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/constructive_calm~hacker-news-scraper/runs": {
      "post": {
        "operationId": "runs-sync-constructive_calm-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/constructive_calm~hacker-news-scraper/run-sync": {
      "post": {
        "operationId": "run-sync-constructive_calm-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",
        "required": [
          "mode"
        ],
        "properties": {
          "mode": {
            "title": "Scraping mode",
            "enum": [
              "topstories",
              "newstories",
              "beststories",
              "askstories",
              "showstories",
              "jobstories",
              "search",
              "user",
              "hiring_threads"
            ],
            "type": "string",
            "description": "What to scrape. 'topstories' / 'newstories' / 'beststories' pull from the official Firebase lists. 'askstories' / 'showstories' / 'jobstories' return only Ask HN / Show HN / jobs. 'search' runs a full-text Algolia query. 'user' returns everything a username has submitted. 'hiring_threads' auto-detects the latest monthly 'Ask HN: Who is hiring?' post and returns its top-level job comments.",
            "default": "topstories"
          },
          "maxItems": {
            "title": "Max items",
            "minimum": 1,
            "maximum": 10000,
            "type": "integer",
            "description": "Maximum number of top-level items to return (stories for list/search/user modes, comments for hiring mode). Firebase list endpoints cap at 500; Algolia search caps at 1000 per page but can paginate further.",
            "default": 30
          },
          "includeComments": {
            "title": "Include comments",
            "type": "boolean",
            "description": "If enabled, each story's full comment tree is fetched and attached under the `comments` field (respecting `maxCommentDepth`). Adds latency and per-comment billing.",
            "default": false
          },
          "maxCommentDepth": {
            "title": "Max comment depth",
            "minimum": 1,
            "maximum": 10,
            "type": "integer",
            "description": "Maximum nesting depth when expanding comment trees. 1 = top-level replies only, 10 = deepest practical threads. Ignored when `includeComments` is off.",
            "default": 3
          },
          "flattenComments": {
            "title": "Flatten comments",
            "type": "boolean",
            "description": "If enabled, comments are returned as a flat array (with a `depth` field) instead of a nested tree. Useful for spreadsheet-friendly output.",
            "default": false
          },
          "minScore": {
            "title": "Minimum score",
            "minimum": 0,
            "type": "integer",
            "description": "Skip stories with fewer points than this. 0 = no filter. Example: set to 100 to only get front-page-worthy stories.",
            "default": 0
          },
          "minComments": {
            "title": "Minimum comments",
            "minimum": 0,
            "type": "integer",
            "description": "Skip stories with fewer comments (descendants) than this. 0 = no filter. Useful for filtering to heavily-discussed threads.",
            "default": 0
          },
          "dateFromUnix": {
            "title": "Date from (Unix timestamp)",
            "type": "integer",
            "description": "Only return items created after this Unix timestamp (seconds since epoch). Leave empty for no lower bound. Example: 1735689600 = 2025-01-01."
          },
          "dateToUnix": {
            "title": "Date to (Unix timestamp)",
            "type": "integer",
            "description": "Only return items created before this Unix timestamp (seconds since epoch). Leave empty for no upper bound."
          },
          "domainFilter": {
            "title": "Domain filter",
            "type": "array",
            "description": "If set, only stories whose URL domain matches one of these are returned. Example: [\"github.com\", \"arxiv.org\"] for tech-focused scraping.",
            "default": [],
            "items": {
              "type": "string"
            }
          },
          "searchQuery": {
            "title": "Search query (Algolia)",
            "type": "string",
            "description": "Full-text search query. Required when `mode` is 'search'. Example: \"Claude\" or \"GPT-5 launch\".",
            "default": ""
          },
          "searchTags": {
            "title": "Search tags (Algolia)",
            "type": "array",
            "description": "Restrict search results by type. Options: 'story', 'comment', 'poll', 'job'. You can also pass 'author_<username>' or 'story_<id>' (advanced). Ignored outside search mode.",
            "default": [],
            "items": {
              "type": "string"
            }
          },
          "sortSearchBy": {
            "title": "Sort search results",
            "enum": [
              "relevance",
              "date"
            ],
            "type": "string",
            "description": "Sort Algolia search results by relevance (best match first) or by date (newest first).",
            "default": "relevance"
          },
          "username": {
            "title": "Username",
            "type": "string",
            "description": "HN username whose submissions to fetch. Required when `mode` is 'user'. Case-sensitive. Example: \"dang\".",
            "default": ""
          },
          "includeUserProfiles": {
            "title": "Include user profiles",
            "type": "boolean",
            "description": "If enabled, each story (and comment, if `includeComments` is on) is enriched with the author's karma and account age. Adds one API call per unique author and is billed separately.",
            "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
                  }
                }
              },
              "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
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}