Answers / Hacker News

Is there an API to search Hacker News?

Yes. Send GET /v1/hackernews/search with a query parameter. PostToData returns matching stories with the title, the outbound link, points, comment count, author and publish time, in the same shape it uses for every other platform.

Hacker News · search posts · $0.001 a call · one verified website trial · updated 2026-11-13

Run it live

Calls run only when you press Run. Opening this page does not spend credit.

Loading…

Your results will appear here. Choose a platform and action, then press Run.

Real API calls require verification for one trial, or a signed-in account with prepaid credit.

From code

curl
curl "https://posttodata.com/v1/hackernews/search?query=model+context+protocol&limit=5" -H "Authorization: Bearer YOUR_API_KEY"
Python
import requests

r = requests.get(
    "https://posttodata.com/v1/hackernews/search",
    headers={"Authorization": "Bearer YOUR_API_KEY"},
    params={"query": "model context protocol", "limit": 5},
)
for item in r.json()["data"]["items"]:
    print(item["url"], item.get("text") or item.get("title"))

From your AI

Claude and ChatGPT clients that support OAuth can sign in without pasting a key. Follow the client setup guide. The command below is the API-key option for Claude Code.

Add the MCP server once
claude mcp add --transport http posttodata https://posttodata.com/mcp --header "Authorization: Bearer YOUR_API_KEY"

Then ask

“Search Hacker News for discussions about the Model Context Protocol and list the five most upvoted, with links.”

The model calls search_posts with platform hackernews.

Good to know

  • Points are returned as metrics.score. Hacker News has no likes, shares or views.
  • Use sort=latest to follow a topic over time.
  • Use the trending action for the current front page.

Full reference in the docs. All Hacker News endpoints are on the Hacker News API page.

More answers