Hacker News item API
One Hacker News item by id or link: a story, comment, job or poll with its score, comment count and direct replies.
GET /v1/hackernews/items/{id}1 credit per callRefunded on failureimport os, requests
res = requests.get(
"https://api.groundsocial.dev/v1/hackernews/items/8863",
headers={"Authorization": f"Bearer {os.environ['GROUNDSOCIAL_API_KEY']}"},
)
res.raise_for_status()
data = res.json()Response
200 · 1 credit{ "id": 8863, "type": "story", "by": "dhouston", "time": 1175714200, "title": "My YC app: Dropbox - Throw away your USB drive", "url": "http://www.getdropbox.com/u/2/screencast.html", "score": 104, "descendants": 71, "kids": [ 9224, 8917, "… 31 more" ]}Parameters
| Name | Type | Description |
|---|---|---|
idpath · required | string | An item id or its link (news.ycombinator.com/item?id=…). Example: 8863. |
Response fields
200 with a HackerNewsItem, in Hacker News’s own items and search hits.
| Field | Type | Description |
|---|---|---|
id | integer | |
type | "story" | "comment" | "job" | "poll" | "pollopt" | |
by | string | Author username. |
time | integer | Unix seconds. |
title | string | |
url | string | |
text | string | HTML. |
score | integer | |
descendants | integer | Total comment count. |
kids | integer[] | Direct reply ids, ranked. |
parent | integer | |
poll | integer | |
parts | integer[] | |
deleted | boolean | |
dead | boolean |
Status codes
| Status | Meaning |
|---|---|
200 | The item. |
400 | Invalid input. Nothing was charged. |
401 | Missing or invalid API key. |
402 | Not enough credits, a spend cap was reached, or payment is required. |
403 | The target is private, or the account is suspended. |
404 | The item or user does not exist. |
429 | Too many requests. Wait for Retry-After seconds. |
503 | Hacker News is temporarily unavailable. Retryable; nothing was charged. |
Every error has code, message, hint and retryable. All error codes
Questions
Does it take a link?
Yes: pass news.ycombinator.com/item?id=… as the id.
Hacker News is a trademark of Y Combinator. We are not affiliated with or endorsed by Y Combinator.