Hacker News Search
Search and monitor Hacker News stories, comments, and users via the Algolia HN Search API. No API key required.
When to Use
User asks about Hacker News discussions on a topic
User wants to find HN posts about a company, product, or technology
User wants to monitor HN for mentions of something
User asks "what's trending on HN" or "what did HN think about X"
User wants to find Show HN / Ask HN / Launch HN posts
API Overview
Base URL:
https://hn.algolia.com/api/v1
Two search endpoints:
/search
— Relevance-sorted (best for finding specific topics)
/search_by_date
— Date-sorted (best for monitoring / recent activity)
Rate Limits:
10,000 requests/hour (generous, no auth needed)
How to Search
Step 1: Build the URL
https://hn.algolia.com/api/v1/search?query=QUERY&tags=TAG&hitsPerPage=N&numericFilters=FILTERS
Step 2: Fetch with
web_fetch
Use
web_fetch
to call the API. Response is JSON.
Parameters
Parameter
Description
Example
query
Search terms (URL-encoded)
query=openai+gpt
tags
Filter by type (see below)
tags=story
hitsPerPage
Results per page (max 1000)
hitsPerPage=20
page
Page number (0-indexed)
page=0
numericFilters
Numeric filters (see below)
numericFilters=points>100
Tag Filters
Use
tags
to filter by content type:
Tag
Description
story
Stories only
comment
Comments only
show_hn
Show HN posts
ask_hn
Ask HN posts
front_page
Currently on front page
author_USERNAME
Posts by a specific user
story_ID
Comments on a specific story
Combine tags
with commas (AND) or parentheses with commas (OR):
tags=story,show_hn
→ Show HN stories (AND)
tags=(story,comment)
→ Stories OR comments
Numeric Filters
Filter
Description
points>N
Minimum points/upvotes
num_comments>N
Minimum comments
created_at_i>TIMESTAMP
After Unix timestamp
created_at_i
HN Results for "query" (N total)
- Story Title (150 pts, 42 comments) By username · Jan 15, 2024 🔗 https://example.com/article 💬 https://news.ycombinator.com/item?id=12345
- ... For comments:
HN Comments on "Story Title"
- username (12 pts) · Jan 15, 2024
First ~200 chars of the comment text... 💬 https://news.ycombinator.com/item?id=12345 Error Handling Empty results: Tell the user no results were found. Suggest broadening the query or removing filters. API error / timeout: Retry once. If still failing, inform the user the HN search API may be temporarily down. Rate limited (429): Unlikely at 10k/hr, but if hit, wait 60 seconds and retry. Malformed response: Check the URL construction — common issues are unencoded special characters in the query. Examples Example 1: "What's HN saying about Rust?" Fetch: https://hn.algolia.com/api/v1/search?query=rust+programming&tags=story&hitsPerPage=5&numericFilters=points>50 Example 2: "Find Show HN posts about AI agents from the last month"
Calculate timestamp for 30 days ago, then:
Fetch: https://hn.algolia.com/api/v1/search_by_date?query=ai+agents&tags=show_hn&numericFilters=created_at_i>TIMESTAMP&hitsPerPage=10 Example 3: "What has pg posted recently?" Fetch: https://hn.algolia.com/api/v1/search_by_date?tags=author_pg&hitsPerPage=10 Data Source Algolia HN Search API — Free, no authentication required. Indexes all public Hacker News content in near real-time.