Media, Film & Knowledge

Hacker News API

The Hacker News API returns stories, comments and user data as clean JSON.

9 actionsLive JSON1,000 free creditsMCP-ready
Get a free keyOpen in playground

🤖 Using an AI assistant? Copy this link into ChatGPT / Claude / Cursor — it reads every endpoint and parameter instantly and tells you if this API fits your use case.

The primary item endpoint returns a story or comment (id, type, author, time, title/text/url, score and kids), and you can pull a full comment tree, a user, story lists, search, a poll, the front page, updates and the max item id. It is built for tech-news apps, community analytics and research tools that need HN data with hydrated comment trees. One ReefAPI key, one shared credit pool, the standard envelope.

Live example

Real request and response JSON

Captured from the indexed primary action, search, on .

Captured request
{
  "method": "POST",
  "url": "https://api.reefapi.com/hackernews/v1/search",
  "headers": {
    "x-api-key": "$REEF_KEY",
    "content-type": "application/json"
  },
  "body": {
    "query": "python",
    "tags": "story"
  }
}
Captured response
{
  "ok": true,
  "meta": {
    "api": "hackernews",
    "endpoint": "search",
    "mode": "live",
    "latency_ms": 1112.9,
    "record_count": 20,
    "bytes": 29495,
    "cache_hit": false,
    "completeness_pct": 100,
    "requests": 1,
    "nbHits": 539834,
    "nbPages": 50,
    "page": 0,
    "sort": "relevance"
  },
  "data": {
    "hits": [
      {
        "id": 45751400,
        "type": "story",
        "title": "Uv is the best thing to happen to the Python ecosystem in a decade",
        "url": "https://emily.space/posts/251023-uv",
        "author": "todsacerdoti",
        "points": 2214,
        "num_comments": 1324,
        "text": null,
        "story_id": 45751400,
        "parent_id": null,
        "created_at": "[redacted-phone]T18:57:29Z",
        "created_at_i": 1761764249,
        "tags": [
          "story",
          "author_todsacerdoti",
          "story_45751400"
        ],
        "hn_url": "https://news.ycombinator.com/item?id=45751400"
      },
      {
        "id": 20915746,
        "type": "story",
        "title": "Sunsetting Python 2",
        "url": "https://www.python.org/doc/sunset-python-2/",
        "author": "azizsaya",
        "points": 1616,
        "num_comments": 704,
        "text": null,
        "story_id": 20915746,
        "parent_id": null,
        "created_at": "[redacted-phone]T06:43:24Z",
        "created_at_i": 1568011404,
        "tags": [
          "story",
          "author_azizsaya",
          "story_20915746"
        ],
        "hn_url": "https://news.ycombinator.com/item?id=20915746"
      },
      {
        "id": 13319904,
        "type": "story",
        "title": "Grumpy: Go running Python",
        "url": "https://opensource.googleblog.com/2017/01/grumpy-go-running-python.html",
        "author": "trotterdylan",
        "points": 1411,
        "num_comments": 451,
        "text": null,
        "story_id": 13319904,
        "parent_id": null,
        "created_at": "[redacted-phone]T17:00:39Z",
        "created_at_i": 1483549239,
        "tags": [
          "story",
          "author_trotterdylan",
          "story_13319904"
        ],
        "hn_url": "https://news.ycombinator.com/item?id=13319904"
      }
    ],
    "count": 20,
    "nbHits": 539834,
    "page": 0,
    "nbPages": 50,
    "hitsPerPage": 20,
    "query": "python",
    "processingTimeMS": 12,
    "sort": "relevance"
  }
}
Actions

What the Hacker News API does

ActionDescriptionConcrete use caseKey params
itemsingle item by id (story/comment/job/poll/pollopt) — all official fields + time_iso/kids_count/hn_url; hydrate_kids=resolve top-level commentsContent platforms call item to get single item by id (story/comment/job/poll/pollopt).id, hydrate_kids, kids_limit
item_treefull nested comment TREE for a story in ONE call; recursive children + descendants countResearch tools call item_tree to get full nested comment TREE for a story in ONE call; recursive children + descendants count.id
useruser profile by id: karma/created/about/submitted; hydrate_submitted=resolve recent submissionsCommunity analysts call user to get user profile by id.id, hydrate_submitted, submitted_limit
storiesstory-list (list=top/new/best/ask/show/job) → ranked hydrated stories; offset/limit pagination, hydrate=false for ids onlyMedia monitors call stories to get story-list (list=top/new/best/ask/show/job) → ranked hydrated stories; offset/limit paginatio….list, limit, offset, hydrate
searchFull-text search: query + tags(story/comment/ask_hn/show_hn/poll/front_page/author_X/story_X) + min_points/max_points/min_comments/before/after + sort(relevance|date), paginatedContent platforms call search to get full-text search.query, tags, sort, page, hits_per_page, ...
pollPoll detail by id: the question + every voting option resolved and ranked by votes, with total_votes and the comment count. (Find poll ids via search with tags=poll.)Research tools call poll to get poll detail by id.id
front_pageStories that recently made the Hacker News front page (newest-first), paginated. Optional after/before date window. NOTE: the front-page index only retains ~the last 7 days — it is 'what's on / recently hit the front page', not a historical archive.Community analysts call front_page to get stories that recently made the Hacker News front page (newest-first), paginated.limit, page, after, before
updateslive changefeed: recently changed item ids + profiles + max_item; hydrate=resolve changed itemsMedia monitors call updates to get live changefeed.hydrate, limit
max_itemthe current largest item id on Hacker News — the newest id, useful for backfilling / id-range walksContent platforms call max_item to get the current largest item id on Hacker News.none
Code samples

Call search from your stack

curl -X POST https://api.reefapi.com/hackernews/v1/search \
  -H "x-api-key: $REEF_KEY" \
  -H "content-type: application/json" \
  -d '{"query":"python","tags":"story"}'
MCP one-liner
Ask your MCP-connected assistant: call reefapi.hackernews.search with {"query":"python","tags":"story"}.
Use cases

Who uses this API and why

  • Tech-news apps call stories and front_page to show the current Hacker News ranking.
  • Community-analytics tools use item_tree to analyze full discussion threads at once.
  • Research products use search and user to track topics and contributors over time.
FAQ

Questions developers ask before integrating

What is the Hacker News API?

Hacker News API is a ReefAPI endpoint group for stories, comments, users and full-text search. It returns live JSON through POST requests under /hackernews/v1.

Is the Hacker News API free to try?

Yes. ReefAPI starts with 1,000 free credits, no card required. Hacker News calls use the same shared credit balance as every other ReefAPI engine.

Do I need a Hacker News login or account?

No login to Hacker News is needed for the API response. You call ReefAPI with your x-api-key header, and the playground can run live examples before you create a production key.

How fresh is the Hacker News data?

The page example is captured from a live item call, and production requests fetch live data through ReefAPI rather than a static sample.

How many credits does the Hacker News API use?

Hacker News actions currently cost 1-2 credits per successful call. Failed or blocked calls are free, and all APIs draw from one credit pool.

Can I call Hacker News from an AI assistant or MCP client?

Yes. Connect ReefAPI once through MCP and your assistant can call hackernews actions with the same key, credit pool and JSON envelope used by normal REST requests.

Is the Hacker News API a Hacker News scraper?

It is the managed alternative to a DIY Hacker News scraper. Instead of building and maintaining your own scraper — proxies, headless browsers, captcha and constant breakage — you call one ReefAPI endpoint and get the same stories, comments, users and full-text search back as clean JSON.

Why does my Hacker News scraper keep getting blocked?

Most Hacker News scrapers break on anti-bot defenses, rate limits and IP bans that need rotating residential proxies and browser fingerprinting to clear. ReefAPI handles all of that for you — no proxies, no captchas, no maintenance — and returns live JSON. Blocked or failed calls are free.

docs / hackernews

Hacker News

Stories, comments, users and full-text search.

base /hackernews/v19 endpoints
post/hackernews/v1/item1 credit

single item by id (story/comment/job/poll/pollopt) — all official fields + time_iso/kids_count/hn_url; hydrate_kids=resolve top-level comments

ParameterAllowed / rangeDescription
idrequiredHackerNews item id (story/comment/job/poll/pollopt) — the digits in an item URL (news.ycombinator.com/item?id=...).
hydrate_kids = falseoptionalIf true, resolve the item's top-level comments into full objects instead of bare ids.
kids_limit = 30optional1–100When hydrate_kids=true, how many top-level comments to resolve (1-100).
Try in playground →
post/hackernews/v1/item_tree1 credit

full nested comment TREE for a story in ONE call; recursive children + descendants count

ParameterAllowed / rangeDescription
idrequiredHackerNews item id (story/comment/job/poll/pollopt) — the digits in an item URL (news.ycombinator.com/item?id=...).
Try in playground →
post/hackernews/v1/user1 credit

user profile by id: karma/created/about/submitted; hydrate_submitted=resolve recent submissions

ParameterAllowed / rangeDescription
idrequiredHackerNews username (case-sensitive), e.g. 'pg'.
hydrate_submitted = falseoptionalIf true, resolve the user's recent submissions into full objects instead of bare ids.
submitted_limit = 20optional1–100When hydrate_submitted=true, how many recent submissions to resolve (1-100).
Try in playground →
post/hackernews/v1/stories2 credits

story-list (list=top/new/best/ask/show/job) → ranked hydrated stories; offset/limit pagination, hydrate=false for ids only

ParameterAllowed / rangeDescription
list = topoptionaltop · new · best · ask · show · jobWhich HackerNews story list to return.
limit = 30optional1–100Stories to return (1-100, default 30). Out-of-range values are clamped.
offset = 0optional0–500Pagination offset into the story list (0-500). Skip N ranked stories.
hydrate = trueoptionalIf true, resolve each ranked story id into full objects instead of bare ids (default true).
Try in playground →
post/hackernews/v1/poll1 credit

Poll detail by id: the question + every voting option resolved and ranked by votes, with total_votes and the comment count. (Find poll ids via search with tags=poll.)

ParameterAllowed / rangeDescription
idrequiredHackerNews poll id (the digits in a poll's item URL). Find polls with the search action using tags=poll.
Try in playground →
post/hackernews/v1/front_page1 credit

Stories that recently made the Hacker News front page (newest-first), paginated. Optional after/before date window. NOTE: the front-page index only retains ~the last 7 days — it is 'what's on / recently hit the front page', not a historical archive.

ParameterAllowed / rangeDescription
limit = 30optional1–100Front-page stories to return (1-100, default 30). Out-of-range values are clamped.
page = 0optional0–500-based search results page (0-50). Page forward via meta.nbPages.
afteroptionalOnly front-page stories created on/after this date (unix ts or YYYY-MM-DD). Note: the front-page index only retains ~the last 7 days.
beforeoptionalOnly front-page stories created on/before this date (unix ts or YYYY-MM-DD).
Try in playground →
post/hackernews/v1/updates1 credit

live changefeed: recently changed item ids + profiles + max_item; hydrate=resolve changed items

ParameterAllowed / rangeDescription
hydrate = falseoptionalIf true, resolve the changed item ids into full objects instead of bare ids.
limit = 30optional1–100Changed items to hydrate (1-100, default 30). Out-of-range values are clamped.
Try in playground →
post/hackernews/v1/max_item1 credit

the current largest item id on Hacker News — the newest id, useful for backfilling / id-range walks

Try in playground →