Hacker News comments API
Every comment in a Hacker News thread in one call, flattened in reading order with depth and parent, so you never walk the tree item by item.
GET /v1/hackernews/items/{id}/comments1 credit per callRefunded on failureimport os, requests
res = requests.get(
"https://api.groundsocial.dev/v1/hackernews/items/8863/comments",
headers={"Authorization": f"Bearer {os.environ['GROUNDSOCIAL_API_KEY']}"},
)
res.raise_for_status()
data = res.json()Response
200 · 1 credit{ "story": { "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" ] }, "comments": [ { "id": 8865, "author": "dhouston", "text": "oh, and a mac port is coming :)", "created_at": "2007-04-04T19:22:55.000Z", "created_at_i": 1175714575, "parent_id": 8863, "story_id": 8863, "depth": 0, "reply_count": 1 }, { "id": 9007, "author": "vlad", "text": "Drew, this is awesome! All of the features you mentioned are exactly what people need.", "created_at": "2007-04-05T01:48:11.000Z", "created_at_i": 1175737691, "parent_id": 8865, "story_id": 8863, "depth": 1, "reply_count": 0 }, "… 69 more" ], "comment_count": 71}Parameters
| Name | Type | Description |
|---|---|---|
idpath · required | string | An item id or its link (news.ycombinator.com/item?id=…). Example: 8863. |
sincequery | string | Only rows published on or after this date: YYYY-MM-DD (midnight UTC) or an ISO 8601 timestamp. Example: 2026-01-01. |
untilquery | string | Only rows published on or before this date: YYYY-MM-DD (that whole UTC day) or an ISO 8601 timestamp. Example: 2026-12-31. |
Response fields
200 with a HackerNewsThread, in Hacker News’s own items and search hits.
| Field | Type | Description |
|---|---|---|
story | HackerNewsItem | |
comments | HackerNewsComment[] | |
comment_count | integer | Comments returned (after since/until). |
Status codes
| Status | Meaning |
|---|---|
200 | The story and its comments. |
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
Is it paged?
No: one call returns the whole thread.
Hacker News is a trademark of Y Combinator. We are not affiliated with or endorsed by Y Combinator.