Get a Hacker News comment with its thread · Hacker News API
Returns a Hacker News comment with its ancestor chain up to the root story. Returns `not_found` when the comment does not exist.
Using ChatGPT, Claude Code or another client? See the setup steps
curl https://api.unifapi.com/hacker-news/items/{id}/context \
-H "Authorization: Bearer $UNIFAPI_KEY"Parameters
- idpathrequired
- Hacker News comment id.
This operation is part of the Hacker News API in the news category. It uses the same Bearer token, request tracing, error model, and billing envelope as every UnifAPI endpoint, so agents can switch between platforms without custom per-vendor glue code.
Use it when a workflow needs Hacker News public data alongside other news and community sources, but should still keep one API key, one account balance, and one predictable JSON contract.
Common agent workflows
- Pull public Hacker News comment threads for sentiment, moderation, or audience-research agents.
- Collect top-level discussion around a post while preserving pagination and billing metadata.
- Give an AI agent a stable Hacker News data source without building a per-platform integration.
- Normalize Hacker News responses into the same UnifAPI envelope used across the catalog.
Unified envelope, platform-native fields
- List-style responses return `data` as an array of top-level records plus optional `pagination` for continuation tokens or cursors.
- The operation has a 6 credits ($0.006) minimum charge, so `billing.records_charged` can be higher than the visible records returned.
- If the workspace balance cannot cover every result, the response can be truncated and `billing.truncated_due_to_balance` tells the caller why.
Response status codes
Billing
This operation charges 1 credit per billable record, with a 6 credits ($0.006) operation minimum. Public responses include billing metadata with credits charged, records charged, and remaining workspace balance. Incorrect Credit deductions caused by platform failures can be restored as billing corrections.
Errors and retries
Authentication, validation, rate-limit, not-found, and provider errors use the unified UnifAPI error format. Agents should log `request_id`, retry only retryable failures, and treat invalid API keys, disabled keys, and expired keys as the same public `unauthorized` error type.
Fields in the data object
A successful Get a Hacker News comment with its thread call returns one data object with these fields (12 of 16 shown — the docs list the full schema).
- idnumber | null
- Unique Hacker News item id.
- typestring | null
- Item type. One of: story, comment, job, poll, pollopt, unknown.
- authorstring | null
- Author username when present.
- created_atnumber | null
- Creation time as an ISO-8601 timestamp. Unix seconds.
- titlestring | null
- Plain-text title when present.
- textstring | null
- Plain-text body when present (HTML stripped).
- urlstring | null
- External URL when present and publicly safe.
- scorenumber | null
- Score / votes when present.
- comment_countnumber | null
- Total comment count when present (stories/polls).
- parent_idnumber | null
- Parent item id for comments/pollopts.
- child_idsnumber[]
- Child item ids in ranked display order when present. Some list endpoints omit children and return an empty array.
- is_deadboolean | null
- Whether the item is marked dead. Some list endpoints omit this signal and return false.
Agents & Skills built on Hacker News
You rarely call Get a Hacker News comment with its thread by hand. These prebuilt agents and skills already read Hacker News data inside Claude or Codex — start from one of them, or call this endpoint yourself.
More Hacker News operations
Combine endpoints from the same platform, then join the results with other UnifAPI categories without changing authentication or response parsing.
List the comment tree of a Hacker News story
Returns the comments on a Hacker News story, depth-first with parent ids and depth, so a thread can be rebuilt. Paginate with `cursor`. Returns `not_found` when the story does not exist.
List jobs from Who is Hiring
Returns the top-level job posts from the monthly Hacker News "Who is Hiring" thread, for the latest month or a given `month` (YYYY-MM). Paginate with `cursor`.
Get Hacker News item by ID
Fetch a single Hacker News item. Stories, comments, jobs, polls, and poll options share the same item shape.
List a Hacker News user's comments
Returns a Hacker News user's comments, newest first. Paginate with `cursor`. Returns `not_found` when the user does not exist.
Get largest Hacker News item ID
Return the ID of the most recently created Hacker News item. Useful as an upper bound for walking the full item range or detecting new activity since a previous poll.
Search Hacker News stories and comments
Full-text search over Hacker News stories, comments, polls and jobs with filters for type, author, domain, date range and points. Paginate with `cursor`.