Hacker News API: Search stories
Searches Hacker News stories or comments by words, date range and sort order. Comments include their parent story's website link when one exists; text-only stories have no website link.
Unofficial. Not affiliated with or endorsed by Hacker News.
Inputs
Values from the run on Oct 23, 2026, shown under Output.
- Page optional
page Page number, starting with 1, such as 2.
1 (default)
Whole number 1 or more.
- Sort optional
sort Order by relevance or newest, such as newest.
relevance (default)
One of
relevance,newest.- Type optional
type Search stories or comments, such as comments.
stories (default)
One of
stories,comments.- Query, required
query Words to search for, such as remote work.
remote work
- Max Results optional
max_results Maximum results on this page, such as 20.
20 (default)
Whole number from 1 to 100.
- Time Window optional
time_window How far back to search, such as past_week.
all_time (default)
One of
past_day,past_week,past_month,past_year,all_time.
Input as JSON
{ "query": "remote work"}Output
{ "results": [ { "title": "Remote work doesn't seem to affect productivity, Fed study finds", "author": "simula67", "points": 848, "item_id": "39037589", "posted_at": "2024-01-18T03:55:56Z", "website_url": "https://www.bloomberg.com/news/articles/2024-01-16/remote-work-doesn-t-seem-to-affect-productivity-fed-study-finds" , "comment_text": null, "comment_count": 579, "hacker_news_url": "https://news.ycombinator.com/item?id=39037589" }, { "title": "Written communication is remote work super power", "author": "snird", "points": 831, "item_id": "23577228", "posted_at": "2020-06-19T18:08:45Z", "website_url": "https://snir.dev/blog/remote-async-communication/" , "comment_text": null, "comment_count": 190, "hacker_news_url": "https://news.ycombinator.com/item?id=23577228" }, { "title": "SSH hacks – a little sanity for remote workers", "author": "mxfurman", "points": 770, "item_id": "23025756", "posted_at": "2020-04-29T23:20:48Z", "website_url": "https://smallstep.com/blog/ssh-tricks-and-tips/" , "comment_text": null, "comment_count": 227, "hacker_news_url": "https://news.ycombinator.com/item?id=23025756" } ]}Code
curl https://api.fous.com/v1/runs \ -H "Authorization: Bearer $FOUS_API_KEY" \ -H "Content-Type: application/json" \ -d '{"method":"news.ycombinator.com/search_stories","input":{"query":"remote work"}}' # Save as fous.py, then run: python3 fous.pyimport json, os, timefrom urllib.error import HTTPErrorfrom urllib.request import Request, urlopenAPI = "https://api.fous.com/v1/runs" KEY = os.environ["FOUS_API_KEY"]HEADERS = { "Authorization": f"Bearer {KEY}", "Content-Type": "application/json" ,}def call(url, body=None): data = json.dumps(body).encode() if body else None request = Request(url, data, HEADERS) try: with urlopen(request, timeout=120) as r: return r.status, json.load(r) except HTTPError as error: message = json.load(error)["error"]["message"] raise RuntimeError(message) from errorstatus, run = call(API, { "method": "news.ycombinator.com/search_stories" , "input": { "query": "remote work" }})# 202: still going after 30 s. Ask again until it ends.while status == 202: time.sleep(2) status, run = call(f"{API}/{run['id']}")print(json.dumps(run["data"], indent=2))// Save as fous.mjs, then run: node fous.mjsconst api = "https://api.fous.com/v1/runs" ;const headers = { Authorization: `Bearer ${process.env.FOUS_API_KEY}`, "Content-Type": "application/json" ,};let response = await fetch(api, { method: "POST", headers, body: JSON.stringify({ "method": "news.ycombinator.com/search_stories" , "input": { "query": "remote work" } }), signal: AbortSignal.timeout(120_000),});let run = await response.json();// 202: still going after 30 s. Ask again until it ends.while (response.status === 202) { await new Promise((done) => setTimeout(done, 2_000)); response = await fetch(`${api}/${run.id}`, { headers }); run = await response.json();}if (!response.ok) throw new Error(run.error.message);console.log(run.data);# Connect your agent to Fous once, over MCP (Streamable HTTP):# https://api.fous.com/mcp# Set FOUS_API_KEY first: create a key at https://app.fous.com/keys.# Claude Codeclaude mcp add \ --scope user \ --transport http fous https://api.fous.com/mcp \ --header "Authorization: Bearer ${FOUS_API_KEY:?Set FOUS_API_KEY to your Fous API key}"# Codexcodex mcp add fous \ --url https://api.fous.com/mcp \ --bearer-token-env-var FOUS_API_KEY# Cursor, VS Code, Windsurf, Cline and morenpx -y add-mcp https://api.fous.com/mcp -g -n fous \ --header "Authorization: Bearer ${FOUS_API_KEY:?Set FOUS_API_KEY to your Fous API key}"# Then ask your agent:# "Use Fous to run news.ycombinator.com/search_stories# with {"query":"remote work"}"Over HTTP, the answer’s data holds the output. A run still going after 30 seconds answers 202 with its id: ask GET /v1/runs/{id} until it ends.
Schema
Input schema
{ "type": "object", "required": [ "query" ], "properties": { "page": { "type": "integer", "default": 1, "minimum": 1, "description": "Page number, starting with 1, such as 2." }, "sort": { "enum": [ "relevance", "newest" ], "type": "string", "default": "relevance", "description": "Order by relevance or newest, such as newest." }, "type": { "enum": [ "stories", "comments" ], "type": "string", "default": "stories", "description": "Search stories or comments, such as comments." }, "query": { "type": "string", "minLength": 1, "description": "Words to search for, such as remote work." }, "max_results": { "type": "integer", "default": 20, "maximum": 100, "minimum": 1, "description": "Maximum results on this page, such as 20." }, "time_window": { "enum": [ "past_day", "past_week", "past_month", "past_year", "all_time" ], "type": "string", "default": "all_time", "description": "How far back to search, such as past_week." } }}Output schema
{ "type": "object", "required": [ "results" ], "properties": { "results": { "type": "array", "items": { "type": "object", "required": [ "title", "comment_text", "author", "points", "comment_count", "posted_at", "website_url", "hacker_news_url", "item_id" ], "properties": { "title": { "type": [ "string", "null" ], "description": "Story title." }, "author": { "type": [ "string", "null" ], "description": "Hacker News author." }, "points": { "type": [ "integer", "null" ], "description": "Story points, when available." }, "item_id": { "type": "string", "description": "Hacker News item ID." }, "posted_at": { "type": [ "string", "null" ], "description": "Posted date and time in UTC, ISO 8601." }, "website_url": { "type": [ "string", "null" ], "description": "Story website link, or null for a text-only story." }, "comment_text": { "type": [ "string", "null" ], "description": "Comment in plain text; null for stories." }, "comment_count": { "type": [ "integer", "null" ], "description": "Number of story comments; null for comments." }, "hacker_news_url": { "type": "string", "description": "Link to the item on Hacker News." } }, "additionalProperties": false }, "description": "Stories or comments matching the search." } }}- Price
- 1 credit per completed run (1¢ with pay as you go); failed runs are free.
- Method
news.ycombinator.com/search_stories- Returns
- title, comment text, author, points, comment count, posted date, website link, Hacker News link, item ID
Use it from your agent
Give your agent this line. It reads SKILL.md, gets a Fous API key and connects the Fous MCP server. Its run then takes the method news.ycombinator.com/search_stories with the inputs above.
Ask your agent
- Find Hacker News stories about rust borrow checker posted in the past week, sorted by newest
- Show me the top comments discussing remote work from the past month on Hacker News
- Search HN for stories mentioning sqlite performance, all time, relevance order, 50 results
- Look up recent comments on ycombinator.com about LLM fine-tuning from the past day, newest first
- Get page 2 of Hacker News stories matching kubernetes networking from the past year
See more
All Hacker News methodsGets a Hacker News story and its comments in the order shown on the site. The story can be given as a discussion link or as words from its title. Deleted and flagged comments are left out.
news.ycombinator.com/get_discussionLists current Hacker News stories in rank order from the top, newest, best, Ask HN, Show HN or jobs list.
news.ycombinator.com/list_front_pageSearches the Y Combinator company directory by keyword, industry, batch, location, hiring and status, returning companies in directory order.
ycombinator.com/search_companiesLists top-level job posts from a monthly Ask HN: Who is hiring? thread in thread order, with post text and the company, roles, location, work arrangement, salary and application contact inferred from each post.
news.ycombinator.com/list_hiring_postsLooks up a Y Combinator company by name or YC company page link and returns its profile, founders, social links and open job count.
ycombinator.com/get_companyFinds public Reddit posts by topic, optionally in one community, for a time window and sort order. Returns up to 100 posts in Reddit search order with score, comment count, text and link.
reddit.com/search_postsSearches Yahoo News articles by keyword, newest first or by relevance, with optional publication dates and pages; returns only articles hosted on Yahoo News, with authors, original publisher and section.
yahoo.com/search_newsSearches TechCrunch articles by keyword, with an optional publication date range and newest or most relevant order.
techcrunch.com/search_news