Hacker News Story Comments API
Walk a story's comment tree with cursor pages — parent/child links, text, and traversal progress in one envelope.
GET /v1/hackernews/stories/{id}/comments3 credits per successful request.
About this endpoint
Sentiment jobs and launch post-mortems need the discussion, not just the story card. Pulling every comment id and hydrating them one-by-one is slow; dumping a giant nested tree in one shot blows payloads and timeouts on busy threads.
`GET /v1/hackernews/stories/{id}/comments` pages the comment tree for a story id. Pass optional `limit` (1–100, default 50) and opaque `cursor` from a previous response. On `found`, the payload includes a story summary, `rootCommentIds`, a flat `comments` list with parentId and childIds, and `traversal` (complete, nextCursor, returnedNodes, discoveredNodes, snapshotAt). Branch on `data.lookupStatus` — `not_found` and `not_story` return empty comments.
Credit pricing for this operation comes from the API registry and appears on this page; each successful page is a separate billed request. Trust `meta.creditsCharged`. For a single comment plus ancestors, use the comment context route instead.
Hacker News Story Comments API FAQ
How do I list comments on a Hacker News story?
Call GET /v1/hackernews/stories/{id}/comments with your Social Fetch API key in the x-api-key header. Pass the story id in the path. Optionally set limit and cursor. Read data.lookupStatus, then data.comments and data.traversal.
How many credits does listing story comments cost?
Pricing is documented on the operation in the API registry (shown on this page). Confirm on every response with meta.creditsCharged — that field is the billing source of truth.
How does cursor pagination work on story comments?
When data.traversal.complete is false and nextCursor is set, pass that opaque cursor as the cursor query param on the next request. Keep the same story id and limit. Omit cursor for the first page. Do not invent or parse the cursor.
What does lookupStatus mean on story comments?
found means the id is a story and comments may be returned. not_found means the id does not exist. not_story means the id is not a story. HTTP 200 still means the request finished; always branch before writing rows.
Are comments nested or flat?
Comments are returned as a flat list. Reconstruct the tree with parentId, childIds, and rootCommentIds. Each node can include author, createdAt, text, dead, deleted, and itemUrl.
Story comments vs comment context?
Use this route to page an entire story's discussion. Use GET /v1/hackernews/comments/{id}/context when you start from a comment id and need that comment plus its ancestor chain to the root story.
Can I use this for sentiment or thread analysis?
Yes. Teams page large threads overnight, store comment text keyed by id, and join back to the story card from GET /v1/hackernews/stories/{id}. Persist meta.requestId per page for support.
Other Hacker News endpoints
- SearchGET /v1/hackernews/search
- FeedGET /v1/hackernews/feeds/{feed}
- StoryGET /v1/hackernews/stories/{id}
- ItemGET /v1/hackernews/items/{id}
- Comment contextGET /v1/hackernews/comments/{id}/context
- UserGET /v1/hackernews/users/{username}
- User submissionsGET /v1/hackernews/users/{username}/submissions
- User commentsGET /v1/hackernews/users/{username}/comments