Introducing the Instagram APIRead more →

Hacker News Comments API. Comments and replies, page by page.

Comments and replies on a story, in thread order. We handle the proxies, blocks and platform changes.

In your agent: Hacker News MCP server →

Hacker News Comments API at a glance

Returns the comments on a public Hacker News story, replies included, from its link or item ID. You get them in the thread's own order, newest first or oldest first, each with its text as plain text, author, posting time, reply count, and parent_id and depth to rebuild the thread. Flagged or deleted comments stay in place, marked, while replies hang under them.

GET /v1/hackernews/comments

Read the API reference
  • 1 credit per page, $0.75–$1.97 per 1,000 pages
  • 16 typed fields null when unknown
  • 1,000 comments and replies per page, Hacker News' own ranking of the comments on the story, each followed by its replies, oldest first, depth first
  • url is all it needs, e.g. https://news.ycombinator.com/item?id=8863

Send one request. Get up to 1,000 comments and replies back.

Copy the request in your language, or hand it to your agent. Sign up for an API key and your first 100 credits are free.

$ npm install socialtap
url = https://news.ycombinator.com/item?id=8863
GET /v1/hackernews/commentsTry in
const params = new URLSearchParams({
  sort: "relevance",
  url: "https://news.ycombinator.com/item?id=8863",
});
const res = await fetch(`https://socialtap.dev/v1/hackernews/comments?${params}`, {
  headers: { "x-api-key": process.env.SOCIALTAP_API_KEY ?? "" },
});
const body = await res.json();
if (!res.ok) throw new Error(`${body.error.code}: ${body.error.message}`);
const { data, page, meta } = body;
console.log(data, meta.credits_charged);
200 OK · GET https://socialtap.dev/v1/hackernews/commentsLong arrays and strings are shortened here. Real responses are complete.Docs

One schema on 13 platforms.

The response reference lists every field, its type and when it is null. See the full schema.

  • Null means unknown

    A field Hacker News doesn't show is null, never zero or an empty string, so a real zero always means zero.

  • What it accepts

    The story: its link on Hacker News (news.ycombinator.com/item?id=8863, any other query parameters or #fragment kept out) or its item ID alone (8863).

  • Write one parser

    Hacker News, TikTok, Instagram and 10 more platforms answer in these fields, so the code that reads one reads them all.

platformstring
Platform ID (tiktok, youtube, …).
idstring
Platform-native comment ID (string; Reddit with its t1_ prefix).
post_idstring
ID of the post commented on (equals post.id).
parent_idstring
ID of the comment this replies to; null for top-level comments.
urlstring
Permalink, when the platform has one.
textstring
Comment body as plain text.
authorobject
The commenting account. An account the platform no longer names (a deleted account) has a null id and username and the platform's label as display_name (Reddit: [deleted]).
published_atstring
When the comment was posted, RFC 3339 UTC. Where the platform shows only a relative time ("3 weeks ago"), the latest time that label allows (the fetch time minus the stated amount), listed in approximate_fields.

What teams build with the Hacker News Comments API.

  • Read the whole discussion under a story

  • Collect new comments on a story since a date

  • Rebuild a thread's tree from parent_id and depth

  • Archive Ask HN and Show HN answers as plain text

Good to know before you build.

  • Comments come in one flat list, replies included: parent_id names the comment each one answers (null for a comment on the story itself) and platform_specific.hackernews.depth how deep it sits.
  • In the default order, the comments on the story follow Hacker News' own ranking and the replies under each come oldest first. Hacker News ranks replies too, which this order doesn't follow.
  • Hacker News hides comments it flagged and ones their authors deleted. One with replies stays in the list with empty text, marked is_dead or is_deleted in platform_specific.hackernews. One without replies is left out, as on Hacker News.
  • When Hacker News Search fails, the default order is read from Hacker News' own API instead, in smaller pages, and reply_count then also counts the flagged and deleted replies Hacker News hides.
  • A comment's link or ID lists the replies under it, nested ones too. Their post_id is still the story's.
  • Comments are read from Hacker News Search, a copy of Hacker News that can run a minute or two behind, so the newest comments on a busy story may be missing.
  • Comment points are hidden on Hacker News, so like_count is null.

1 credit per page. Failed requests are free.

Buy credits once and spend them on any endpoint, on any platform.

SourcePrice per successful pagePer 1,000 pages
Platform API api1 credit$0.75–$1.97
  • Cache hits are free.
  • Credits from packs and top-ups never expire.
  • A monthly plan's credits are spent first, and what is left of them ends at each renewal.
  • Prices exclude tax: sales tax is added at checkout where it applies.
  • Outside the US, plans and packs are sold to businesses: checkout asks for your VAT, GST or other business tax ID.

Questions about the Hacker News Comments API.

More in the API reference.

Are replies to replies included?
Yes. Replies come in the same flat list, with parent_id naming the comment it answers and depth saying how deep it is.
Can I get only the comments posted since a date?
Yes. Send since with sort=newest. Paging stops at that date, so you don't pay for pages of older comments.
How much does the Hacker News Comments API cost?
A page of up to 1,000 comments and replies costs 1 credit. Every successful page is charged, empty pages included. SocialTap credits cost $0.75–$1.97 per 1,000, depending on the plan or pack.
How do I get the next page?
Repeat the same request with cursor set to page.next_cursor from the previous response, keeping the other parameters. When page.has_more is false there are no more pages. Cursors expire after 24 hours.

Try it on a link you already have.

Paste it in the playground, or copy the request into your code.

100free credits
  • No credit card
  • Failed requests are free
  • Works on all 276 endpoints
Start for free Read the docs