Catalog / Hacker News

Hacker News API

news.ycombinator.com

Read-only live Hacker News stories, story details, and top-level comments backed by the public Firebase API. Newest-story pages use opaque offset cursors, while polling uses a source ID checkpoint and reports when a checkpoint has expired from the source's 500-item window.

  • Social & video
  • hacker-news
  • news
  • stories
  • comments
  • polling
4 endpointsDocs updated

Endpoint health

Loading verification…

Connect your agent

Connect through MCP so your agent can find this API, read its docs, and call its endpoints.

Setup guide

Add the server from your terminal.

Claude Code · terminal
claude mcp add --transport http agent-data https://agent-data.motie.dev/mcp

In Claude Code, run /mcp, select agent-data, then Authenticate. Sign in to your agent-data account in the browser.

Then ask your agent to use the Hacker News API for your task.

Call it over HTTP

Get an API key

Sign up free, generate an API key, and set it as AGENT_DATA_API_KEY in your environment. Your first 100 calls each month are free.

Read the source's newest-story window; ranking can change between cursor calls.

Optional parameters 2

Number of stories to return; maximum 30 per request

Opaque cursor returned by the previous page

View call pricing
cURL · Stories newest
curl --request GET --get 'https://api.agent-data.dev/news-ycombinator-com/v1/stories/newest' \
  --header "Authorization: Bearer $AGENT_DATA_API_KEY"

Endpoints

Inputs and response fields for every endpoint in this API.

GETStories newest/v1/stories/newest

Read the source's newest-story window; ranking can change between cursor calls.

Input

limitOptionalQuery · integer, min: 1, max: 30, default: 20

Number of stories to return; maximum 30 per request

Example: 20

cursorOptionalQuery · string | null

Opaque cursor returned by the previous page

Response

itemsobject[]
items[].by?string | null
items[].idstring
items[].url?string | null
items[].deadboolean
items[].kids?integer[]
items[].text?string | null
items[].time?string | null
items[].typestring
items[].score?integer | null
items[].title?string | null
items[].deletedboolean
items[].parent_id?integer | null
items[].source_idinteger
items[].descendants?integer | null
checkpointstring
next_cursorstring | null
source_limitinteger

Fields marked ? are optional.

For the next page, pass next_cursor from the response as cursor. Leave it empty on the first call.

GETStories poll/v1/stories/poll

Drain a checkpoint backlog with a cursor; an absent source marker expires with 410.

Input

after_idOptionalQuery · integer, min: 1 | null

Last processed Hacker News story ID; required when cursor is omitted

Example: 49806335

limitOptionalQuery · integer, min: 1, max: 30, default: 20

Maximum number of new stories to return

Example: 20

cursorOptionalQuery · string | null

Opaque continuation returned when the checkpoint backlog exceeds limit

Response

itemsobject[]
items[].by?string | null
items[].idstring
items[].url?string | null
items[].deadboolean
items[].kids?integer[]
items[].text?string | null
items[].time?string | null
items[].typestring
items[].score?integer | null
items[].title?string | null
items[].deletedboolean
items[].parent_id?integer | null
items[].source_idinteger
items[].descendants?integer | null
checkpointstring
source_limitinteger
next_poll_afterstring
checkpoint_foundboolean
next_poll_cursorstring | null

Fields marked ? are optional.

For the next page, pass next_cursor from the response as cursor. Leave it empty on the first call.

GETStories by story id/v1/stories/{story_id}

Get a Hacker News story or item

Input

story_idRequiredPath · integer, min: 1

Numeric Hacker News story/item ID

Example: 49806271

Response

storyobject
story.by?string | null
story.idstring
story.url?string | null
story.deadboolean
story.kids?integer[]
story.text?string | null
story.time?string | null
story.typestring
story.score?integer | null
story.title?string | null
story.deletedboolean
story.parent_id?integer | null
story.source_idinteger
story.descendants?integer | null

Fields marked ? are optional.

GETStories by story id comments/v1/stories/{story_id}/comments

List top-level comments for a Hacker News story

Input

story_idRequiredPath · integer, min: 1

Numeric parent Hacker News story ID

Example: 49806271

limitOptionalQuery · integer, min: 1, max: 30, default: 20

Number of top-level comments to return; maximum 30

Example: 20

cursorOptionalQuery · string | null

Opaque comment-page cursor returned by the previous page

Response

itemsobject[]
items[].by?string | null
items[].idstring
items[].deadboolean
items[].kids?integer[]
items[].text?string | null
items[].time?string | null
items[].deletedboolean
items[].parent_id?integer | null
items[].source_idinteger
coveragestring
story_idinteger
next_cursorstring | null

Fields marked ? are optional.

For the next page, pass next_cursor from the response as cursor. Leave it empty on the first call.

Don’t see the endpoint you need?

Ask agent-data to add an endpoint or return more fields. Extensions are free and keep existing endpoints working.