Hacker News Item API
The Hacker News Item API returns one item from
Hacker News
as structured JSON: a story, comment, job, poll or poll option, with its author, time, points,
comment count, title, link and text, the item it replies to, and the IDs of its direct replies
in the order Hacker News ranks them. Look an item up by its ID or by the link to its page.
Ask HN and Show HN items both have type: story.
Every ID in the answer can be passed back as item_id, so a thread can be read one item at a time.
API Parameters
Item
-
- Name
-
item_id - Required
- Optional
- Description
-
The ID of the Hacker News item, the number after
id=in its link, for example8863. Every ID inchild_ids,parent_id,poll_idandoption_idsworks here too.
Required ifurlis not provided.
-
- Name
-
url - Required
- Optional
- Description
-
The link to the item's page on Hacker News, for example
https://news.ycombinator.com/item?id=8863. The link must hold exactly one item ID. Anything after#and any other query parameter are left out.
Required ifitem_idis not provided.
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_item.
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
Story
comments counts every comment in the thread, replies to replies included.
child_ids lists only the story's direct replies, in the order Hacker News ranks them.
text is plain text, with a blank line between paragraphs and each link written out in full.
https://www.searchapi.io/api/v1/search?engine=hacker_news_item&item_id=8863
- 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_item",
"item_id": "8863"
}
response = requests.get(url, params=params)
print(response.text)
{
"search_metadata": {
"id": "search_J2haEbbp3iHhPHrxpQ7M8gGe",
"status": "Success",
"created_at": "2026-11-26T11:53:49Z",
"request_time_taken": 1.23,
"parsing_time_taken": 0.01,
"total_time_taken": 1.24,
"request_url": "https://news.ycombinator.com/item?id=8863",
"html_url": "https://www.searchapi.io/api/v1/searches/search_J2haEbbp3iHhPHrxpQ7M8gGe.html",
"json_url": "https://www.searchapi.io/api/v1/searches/search_J2haEbbp3iHhPHrxpQ7M8gGe"
},
"search_parameters": {
"engine": "hacker_news_item",
"item_id": "8863"
},
"item": {
"item_id": "8863",
"type": "story",
"title": "My YC app: Dropbox - Throw away your USB drive",
"link": "http://www.getdropbox.com/u/2/screencast.html",
"discussion_link": "https://news.ycombinator.com/item?id=8863",
"author": "dhouston",
"points": 104,
"comments": 71,
"child_ids": [
"9224",
"8917",
"8884",
"..."
],
"created_at": "2007-04-04T19:16:40Z"
}
}
Comment by Link
parent_id is the story or comment this comment replies to.
Hacker News doesn't publish points for comments, so a comment has no points.
https://www.searchapi.io/api/v1/search?engine=hacker_news_item&url=https%3A%2F%2Fnews.ycombinator.com%2Fitem%3Fid%3D2921983
- 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_item",
"url": "https://news.ycombinator.com/item?id=2921983"
}
response = requests.get(url, params=params)
print(response.text)
{
"search_metadata": {
"id": "search_t2RwMKmlAh9HRY94y60iZwMH",
"status": "Success",
"created_at": "2026-11-26T11:53:51Z",
"request_time_taken": 1.43,
"parsing_time_taken": 0.01,
"total_time_taken": 1.44,
"request_url": "https://news.ycombinator.com/item?id=2921983",
"html_url": "https://www.searchapi.io/api/v1/searches/search_t2RwMKmlAh9HRY94y60iZwMH.html",
"json_url": "https://www.searchapi.io/api/v1/searches/search_t2RwMKmlAh9HRY94y60iZwMH"
},
"search_parameters": {
"engine": "hacker_news_item",
"url": "https://news.ycombinator.com/item?id=2921983"
},
"item": {
"item_id": "2921983",
"type": "comment",
"discussion_link": "https://news.ycombinator.com/item?id=2921983",
"author": "norvig",
"text": "Aw shucks, guys ... you make me blush with your compliments.\n\nTell you what, Ill make a deal: I'll keep writing if you keep reading. K?",
"parent_id": "2921506",
"child_ids": [
"2922097",
"2922429",
"2924562",
"..."
],
"created_at": "2011-08-24T18:38:47Z"
}
}
Job
A job can have a link, text or both. Job items omit points and have no comments.
https://www.searchapi.io/api/v1/search?engine=hacker_news_item&item_id=50641323
- 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_item",
"item_id": "50641323"
}
response = requests.get(url, params=params)
print(response.text)
{
"search_metadata": {
"id": "search_MNUgyIg7YqunrjJwTp6lfuYZ",
"status": "Success",
"created_at": "2026-11-26T11:53:53Z",
"request_time_taken": 0.98,
"parsing_time_taken": 0.0,
"total_time_taken": 0.98,
"request_url": "https://news.ycombinator.com/item?id=50641323",
"html_url": "https://www.searchapi.io/api/v1/searches/search_MNUgyIg7YqunrjJwTp6lfuYZ.html",
"json_url": "https://www.searchapi.io/api/v1/searches/search_MNUgyIg7YqunrjJwTp6lfuYZ"
},
"search_parameters": {
"engine": "hacker_news_item",
"item_id": "50641323"
},
"item": {
"item_id": "50641323",
"type": "job",
"title": "Hazel (YC W24) Is Hiring a Product Designer",
"link": "https://www.ycombinator.com/companies/hazel-2/jobs/8EhsvYE-product-designer-contract",
"discussion_link": "https://news.ycombinator.com/item?id=50641323",
"author": "augustschen",
"created_at": "2026-11-25T12:00:34Z"
}
}
Poll
option_ids lists the poll's options in the order the poll lists them, while its page sorts them by votes.
Pass an option's ID as item_id to read its votes.
https://www.searchapi.io/api/v1/search?engine=hacker_news_item&item_id=3746692
- 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_item",
"item_id": "3746692"
}
response = requests.get(url, params=params)
print(response.text)
{
"search_metadata": {
"id": "search_BUGQXWy4WWBB6BKyceQIIaO5",
"status": "Success",
"created_at": "2026-11-26T11:53:54Z",
"request_time_taken": 0.73,
"parsing_time_taken": 0.0,
"total_time_taken": 0.73,
"request_url": "https://news.ycombinator.com/item?id=3746692",
"html_url": "https://www.searchapi.io/api/v1/searches/search_BUGQXWy4WWBB6BKyceQIIaO5.html",
"json_url": "https://www.searchapi.io/api/v1/searches/search_BUGQXWy4WWBB6BKyceQIIaO5"
},
"search_parameters": {
"engine": "hacker_news_item",
"item_id": "3746692"
},
"item": {
"item_id": "3746692",
"type": "poll",
"title": "Poll: What's Your Favorite Programming Language?",
"discussion_link": "https://news.ycombinator.com/item?id=3746692",
"author": "GreekOphion",
"points": 2423,
"comments": 570,
"text": "What's your favortie programming langauge?\n\nBelow are the most popular languages. If your favorite isn't below select other and comment what it is below.\n\nNote: By voting for a language you are not up voting this poll. Please up vote this poll to keep it alive.",
"option_ids": [
"3746693",
"3746694",
"3746695",
"..."
],
"child_ids": [
"3746863",
"3746877",
"3747817",
"..."
],
"created_at": "2012-03-23T19:19:37Z"
}
}
Poll Option
A poll option's points are its votes, text is the option, and poll_id is its poll.
https://www.searchapi.io/api/v1/search?engine=hacker_news_item&item_id=3746693
- 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_item",
"item_id": "3746693"
}
response = requests.get(url, params=params)
print(response.text)
{
"search_metadata": {
"id": "search_yyYFIfxa8FvBTKugzKBkmu0S",
"status": "Success",
"created_at": "2026-11-26T11:53:55Z",
"request_time_taken": 1.11,
"parsing_time_taken": 0.0,
"total_time_taken": 1.11,
"request_url": "https://news.ycombinator.com/item?id=3746693",
"html_url": "https://www.searchapi.io/api/v1/searches/search_yyYFIfxa8FvBTKugzKBkmu0S.html",
"json_url": "https://www.searchapi.io/api/v1/searches/search_yyYFIfxa8FvBTKugzKBkmu0S"
},
"search_parameters": {
"engine": "hacker_news_item",
"item_id": "3746693"
},
"item": {
"item_id": "3746693",
"type": "pollopt",
"discussion_link": "https://news.ycombinator.com/item?id=3746693",
"author": "GreekOphion",
"points": 106,
"text": "Actionscript",
"poll_id": "3746692",
"created_at": "2012-03-23T19:19:37Z"
}
}
Dead Item
is_dead marks an item Hacker News killed, which it hides from most readers.
A dead comment keeps its author, and Hacker News shows [dead] or [flagged] in place of its text.
A dead story can come without a title or link. A flagged comment that is still live also reads [flagged].
https://www.searchapi.io/api/v1/search?engine=hacker_news_item&item_id=50580946
- 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_item",
"item_id": "50580946"
}
response = requests.get(url, params=params)
print(response.text)
{
"search_metadata": {
"id": "search_1zQb4I0Fi7DxdyFdJgC1NFvb",
"status": "Success",
"created_at": "2026-11-26T11:53:56Z",
"request_time_taken": 0.72,
"parsing_time_taken": 0.0,
"total_time_taken": 0.72,
"request_url": "https://news.ycombinator.com/item?id=50580946",
"html_url": "https://www.searchapi.io/api/v1/searches/search_1zQb4I0Fi7DxdyFdJgC1NFvb.html",
"json_url": "https://www.searchapi.io/api/v1/searches/search_1zQb4I0Fi7DxdyFdJgC1NFvb"
},
"search_parameters": {
"engine": "hacker_news_item",
"item_id": "50580946"
},
"item": {
"item_id": "50580946",
"type": "comment",
"discussion_link": "https://news.ycombinator.com/item?id=50580946",
"author": "testtestmetest",
"text": "[dead]",
"parent_id": "50580657",
"child_ids": [
"50581244",
"50582615",
"50581867",
"50581146",
"50581687"
],
"created_at": "2026-11-20T19:54:47Z",
"is_dead": true
}
}
Deleted Item
is_deleted marks a deleted item. It keeps its time and its place in the thread, without an author or text.
https://www.searchapi.io/api/v1/search?engine=hacker_news_item&item_id=50583243
- 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_item",
"item_id": "50583243"
}
response = requests.get(url, params=params)
print(response.text)
{
"search_metadata": {
"id": "search_3vNxI1auK1VhPu3q3SmSTdzn",
"status": "Success",
"created_at": "2026-11-26T11:53:57Z",
"request_time_taken": 0.66,
"parsing_time_taken": 0.0,
"total_time_taken": 0.66,
"request_url": "https://news.ycombinator.com/item?id=50583243",
"html_url": "https://www.searchapi.io/api/v1/searches/search_3vNxI1auK1VhPu3q3SmSTdzn.html",
"json_url": "https://www.searchapi.io/api/v1/searches/search_3vNxI1auK1VhPu3q3SmSTdzn"
},
"search_parameters": {
"engine": "hacker_news_item",
"item_id": "50583243"
},
"item": {
"item_id": "50583243",
"type": "comment",
"discussion_link": "https://news.ycombinator.com/item?id=50583243",
"parent_id": "50579568",
"created_at": "2026-11-20T22:27:50Z",
"is_deleted": true
}
}
Item Not Found
An ID Hacker News doesn't have returns an error and no item.
https://www.searchapi.io/api/v1/search?engine=hacker_news_item&item_id=999999999999
- 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_item",
"item_id": "999999999999"
}
response = requests.get(url, params=params)
print(response.text)
{
"search_metadata": {
"id": "search_JhImFfIJKeWQWAN1Kb1nLE9Y",
"status": "Success",
"created_at": "2026-11-26T11:53:58Z",
"request_time_taken": 0.61,
"parsing_time_taken": 0.0,
"total_time_taken": 0.61,
"request_url": "https://news.ycombinator.com/item?id=999999999999",
"html_url": "https://www.searchapi.io/api/v1/searches/search_JhImFfIJKeWQWAN1Kb1nLE9Y.html",
"json_url": "https://www.searchapi.io/api/v1/searches/search_JhImFfIJKeWQWAN1Kb1nLE9Y"
},
"search_parameters": {
"engine": "hacker_news_item",
"item_id": "999999999999"
},
"error": "Hacker News item `999999999999` doesn't exist."
}