Hacker News Search API Documentation
The Hacker News Search API returns the stories, comments, Ask HN and Show HN posts, polls or jobs Hacker News matches for a search, each with its item id, date and discussion link. Stories come with their title, author, points, comment count and link when they have one, and comments come with their author, text and the story they belong to.
API Parameters
Search Query
-
- Name
-
q - Required
- Required
- Description
-
Parameter defines the text you want to search for, up to 512 bytes in UTF-8, which is 512 ASCII characters.
-
- Name
-
type - Required
- Optional
- Description
-
Parameter defines the kind of item to return. Supported values are
story,comment,ask_hn,show_hn,poll, andjob.storyalso returns Ask HN and Show HN posts.
Filters
-
- Name
-
sort_by - Required
- Optional
- Description
-
Parameter defines the order of the results.
relevanceranks by match and points, anddateputs the newest items first.
-
- Name
-
created_after - Required
- Optional
- Description
-
Parameter defines a Unix timestamp in seconds. Only items created after it are returned.
-
- Name
-
created_before - Required
- Optional
- Description
-
Parameter defines a Unix timestamp in seconds. Only items created before it are returned. It must be later than
created_after.
-
- Name
-
min_points - Required
- Optional
- Description
-
Parameter defines the minimum points an item needs. Comments and jobs have no points, so it is not supported with
commentandjob.
-
- Name
-
min_comments - Required
- Optional
- Description
-
Parameter defines the minimum number of comments an item needs. It is not supported with
commentandjob.
Pagination
-
- Name
-
page - Required
- Optional
- Description
-
Parameter defines the page of results. Hacker News returns at most 1000 results per search, so the last page is the one that reaches result 1000, such as page 50 with
num20.
-
- Name
-
num - Required
- Optional
- Description
-
Parameter defines the number of results per page, from 1 to 100.
Engine
-
- Name
-
engine - Required
- Required
- Description
-
Parameter defines an engine that will be used to retrieve real-time data. It must be set to
hacker_news_search.
API key
-
- Name
-
api_key - Required
- Required
- Description
-
The
api_keyauthenticates your requests. Use it as a query parameter (https://www.searchapi.io/api/v1/search?api_key=YOUR_API_KEY) or in the Authorization header (Bearer YOUR_API_KEY).
Zero Data Retention
-
- Name
-
zero_retention - Enterprise Only
- Enterprise Only
- Required
- Optional
- Description
-
Set this parameter to
trueto disable all logging and persistent storage. No request parameters, HTML, or JSON responses are stored or logged. Suitable for high-compliance use cases. Debugging and support may be limited while enabled.
API Examples
Full Response
https://www.searchapi.io/api/v1/search?engine=hacker_news_search&q=sqlite
- Python
- Node
- Ruby
- Java
- Go
- PHP
- Bash
- R
- Kotlin
- Swift
- C#
- C
- C++
- requests
import requests
url = "https://www.searchapi.io/api/v1/search"
params = {
"engine": "hacker_news_search",
"q": "sqlite"
}
response = requests.get(url, params=params)
print(response.text)
{
"search_metadata": {
"id": "search_Xq7HnPz2kLw9RtVb4mYc8sJd",
"status": "Success",
"created_at": "2026-11-26T08:17:21Z",
"request_time_taken": 1.81,
"parsing_time_taken": 0.03,
"total_time_taken": 1.84,
"request_url": "https://hn.algolia.com/?page=0&q=sqlite&sort=byPopularity&type=story",
"html_url": "https://www.searchapi.io/api/v1/searches/search_Xq7HnPz2kLw9RtVb4mYc8sJd.html",
"json_url": "https://www.searchapi.io/api/v1/searches/search_Xq7HnPz2kLw9RtVb4mYc8sJd"
},
"search_parameters": {
"engine": "hacker_news_search",
"q": "sqlite",
"type": "story",
"sort_by": "relevance",
"page": 1,
"num": 20
},
"search_information": {
"total_results": 4391,
"is_total_results_exact": true
},
"organic_results": [
{
"position": 1,
"item_id": "27016630",
"type": "story",
"title": "Hosting SQLite databases on GitHub Pages or any static file hoster",
"link": "https://phiresky.github.io/blog/2021/hosting-sqlite-databases-on-github-pages/",
"discussion_link": "https://news.ycombinator.com/item?id=27016630",
"author": "phiresky",
"points": 1812,
"comments": 244,
"created_at": "2021-05-02T16:43:15Z"
},
{
"position": 2,
"item_id": "31318708",
"type": "story",
"title": "I'm all-in on server-side SQLite",
"link": "https://fly.io/blog/all-in-on-sqlite-litestream/",
"discussion_link": "https://news.ycombinator.com/item?id=31318708",
"author": "dpeck",
"points": 1353,
"comments": 404,
"created_at": "2022-05-09T19:35:41Z"
},
"..."
],
"pagination": {
"current": 1,
"next_page": 2
}
}
Newest Comments
https://www.searchapi.io/api/v1/search?engine=hacker_news_search&q=rust&sort_by=date&type=comment
- Python
- Node
- Ruby
- Java
- Go
- PHP
- Bash
- R
- Kotlin
- Swift
- C#
- C
- C++
- requests
import requests
url = "https://www.searchapi.io/api/v1/search"
params = {
"engine": "hacker_news_search",
"q": "rust",
"type": "comment",
"sort_by": "date"
}
response = requests.get(url, params=params)
print(response.text)
{
"organic_results": [
{
"position": 1,
"item_id": "50652790",
"type": "comment",
"discussion_link": "https://news.ycombinator.com/item?id=50652790",
"author": "pelasaco",
"text": "probably there will be a vibe-coded version with examples in rust..",
"parent_id": "50652627",
"story_id": "50651719",
"story_title": "Lions' Commentary on Unix: Why It Was Secretly Copied for 20 Years",
"story_link": "https://fosscomics.com/posts/17.%20Lions%27%20Commentary%20on%20Unix/",
"created_at": "2026-11-26T08:07:18Z"
},
{
"position": 2,
"item_id": "50652745",
"type": "comment",
"discussion_link": "https://news.ycombinator.com/item?id=50652745",
"author": "FranGro78",
"text": "> Given enough eyeballs, all bugs are shallow\nObviously not written with AI in mind, but certainly seems to be true with the many AI eyes on open source at t...",
"parent_id": "50647161",
"story_id": "50647161",
"story_title": "Nfs2root: A 12-year-old pre-auth remote root in the Linux kernel's NFS server",
"story_link": "https://opensec.in/blog/nfs2root-cve-2026-99362",
"created_at": "2026-11-26T08:02:31Z"
},
"..."
]
}
Ask HN
https://www.searchapi.io/api/v1/search?engine=hacker_news_search&q=sqlite&type=ask_hn
- Python
- Node
- Ruby
- Java
- Go
- PHP
- Bash
- R
- Kotlin
- Swift
- C#
- C
- C++
- requests
import requests
url = "https://www.searchapi.io/api/v1/search"
params = {
"engine": "hacker_news_search",
"q": "sqlite",
"type": "ask_hn"
}
response = requests.get(url, params=params)
print(response.text)
{
"organic_results": [
{
"position": 1,
"item_id": "31152490",
"type": "ask_hn",
"title": "Ask HN: Have you used SQLite as a primary database?",
"discussion_link": "https://news.ycombinator.com/item?id=31152490",
"author": "barryhennessy",
"points": 518,
"comments": 325,
"text": "I periodically hear about projects that use/have used sqlite as their sole datastore. The theory seems to be is that you can test out an idea with fewer depe...",
"created_at": "2022-04-25T10:06:05Z"
},
"..."
]
}
Stories by an Author
https://www.searchapi.io/api/v1/search?author=pg&engine=hacker_news_search&q=startup
- Python
- Node
- Ruby
- Java
- Go
- PHP
- Bash
- R
- Kotlin
- Swift
- C#
- C
- C++
- requests
import requests
url = "https://www.searchapi.io/api/v1/search"
params = {
"engine": "hacker_news_search",
"q": "startup",
"author": "pg"
}
response = requests.get(url, params=params)
print(response.text)
{
"organic_results": [
{
"position": 1,
"item_id": "250704",
"type": "story",
"title": "Startup Ideas We'd Like to Fund",
"link": "http://ycombinator.com/ideas.html",
"discussion_link": "https://news.ycombinator.com/item?id=250704",
"author": "pg",
"points": 532,
"comments": 381,
"created_at": "2008-07-19T16:33:35Z"
},
{
"position": 2,
"item_id": "2873865",
"type": "story",
"title": "2011 Startup School",
"link": "http://startupschool.org/",
"discussion_link": "https://news.ycombinator.com/item?id=2873865",
"author": "pg",
"points": 282,
"comments": 82,
"created_at": "2011-08-11T17:34:09Z"
},
"..."
]
}
Popular Stories Since 2020
https://www.searchapi.io/api/v1/search?created_after=1577836800&engine=hacker_news_search&min_comments=500&min_points=1000&q=startup
- Python
- Node
- Ruby
- Java
- Go
- PHP
- Bash
- R
- Kotlin
- Swift
- C#
- C
- C++
- requests
import requests
url = "https://www.searchapi.io/api/v1/search"
params = {
"engine": "hacker_news_search",
"q": "startup",
"min_points": "1000",
"min_comments": "500",
"created_after": "1577836800"
}
response = requests.get(url, params=params)
print(response.text)
{
"organic_results": [
{
"position": 1,
"item_id": "47865868",
"type": "story",
"title": "Alberta startup sells no-tech tractors for half price",
"link": "https://wheelfront.com/this-alberta-startup-sells-no-tech-tractors-for-half-price/",
"discussion_link": "https://news.ycombinator.com/item?id=47865868",
"author": "Kaibeezy",
"points": 2320,
"comments": 779,
"created_at": "2026-04-22T16:29:25Z"
},
{
"position": 2,
"item_id": "25802366",
"type": "story",
"title": "Google Safe Browsing can kill a startup",
"link": "https://gomox.medium.com/google-safe-browsing-can-kill-your-startup-7d73c474b98d",
"discussion_link": "https://news.ycombinator.com/item?id=25802366",
"author": "gomox",
"points": 1714,
"comments": 543,
"created_at": "2021-01-16T14:32:10Z"
},
"..."
]
}