100 free credits. No credit card required. Get a key

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 failure
import 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

NameTypeDescription
idpath · requiredstringAn 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.

FieldTypeDescription
idinteger
type"story" | "comment" | "job" | "poll" | "pollopt"
bystringAuthor username.
timeintegerUnix seconds.
titlestring
urlstring
textstringHTML.
scoreinteger
descendantsintegerTotal comment count.
kidsinteger[]Direct reply ids, ranked.
parentinteger
pollinteger
partsinteger[]
deletedboolean
deadboolean
Status codes
StatusMeaning
200The item.
400Invalid input. Nothing was charged.
401Missing or invalid API key.
402Not enough credits, a spend cap was reached, or payment is required.
403The target is private, or the account is suspended.
404The item or user does not exist.
429Too many requests. Wait for Retry-After seconds.
503Hacker 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.