Every comment of a Hacker News story, flattened depth-first with parent ids, authors, timestamps and depth.
curl -X POST "https://api.primaryapi.com/v1/run/hackernews.story_comments" \
-H "Authorization: Bearer $PRIMARYAPI_API_KEY" \
-H "Content-Type: application/json" \
-d '{"id":"8863"}'{
"output": {
"found": true,
"data": {
"nextCursor": "<string | null>",
"comments": [
{
"depth": "<integer>",
"author": "<string | null>",
"text": "<string | null>",
"createdUtc": "<integer | null>", …
}
]
}
},
"credits": 1
}Input and output
3 fields
8863.8 fields
cursor for the next comments; null when the thread is completeGood to know
Order: depth-first, siblings oldest first (ascending id). Deleted comments are skipped but their replies kept. Dead comments are skipped with their replies, as on news.ycombinator.com.
Comment text is raw HN HTML.
One page per call. Send nextCursor back as cursor to read the next page.
Unknown ID? It comes back as not found, not as an error.
Terms of use. Comment authors are personal data under GDPR/CCPA (pseudonymous usernames): use for lawful purposes only and honour deletions. Deleted comments are never returned.
More from Hacker News. Same key, same credits.
The same key and credits work for every API.