All platforms

Hacker News API

Search mentions, track feeds, pull comment trees, mine user history and public favorites, and parse Who is Hiring — one Social Fetch key and envelope.

Why teams use Social Fetch for Hacker News

A Hacker News item URL only tells you so much on its own. `GET /v1/hackernews/items/{id}` resolves any numeric id — story, comment, job, poll, or pollopt — to a typed payload with `data.lookupStatus` and the shared fields (author, createdAt, title, text, url, score, commentCount, parentId, childIds, dead, deleted). When your pipeline already knows the id is a story, `GET /v1/hackernews/stories/{id}` returns the same card and a typed `not_story` miss if it isn't. Comment threads are the harder problem: `GET /v1/hackernews/stories/{id}/comments` pages a flat comment list with `parentId`/`childIds`, a `page` block (`hasMore`, `nextCursor`), and `traversal` telemetry (`returnedNodes`, `discoveredNodes`, `snapshotAt`), and `GET /v1/hackernews/comments/{id}/context` walks the opposite direction — from one comment id up through `ancestors` to the root `story` — which is exactly the lookup an alerting tool needs when it only has a deep comment link.

Author research runs through `/users/{username}`: the profile route returns `karma`, `about`, and `createdAt`, then three sibling paths page activity — `/submissions` (stories, polls, and jobs, newest first), `/comments` (the reply stream), and `/favorites` (public saves only; private lists come back as `lookupStatus: private_or_unavailable` rather than a fake empty 200, since HN never exposed favorites through its own JSON API in the first place). `GET /v1/hackernews/search` covers the case none of the id-based routes can: keyword discovery across stories, comments, Ask HN, Show HN, Launch HN, jobs, and polls, filterable by `author`, `domain`, `url`, `type`, `minPoints`, and `dateRange`, sorted by popularity or date.

Two more surfaces round out the catalog. `GET /v1/hackernews/feeds/{feed}` hydrates the ranked lists HN itself curates — `top`, `new`, `best`, `ask`, `show`, `jobs` — into full item rows instead of a bare id array, and `GET /v1/hackernews/jobs/who-is-hiring` discovers the current monthly Ask HN thread and parses its top-level comments into job rows with best-effort `company`/`role`/`location`/`remote`/`salary`/`visa`/`contact` fields (the full comment `text` stays the source of truth when a parse comes back null). For freshness polling without re-walking the whole corpus, `GET /v1/hackernews/maxitem` returns the current high-water `maxItemId` and `GET /v1/hackernews/updates` lists recently changed item ids and usernames — pair both to catch new posts and edits to old ones on the same cron tick.

What Hacker News data can you get?

  • Polymorphic item get (`/items/{id}`) plus a story-only lookup (`/stories/{id}`) that returns a typed `not_story` miss for non-story ids.
  • Comment tree paging by story id (`/stories/{id}/comments`, `page` cursor + `traversal` telemetry) and upward ancestor context from a single comment id (`/comments/{id}/context`).
  • User profile (`/users/{username}`: karma, about, createdAt) plus paginated submissions, comments, and public-only favorites for the same username.
  • Full-text search (`/search`) with author, domain, url, type, minPoints, and dateRange filters across stories, comments, Ask/Show/Launch HN, jobs, and polls.
  • Ranked feeds (`/feeds/{feed}`: top, new, best, ask, show, jobs) hydrated into full items, not bare id arrays.
  • Structured Who is Hiring parsing (`/jobs/who-is-hiring`) and thin `/maxitem` + `/updates` helpers for cheap freshness polling.

How to call the Hacker News API

  1. 1. Create an API key

    Sign up at Social Fetch and copy a key (`sfk_…`). New accounts get 100 free credits — enough to run a search, page a feed, resolve a story, and page one story's comments against live data.

  2. 2. Call the matching route

    Use `/search` for mentions and launches, `/feeds/{feed}` for ranked digests, `/stories/{id}` or `/items/{id}` for a known id, `/stories/{id}/comments` or `/comments/{id}/context` for discussion, `/users/{username}` and its `/submissions`, `/comments`, `/favorites` children for author history, and `/jobs/who-is-hiring` for structured hiring rows. Send `x-api-key` on every request.

  3. 3. Branch on the envelope, then bill

    Check `data.lookupStatus` before writing a row — `found`, `not_found`, `not_story`, `not_comment`, or `private_or_unavailable`. Log `meta.requestId` for support, and bill from `meta.creditsCharged`, since comment routes cost more than a plain item lookup (see pricing below).

How much does the Hacker News API cost?

Most routes charge 1 credit per successful request or page. Story comment paging (`GET /v1/hackernews/stories/{id}/comments`) charges 3 credits per page; comment context (`GET /v1/hackernews/comments/{id}/context`) charges 2 credits per request. Credits never expire on pay-as-you-go packs. Confirm every response with `meta.creditsCharged`.

See credit packs

Social Fetch vs the official Hacker News API

Hacker News Firebase API (`hacker-news.firebaseio.com`) is free and public — fine for a single item or max-item id. It has no full-text search, no feed hydration beyond id arrays, and no comment-tree traversal. Social Fetch adds search, feed hydration, cursor-paged comment trees, and ancestor context under one envelope alongside Reddit, Telegram, and X.

Hacker News API FAQ

Is there a Hacker News scraper API?

Yes. Social Fetch provides search, ranked feeds, story and polymorphic item lookup, comment-tree paging, comment ancestor context, user profile plus submissions/comments/favorites, Who is Hiring parsing, and updates/maxitem freshness polls under `/v1/hackernews`. Authenticate with a Social Fetch API key in the `x-api-key` header.

How is this different from Hacker News's own Firebase API?

HN's Firebase API (`hacker-news.firebaseio.com`) is free and public with no key required, and it is a fine choice for a single item or the max-item id. It has no full-text search, no ranked-feed hydration beyond raw id arrays, and no built-in comment-tree traversal — you write the recursive `kids` walk yourself. Social Fetch adds search, feed hydration, cursor-paged comment trees, and comment-to-root ancestor context under one envelope alongside other platforms.

How do I get the full comment thread for a story?

Call `GET /v1/hackernews/stories/{id}/comments` with the story id. It returns a flat `comments` list (each with `parentId`/`childIds`), `rootCommentIds`, a `page` block for continuation, and `traversal` telemetry. When `page.hasMore` is true, pass `page.nextCursor` as the `cursor` query param to keep paging. This route charges 3 credits per page — more than a plain item lookup — because it walks the tree server-side so you don't have to.

How do I get context for a single deep comment link?

Call `GET /v1/hackernews/comments/{id}/context` with the comment id. On `lookupStatus: found` you get `data.comment`, an `ancestors` chain toward the root, and the root `data.story` when available. This is the route for expanding a bare comment URL into title, thread, and reply context — it charges 2 credits per request.

Can I get a user's favorites?

Yes for public favorites via `GET /v1/hackernews/users/{username}/favorites`. Private or unavailable favorites return `lookupStatus: private_or_unavailable` with an empty items list rather than a fake empty found page. Upvoted pages are not supported.

Do you structure Who is Hiring threads?

Yes. `GET /v1/hackernews/jobs/who-is-hiring` discovers the current monthly Ask HN thread and returns top-level comments as rows with `commentId`, `author`, `createdAt`, the full plain-text `text`, and best-effort `company`, `role`, `location`, `remote`, `salary`, `visa`, and `contact` fields. Structured fields can be null even when the posting mentions them in prose — `text` is always the source of truth.

What's the difference between search, feeds, and Who is Hiring for jobs?

`GET /v1/hackernews/feeds/jobs` returns the ranked feed of standalone HN job-type items. `GET /v1/hackernews/jobs/who-is-hiring` parses the monthly Ask HN thread's comments into job rows instead. `GET /v1/hackernews/search` with `type=job` is keyword discovery across job postings. Pick the route that matches the corpus you actually want.

How much does the Hacker News API cost?

You buy credit packs (or use the 100 free signup credits). Most routes — search, feeds, stories, items, user profile, submissions, comments, favorites, updates, maxitem, and Who is Hiring — cost 1 credit per successful request or page. Story comment paging costs 3 credits per page and comment context costs 2 credits per request. Always check `meta.creditsCharged` on the response.

Does HTTP 200 always mean the story or user was found?

No. HTTP 200 means the request finished. Check `data.lookupStatus` where the route exposes it — `found`, `not_found`, `not_story`, `not_comment`, or `private_or_unavailable` (favorites only). Persist `meta.requestId` when you need to debug a miss.

How do I poll for new and changed Hacker News content?

Use `GET /v1/hackernews/maxitem` for the current high-water `maxItemId` to catch brand-new ids, and `GET /v1/hackernews/updates` for `changedItemIds`/`changedUsernames` to catch edits to existing items and profiles. Neither returns full bodies — hydrate the ids you care about with `/items/{id}`, `/stories/{id}`, or `/users/{username}` after filtering.

Is scraping Hacker News data legal?

Social Fetch returns publicly visible HN data via HN's own public APIs and the public favorites page. You are responsible for how you use it under Y Combinator's terms, applicable law, and your own compliance review. We do not give legal advice.

Start with Hacker News data

Create an account, spend the 100 free credits on live Hacker News routes, then buy a pack when the JSON fits your pipeline. Credits do not expire on pay-as-you-go packs.