Hacker News API
The Hacker News API returns stories, comments and user data as clean JSON.
🤖 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.
Real request and response JSON
Captured from the indexed primary action, search, on .
{
"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"
}
}{
"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"
}
}What the Hacker News API does
| Action | Description | Concrete use case | Key params |
|---|---|---|---|
| item | single item by id (story/comment/job/poll/pollopt) — all official fields + time_iso/kids_count/hn_url; hydrate_kids=resolve top-level comments | Content platforms call item to get single item by id (story/comment/job/poll/pollopt). | id, hydrate_kids, kids_limit |
| item_tree | full nested comment TREE for a story in ONE call; recursive children + descendants count | Research tools call item_tree to get full nested comment TREE for a story in ONE call; recursive children + descendants count. | id |
| user | user profile by id: karma/created/about/submitted; hydrate_submitted=resolve recent submissions | Community analysts call user to get user profile by id. | id, hydrate_submitted, submitted_limit |
| stories | story-list (list=top/new/best/ask/show/job) → ranked hydrated stories; offset/limit pagination, hydrate=false for ids only | Media monitors call stories to get story-list (list=top/new/best/ask/show/job) → ranked hydrated stories; offset/limit paginatio…. | list, limit, offset, hydrate |
| search | Full-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), paginated | Content platforms call search to get full-text search. | query, tags, sort, page, hits_per_page, ... |
| poll | 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.) | Research tools call poll to get poll detail by id. | id |
| front_page | 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. | Community analysts call front_page to get stories that recently made the Hacker News front page (newest-first), paginated. | limit, page, after, before |
| updates | live changefeed: recently changed item ids + profiles + max_item; hydrate=resolve changed items | Media monitors call updates to get live changefeed. | hydrate, limit |
| max_item | the current largest item id on Hacker News — the newest id, useful for backfilling / id-range walks | Content platforms call max_item to get the current largest item id on Hacker News. | none |
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"}'import requests
r = requests.post(
"https://api.reefapi.com/hackernews/v1/search",
headers={"x-api-key": REEF_KEY},
json={
"query": "python",
"tags": "story"
},
)
print(r.json()["data"])const res = await fetch("https://api.reefapi.com/hackernews/v1/search", {
method: "POST",
headers: {
"x-api-key": process.env.REEF_KEY,
"content-type": "application/json",
},
body: JSON.stringify({
"query": "python",
"tags": "story"
}),
});
const { ok, data, meta, error } = await res.json();Ask your MCP-connected assistant: call reefapi.hackernews.search with {"query":"python","tags":"story"}.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.
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.